wl_management/src/main/resources/mapper/app/ResultCommentMapper.xml
2020-10-26 19:03:13 +08:00

117 lines
4.4 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.ResultCommentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.sys.entity.app.ResultComment">
<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="record_id" property="recordId"/>
<result column="staff_id" property="staffId"/>
<result column="comment" property="comment"/>
<result column="staff_name" property="staffName"/>
<result column="status" property="status"/>
<result column="flow_record_id" property="flowRecordId"/>
<result column="opt_desc" property="optDesc"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, record_id AS recordId, staff_id AS staffId, comment AS comment, staff_name AS staffName, status AS status, flow_record_id AS flowRecordId, opt_desc AS optDesc
</sql>
<select id="selectResultCommentById" resultType="ResultComment" >
select * from lz_result_comment where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertResultComment" parameterType="ResultComment" useGeneratedKeys="true" keyProperty="id" >
insert into lz_result_comment(
<if test="recordId != null">record_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="comment != null">comment, </if>
<if test="staffName != null">staff_name, </if>
<if test="status != null">status, </if>
<if test="flowRecordId != null">flow_record_id, </if>
<if test="optDesc != null">opt_desc, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="recordId != null">#{ recordId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="comment != null">#{ comment}, </if>
<if test="staffName != null">#{ staffName}, </if>
<if test="status != null">#{ status}, </if>
<if test="flowRecordId != null">#{ flowRecordId}, </if>
<if test="optDesc != null">#{ optDesc}, </if>
0,
now(),
now()
)
</insert>
<update id="updateResultCommentById" parameterType="ResultComment" >
update
lz_result_comment
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="recordId != null">record_id = #{recordId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="staffName != null">staff_name = #{staffName},</if>
<if test="status != null">status = #{status},</if>
<if test="flowRecordId != null">flow_record_id = #{flowRecordId},</if>
<if test="optDesc != null">opt_desc = #{optDesc}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverResultCommentById" parameterType="ResultComment" >
update
lz_result_comment
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
record_id = #{recordId},
staff_id = #{staffId},
comment = #{comment},
staff_name = #{staffName},
status = #{status},
flow_record_id = #{flowRecordId},
opt_desc = #{optDesc}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteResultCommentById" parameterType="java.lang.Long">
update lz_result_comment set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByRecordId" resultType="com.lz.modules.sys.entity.app.ResultComment">
select * from lz_result_comment where record_id=#{recordId} and is_delete = 0
</select>
<select id="selectLastComment" resultType="com.lz.modules.sys.entity.app.ResultComment">
select * from lz_result_comment where record_id=#{recordId} and is_delete = 0 order by id desc limit 1
</select>
</mapper>