wl_management/src/main/resources/mapper/app/ResultDetailMapper.xml
2020-08-24 19:58:10 +08:00

134 lines
5.8 KiB
XML

<?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.lz.modules.sys.dao.app.ResultDetailMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.sys.entity.app.ResultDetail">
<id column="id" property="id"/>
<result column="is_delete" property="isDelete"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="type" property="type"/>
<result column="target" property="target"/>
<result column="key_result" property="keyResult"/>
<result column="check_weight" property="checkWeight"/>
<result column="check_result" property="checkResult"/>
<result column="super_score" property="superScore"/>
<result column="acquire_score" property="acquireScore"/>
<result column="score_comment" property="scoreComment"/>
<result column="record_id" property="recordId"/>
<result column="staff_id" property="staffId"/>
<result column="priority" property="priority"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, type AS type, target AS target, key_result AS keyResult, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority
</sql>
<select id="selectResultDetailById" resultType="ResultDetail" >
select * from lz_result_detail where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertResultDetail" parameterType="ResultDetail" useGeneratedKeys="true" keyProperty="id" >
insert into lz_result_detail(
<if test="type != null">type, </if>
<if test="target != null">target, </if>
<if test="keyResult != null">key_result, </if>
<if test="checkWeight != null">check_weight, </if>
<if test="checkResult != null">check_result, </if>
<if test="superScore != null">super_score, </if>
<if test="acquireScore != null">acquire_score, </if>
<if test="scoreComment != null">score_comment, </if>
<if test="recordId != null">record_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="priority != null">priority, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="type != null">#{ type}, </if>
<if test="target != null">#{ target}, </if>
<if test="keyResult != null">#{ keyResult}, </if>
<if test="checkWeight != null">#{ checkWeight}, </if>
<if test="checkResult != null">#{ checkResult}, </if>
<if test="superScore != null">#{ superScore}, </if>
<if test="acquireScore != null">#{ acquireScore}, </if>
<if test="scoreComment != null">#{ scoreComment}, </if>
<if test="recordId != null">#{ recordId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="priority != null">#{ priority}, </if>
0,
now(),
now()
)
</insert>
<update id="updateResultDetailById" parameterType="ResultDetail" >
update
lz_result_detail
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="type != null">type = #{type},</if>
<if test="target != null">target = #{target},</if>
<if test="keyResult != null">key_result = #{keyResult},</if>
<if test="checkWeight != null">check_weight = #{checkWeight},</if>
<if test="checkResult != null">check_result = #{checkResult},</if>
<if test="superScore != null">super_score = #{superScore},</if>
<if test="acquireScore != null">acquire_score = #{acquireScore},</if>
<if test="scoreComment != null">score_comment = #{scoreComment},</if>
<if test="recordId != null">record_id = #{recordId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="priority != null">priority = #{priority}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverResultDetailById" parameterType="ResultDetail" >
update
lz_result_detail
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
type = #{type},
target = #{target},
key_result = #{keyResult},
check_weight = #{checkWeight},
check_result = #{checkResult},
super_score = #{superScore},
acquire_score = #{acquireScore},
score_comment = #{scoreComment},
record_id = #{recordId},
staff_id = #{staffId},
priority = #{priority}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteResultDetailById" parameterType="java.lang.Long">
update lz_result_detail set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByRecordId" resultType="com.lz.modules.sys.entity.app.ResultDetail">
select * from lz_result_detail where record_id=#{recordResultId} and is_delete = 0 order by type asc ,priority desc
</select>
<select id="selectByRecordIdType" resultType="com.lz.modules.sys.entity.app.ResultDetail">
select * from lz_result_detail where record_id=#{recordResultId} and type = #{type} and is_delete = 0 order by type asc ,priority desc
</select>
</mapper>