123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.jjt.hl.mapper.HlMetricsMapper">
- <resultMap type="HlMetrics" id="HlMetricsResult">
- <result property="hlMetricsId" column="HL_METRICS_ID"/>
- <result property="hlClassId" column="HL_CLASS_ID"/>
- <result property="metricsId" column="METRICS_ID"/>
- <result property="hlScore" column="HL_SCORE"/>
- <result property="hlStand" column="HL_STAND"/>
- <result property="metricsName" column="METRICS_NAME"/>
- <result property="metricsCode" column="METRICS_CODE"/>
- <result property="createBy" column="CREATE_BY"/>
- <result property="createTime" column="CREATE_TIME"/>
- <result property="updateBy" column="UPDATE_BY"/>
- <result property="updateTime" column="UPDATE_TIME"/>
- <result property="remark" column="REMARK"/>
- </resultMap>
- <sql id="selectHlMetricsVo">
- select *
- from (select a.*, b.METRICS_NAME, b.METRICS_CODE
- from hl_metrics a,
- metrics_def b
- where a.METRICS_ID = b.METRICS_ID) t
- </sql>
- <select id="selectHlMetricsList" parameterType="HlMetrics" resultMap="HlMetricsResult">
- <include refid="selectHlMetricsVo"/>
- <where>
- <if test="hlClassId != null ">
- and HL_CLASS_ID = #{hlClassId}
- </if>
- <if test="metricsId != null ">
- and METRICS_ID = #{metricsId}
- </if>
- <if test="hlScore != null and hlScore != ''">
- and HL_SCORE = #{hlScore}
- </if>
- <if test="hlStand != null and hlStand != ''">
- and HL_STAND = #{hlStand}
- </if>
- <if test="createBy != null and createBy != ''">
- and CREATE_BY = #{createBy}
- </if>
- <if test="createTime != null ">
- and CREATE_TIME = #{createTime}
- </if>
- <if test="updateBy != null and updateBy != ''">
- and UPDATE_BY = #{updateBy}
- </if>
- <if test="updateTime != null ">
- and UPDATE_TIME = #{updateTime}
- </if>
- <if test="remark != null and remark != ''">
- and REMARK = #{remark}
- </if>
- </where>
- </select>
- <select id="selectHlMetricsByHlMetricsId" parameterType="Long"
- resultMap="HlMetricsResult">
- <include refid="selectHlMetricsVo"/>
- where HL_METRICS_ID = #{hlMetricsId}
- </select>
- <select id="selectHlMetricsList4ModelId" resultType="com.jjt.hl.domain.HlMetrics">
- SELECT metrics_id, metrics_name, metrics_code
- FROM metrics_def
- WHERE metrics_id IN (SELECT metrics_id
- from biz_obj_metrics
- WHERE obj_id in (SELECT a.obj_id
- FROM biz_model_detail a,
- biz_obj b
- WHERE a.obj_id = b.obj_id
- AND b.obj_type = #{objType}
- AND a.MODEL_ID = #{modelId})
- group BY metrics_id)
- </select>
- <select id="hlMetricsList" resultType="com.jjt.hl.vo.HlMetricsVO">
- SELECT a.*, b.EVENT_ID, b.START_TIME, b.END_TIME, b.EVENT_STATUS, b.EVENT_VALUE
- FROM (SELECT a.*
- FROM biz_obj_metrics a,
- (SELECT a.OBJ_ID, b.METRICS_ID
- FROM hl_obj a,
- hl_metrics b
- WHERE a.HL_CLASS_ID = b.HL_CLASS_ID
- AND a.HL_CLASS_ID = #{hlClassId}) b
- WHERE a.obj_id = b.obj_id
- AND a.METRICS_ID = b.metrics_id) a
- LEFT JOIN
- (SELECT * FROM hl_event WHERE event_status = 1) b ON a.OBJ_METRICS_ID = b.obj_metrics_id
- </select>
- <insert id="insertHlMetrics" parameterType="HlMetrics" useGeneratedKeys="true"
- keyProperty="hlMetricsId">
- insert into hl_metrics
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="hlClassId != null">HL_CLASS_ID,
- </if>
- <if test="metricsId != null">METRICS_ID,
- </if>
- <if test="hlScore != null">HL_SCORE,
- </if>
- <if test="hlStand != null">HL_STAND,
- </if>
- <if test="createBy != null">CREATE_BY,
- </if>
- <if test="createTime != null">CREATE_TIME,
- </if>
- <if test="updateBy != null">UPDATE_BY,
- </if>
- <if test="updateTime != null">UPDATE_TIME,
- </if>
- <if test="remark != null">REMARK,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="hlClassId != null">#{hlClassId},
- </if>
- <if test="metricsId != null">#{metricsId},
- </if>
- <if test="hlScore != null">#{hlScore},
- </if>
- <if test="hlStand != null">#{hlStand},
- </if>
- <if test="createBy != null">#{createBy},
- </if>
- <if test="createTime != null">#{createTime},
- </if>
- <if test="updateBy != null">#{updateBy},
- </if>
- <if test="updateTime != null">#{updateTime},
- </if>
- <if test="remark != null">#{remark},
- </if>
- </trim>
- </insert>
- <update id="updateHlMetrics" parameterType="HlMetrics">
- update hl_metrics
- <trim prefix="SET" suffixOverrides=",">
- <if test="hlClassId != null">HL_CLASS_ID =
- #{hlClassId},
- </if>
- <if test="metricsId != null">METRICS_ID =
- #{metricsId},
- </if>
- <if test="hlScore != null">HL_SCORE =
- #{hlScore},
- </if>
- <if test="hlStand != null">HL_STAND =
- #{hlStand},
- </if>
- <if test="createBy != null">CREATE_BY =
- #{createBy},
- </if>
- <if test="createTime != null">CREATE_TIME =
- #{createTime},
- </if>
- <if test="updateBy != null">UPDATE_BY =
- #{updateBy},
- </if>
- <if test="updateTime != null">UPDATE_TIME =
- #{updateTime},
- </if>
- <if test="remark != null">REMARK =
- #{remark},
- </if>
- </trim>
- where HL_METRICS_ID = #{hlMetricsId}
- </update>
- <delete id="deleteHlMetricsByHlMetricsId" parameterType="Long">
- delete
- from hl_metrics
- where HL_METRICS_ID = #{hlMetricsId}
- </delete>
- <delete id="deleteHlMetricsByHlMetricsIds" parameterType="String">
- delete from hl_metrics where HL_METRICS_ID in
- <foreach item="hlMetricsId" collection="array" open="(" separator="," close=")">
- #{hlMetricsId}
- </foreach>
- </delete>
- </mapper>
|