2020-12-10 10:15:31 +08:00

124 lines
4.9 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.performance.dao.TaskCommentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.performance.entity.TaskComment">
<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="task_id" property="taskId"/>
<result column="type" property="type"/>
<result column="detail_id" property="detailId"/>
<result column="result_record_id" property="resultRecordId"/>
<result column="staff_id" property="staffId"/>
<result column="content" property="content"/>
<result column="staff_name" property="staffName"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, task_id AS taskId, type AS type, detail_id AS detailId, result_record_id AS resultRecordId, staff_id AS staffId, content AS content, staff_name AS staffName
</sql>
<select id="selectTaskCommentById" resultType="TaskComment" >
select * from lz_task_comment where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertTaskComment" parameterType="TaskComment" useGeneratedKeys="true" keyProperty="id" >
insert into lz_task_comment(
<if test="taskId != null">task_id, </if>
<if test="type != null">type, </if>
<if test="detailId != null">detail_id, </if>
<if test="resultRecordId != null">result_record_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="content != null">content, </if>
<if test="staffName != null">staff_name, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="taskId != null">#{ taskId}, </if>
<if test="type != null">#{ type}, </if>
<if test="detailId != null">#{ detailId}, </if>
<if test="resultRecordId != null">#{ resultRecordId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="content != null">#{ content}, </if>
<if test="staffName != null">#{ staffName}, </if>
0,
now(),
now()
)
</insert>
<update id="updateTaskCommentById" parameterType="TaskComment" >
update
lz_task_comment
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="taskId != null">task_id = #{taskId},</if>
<if test="type != null">type = #{type},</if>
<if test="detailId != null">detail_id = #{detailId},</if>
<if test="resultRecordId != null">result_record_id = #{resultRecordId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="content != null">content = #{content},</if>
<if test="staffName != null">staff_name = #{staffName}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverTaskCommentById" parameterType="TaskComment" >
update
lz_task_comment
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
task_id = #{taskId},
type = #{type},
detail_id = #{detailId},
result_record_id = #{resultRecordId},
staff_id = #{staffId},
content = #{content},
staff_name = #{staffName}
,gmt_modified = now()
where id = #{id}
</update>
<select id="selectByCondition" resultType="com.lz.modules.performance.entity.TaskComment">
select * from lz_task_comment where is_delete = 0
and (detail_id = #{taskModel.detailId} or task_id=#{taskModel.taskId} )
order by id desc
</select>
<update id="deleteTaskCommentById" parameterType="java.lang.Long">
update lz_task_comment set is_delete = 1 where id=#{id} limit 1
</update>
<update id="deleteTaskCommensByTaskId" parameterType="java.lang.Long">
update lz_task_comment set is_delete = 1 where task_id=#{taskId}
</update>
<select id="selectTaskCommentByTaskId" resultType="TaskComment" >
select * from lz_task_comment where task_id=#{taskId} and is_delete = 0 order by id desc limit 1
</select>
<select id="selectTaskCommentByDetailId" resultType="TaskComment" >
select * from lz_task_comment where detail_id=#{detailId} and is_delete = 0 order by id desc limit 1
</select>
</mapper>