wl_management/src/main/resources/mapper/app/ResultCommentMapper.xml
2020-08-10 17:17:56 +08:00

79 lines
2.7 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="comment_user_id" property="commentUserId"/>
</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, comment_user_id AS commentUserId
</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="commentUserId != null">comment_user_id, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="recordId != null">#{ recordId}, </if>
<if test="commentUserId != null">#{ commentUserId}, </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="commentUserId != null">comment_user_id = #{commentUserId}</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},
comment_user_id = #{commentUserId}
,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>
</mapper>