|
@@ -5,110 +5,120 @@
|
|
|
<mapper namespace="com.jjt.biz.mapper.MetricsTplMapper">
|
|
|
|
|
|
<resultMap type="MetricsTpl" id="MetricsTplResult">
|
|
|
- <result property="tplId" column="TPL_ID"/>
|
|
|
- <result property="tplName" column="TPL_NAME"/>
|
|
|
- <result property="tplCode" column="TPL_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"/>
|
|
|
+ <result property="tplId" column="TPL_ID"/>
|
|
|
+ <result property="tplName" column="TPL_NAME"/>
|
|
|
+ <result property="tplCode" column="TPL_CODE"/>
|
|
|
+ <result property="num" column="NUM"/>
|
|
|
+ <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="selectMetricsTplVo">
|
|
|
- select TPL_ID, TPL_NAME, TPL_CODE, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK
|
|
|
- from metrics_tpl
|
|
|
+ select TPL_ID,
|
|
|
+ TPL_NAME,
|
|
|
+ TPL_CODE,
|
|
|
+ (select count(*) from METRICS_TPL_DETAIL where tpl_id = a.tpl_id) num,
|
|
|
+ CREATE_BY,
|
|
|
+ CREATE_TIME,
|
|
|
+ UPDATE_BY,
|
|
|
+ UPDATE_TIME,
|
|
|
+ REMARK
|
|
|
+ from metrics_tpl a
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectMetricsTplList" parameterType="MetricsTpl" resultMap="MetricsTplResult">
|
|
|
<include refid="selectMetricsTplVo"/>
|
|
|
<where>
|
|
|
- <if test="tplName != null and tplName != ''">
|
|
|
- and TPL_NAME like concat('%', #{tplName}, '%')
|
|
|
- </if>
|
|
|
- <if test="tplCode != null and tplCode != ''">
|
|
|
- and TPL_CODE = #{tplCode}
|
|
|
- </if>
|
|
|
- <if test="remark != null and remark != ''">
|
|
|
- and REMARK = #{remark}
|
|
|
- </if>
|
|
|
+ <if test="tplName != null and tplName != ''">
|
|
|
+ and TPL_NAME like concat('%', #{tplName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="tplCode != null and tplCode != ''">
|
|
|
+ and TPL_CODE = #{tplCode}
|
|
|
+ </if>
|
|
|
+ <if test="remark != null and remark != ''">
|
|
|
+ and REMARK = #{remark}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectMetricsTplByTplId" parameterType="Long"
|
|
|
resultMap="MetricsTplResult">
|
|
|
- <include refid="selectMetricsTplVo"/>
|
|
|
- where TPL_ID = #{tplId}
|
|
|
+ <include refid="selectMetricsTplVo"/>
|
|
|
+ where TPL_ID = #{tplId}
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertMetricsTpl" parameterType="MetricsTpl" useGeneratedKeys="true"
|
|
|
keyProperty="tplId">
|
|
|
insert into metrics_tpl
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="tplName != null">TPL_NAME,
|
|
|
- </if>
|
|
|
- <if test="tplCode != null">TPL_CODE,
|
|
|
- </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>
|
|
|
+ <if test="tplName != null">TPL_NAME,
|
|
|
+ </if>
|
|
|
+ <if test="tplCode != null">TPL_CODE,
|
|
|
+ </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="tplName != null">#{tplName},
|
|
|
- </if>
|
|
|
- <if test="tplCode != null">#{tplCode},
|
|
|
- </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>
|
|
|
+ <if test="tplName != null">#{tplName},
|
|
|
+ </if>
|
|
|
+ <if test="tplCode != null">#{tplCode},
|
|
|
+ </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="updateMetricsTpl" parameterType="MetricsTpl">
|
|
|
update metrics_tpl
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="tplName != null">TPL_NAME =
|
|
|
- #{tplName},
|
|
|
- </if>
|
|
|
- <if test="tplCode != null">TPL_CODE =
|
|
|
- #{tplCode},
|
|
|
- </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>
|
|
|
+ <if test="tplName != null">TPL_NAME =
|
|
|
+ #{tplName},
|
|
|
+ </if>
|
|
|
+ <if test="tplCode != null">TPL_CODE =
|
|
|
+ #{tplCode},
|
|
|
+ </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 TPL_ID = #{tplId}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteMetricsTplByTplId" parameterType="Long">
|
|
|
delete
|
|
|
- from metrics_tpl where TPL_ID = #{tplId}
|
|
|
+ from metrics_tpl
|
|
|
+ where TPL_ID = #{tplId}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteMetricsTplByTplIds" parameterType="String">
|