2025-07-29 21:58:46 +08:00
|
|
|
<?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.zhyc.module.produce.manage_sheep.mapper.ScChangeCommentMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeComment" id="ScChangeCommentResult">
|
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="sheepId" column="sheep_id"/>
|
|
|
|
|
<result property="manageTags" column="manage_tags"/>
|
2025-08-19 17:07:16 +08:00
|
|
|
<result property="sheepfoldName" column="sheepfold_name"/>
|
|
|
|
|
<result property="eventType" column="event_type"/>
|
2025-07-29 21:58:46 +08:00
|
|
|
<result property="newComment" column="new_comment"/>
|
|
|
|
|
<result property="oldComment" column="old_comment"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectScChangeCommentVo">
|
|
|
|
|
select scc.id,
|
|
|
|
|
scc.sheep_id,
|
2025-08-19 17:07:16 +08:00
|
|
|
bs.manage_tags as manage_tags,
|
|
|
|
|
sf.sheepfold_name as sheepfold_name,
|
|
|
|
|
'改备注' as event_type,
|
2025-07-29 21:58:46 +08:00
|
|
|
scc.new_comment,
|
|
|
|
|
scc.old_comment,
|
|
|
|
|
scc.create_by,
|
|
|
|
|
scc.create_time
|
|
|
|
|
from sc_change_comment scc
|
|
|
|
|
left join bas_sheep bs on scc.sheep_id = bs.id
|
2025-08-19 17:07:16 +08:00
|
|
|
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
2025-07-29 21:58:46 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult">
|
|
|
|
|
<include refid="selectScChangeCommentVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="manageTags != null and manageTags != ''">
|
|
|
|
|
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
|
|
|
|
</if>
|
2025-08-19 17:07:16 +08:00
|
|
|
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
|
2025-07-29 21:58:46 +08:00
|
|
|
<if test="newComment != null and newComment != ''">
|
|
|
|
|
and scc.new_comment like concat('%', #{newComment}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="oldComment != null and oldComment != ''">
|
|
|
|
|
and scc.old_comment like concat('%', #{oldComment}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
|
|
|
|
|
and params.endCreateTime != null and params.endCreateTime != ''">
|
|
|
|
|
and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
2025-08-22 19:32:56 +08:00
|
|
|
ORDER BY scc.create_time DESC
|
2025-07-29 21:58:46 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectScChangeCommentById" parameterType="Long" resultMap="ScChangeCommentResult">
|
|
|
|
|
<include refid="selectScChangeCommentVo"/>
|
|
|
|
|
where scc.id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertScChangeComment" parameterType="ScChangeComment" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into sc_change_comment
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="sheepId != null and sheepId != ''">sheep_id,</if>
|
|
|
|
|
<if test="newComment != null and newComment != ''">new_comment,</if>
|
|
|
|
|
<if test="oldComment != null and oldComment != ''">old_comment,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="sheepId != null and sheepId != ''">#{sheepId},</if>
|
|
|
|
|
<if test="newComment != null and newComment != ''">#{newComment},</if>
|
|
|
|
|
<if test="oldComment != null and oldComment != ''">#{oldComment},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateScChangeComment" parameterType="ScChangeComment">
|
|
|
|
|
update sc_change_comment
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="sheepId != null and sheepId != ''">sheep_id = #{sheepId},</if>
|
|
|
|
|
<if test="newComment != null and newComment != ''">new_comment = #{newComment},</if>
|
|
|
|
|
<if test="oldComment != null and oldComment != ''">old_comment = #{oldComment},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteScChangeCommentById" parameterType="Long">
|
|
|
|
|
delete
|
|
|
|
|
from sc_change_comment
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteScChangeCommentByIds" parameterType="String">
|
|
|
|
|
delete from sc_change_comment where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|