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.bodyManage.mapper.ScBreastRatingMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBreastRating" id="ScBreastRatingResult">
|
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="sheepId" column="sheep_id"/>
|
|
|
|
|
<result property="manageTags" column="manageTags"/>
|
2025-08-14 15:54:50 +08:00
|
|
|
<result property="varietyId" column="varietyId"/>
|
|
|
|
|
<result property="varietyName" column="varietyName"/>
|
|
|
|
|
<result property="eventType" column="event_type"/>
|
|
|
|
|
<result property="eventDate" column="event_date"/>
|
|
|
|
|
<result property="sheepfoldId" column="sheepfoldId"/>
|
|
|
|
|
<result property="sheepfoldName" column="sheepfoldName"/>
|
2025-07-29 21:58:46 +08:00
|
|
|
<result property="depth" column="depth"/>
|
|
|
|
|
<result property="length" column="length"/>
|
|
|
|
|
<result property="position" column="position"/>
|
|
|
|
|
<result property="adbere" column="adbere"/>
|
|
|
|
|
<result property="spacing" column="spacing"/>
|
|
|
|
|
<result property="score" column="score"/>
|
|
|
|
|
<result property="comment" column="comment"/>
|
|
|
|
|
<result property="technician" column="technician"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectScBreastRatingVo">
|
|
|
|
|
select sbr.*,
|
2025-08-14 15:54:50 +08:00
|
|
|
bs.manage_tags as manageTags,
|
|
|
|
|
bsv.id as varietyId,
|
|
|
|
|
bsv.variety as varietyName,
|
|
|
|
|
'乳房评分' as event_type,
|
|
|
|
|
sf.id as sheepfoldId,
|
|
|
|
|
sf.sheepfold_name as sheepfoldName,
|
|
|
|
|
sbr.event_date
|
2025-07-29 21:58:46 +08:00
|
|
|
from sc_breast_rating sbr
|
|
|
|
|
left join bas_sheep bs on sbr.sheep_id = bs.id
|
2025-08-14 15:54:50 +08:00
|
|
|
left join bas_sheep_variety bsv on bs.variety_id = bsv.id
|
|
|
|
|
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
2025-07-29 21:58:46 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectScBreastRatingList" parameterType="ScBreastRating" resultMap="ScBreastRatingResult">
|
|
|
|
|
<include refid="selectScBreastRatingVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="manageTags != null and manageTags != ''">
|
|
|
|
|
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
|
|
|
|
</if>
|
2025-08-14 15:54:50 +08:00
|
|
|
<if test="varietyId != null">and bsv.id = #{varietyId}</if>
|
|
|
|
|
<if test="sheepfoldId != null">and sf.id = #{sheepfoldId}</if>
|
|
|
|
|
<if test="params.beginEventDate != null and params.endEventDate != null">
|
|
|
|
|
and sbr.event_date between #{params.beginEventDate} and #{params.endEventDate}
|
|
|
|
|
</if>
|
2025-07-29 21:58:46 +08:00
|
|
|
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
|
|
|
|
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
2025-10-23 16:36:01 +08:00
|
|
|
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
|
|
|
|
|
ORDER BY sbr.${orderBy} ${sortDirection}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
|
|
|
|
|
ORDER BY sbr.create_time DESC
|
|
|
|
|
</if>
|
|
|
|
|
|
2025-07-29 21:58:46 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">
|
|
|
|
|
<include refid="selectScBreastRatingVo"/>
|
|
|
|
|
where sbr.id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertScBreastRating" parameterType="ScBreastRating" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into sc_breast_rating
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="sheepId != null">sheep_id,</if>
|
2025-08-14 15:54:50 +08:00
|
|
|
<if test="eventDate != null">event_date,</if>
|
2025-07-29 21:58:46 +08:00
|
|
|
<if test="depth != null">depth,</if>
|
|
|
|
|
<if test="length != null">length,</if>
|
|
|
|
|
<if test="position != null">position,</if>
|
|
|
|
|
<if test="adbere != null">adbere,</if>
|
|
|
|
|
<if test="spacing != null">spacing,</if>
|
|
|
|
|
<if test="score != null">score,</if>
|
|
|
|
|
<if test="comment != null">comment,</if>
|
|
|
|
|
<if test="technician != null">technician,</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">#{sheepId},</if>
|
2025-08-14 15:54:50 +08:00
|
|
|
<if test="eventDate != null">#{eventDate},</if>
|
2025-07-29 21:58:46 +08:00
|
|
|
<if test="depth != null">#{depth},</if>
|
|
|
|
|
<if test="length != null">#{length},</if>
|
|
|
|
|
<if test="position != null">#{position},</if>
|
|
|
|
|
<if test="adbere != null">#{adbere},</if>
|
|
|
|
|
<if test="spacing != null">#{spacing},</if>
|
|
|
|
|
<if test="score != null">#{score},</if>
|
|
|
|
|
<if test="comment != null">#{comment},</if>
|
|
|
|
|
<if test="technician != null">#{technician},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateScBreastRating" parameterType="ScBreastRating">
|
|
|
|
|
update sc_breast_rating
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
2025-08-14 15:54:50 +08:00
|
|
|
<if test="eventDate != null">event_date = #{eventDate},</if>
|
2025-07-29 21:58:46 +08:00
|
|
|
<if test="depth != null">depth = #{depth},</if>
|
|
|
|
|
<if test="length != null">length = #{length},</if>
|
|
|
|
|
<if test="position != null">position = #{position},</if>
|
|
|
|
|
<if test="adbere != null">adbere = #{adbere},</if>
|
|
|
|
|
<if test="spacing != null">spacing = #{spacing},</if>
|
|
|
|
|
<if test="score != null">score = #{score},</if>
|
|
|
|
|
<if test="comment != null">comment = #{comment},</if>
|
|
|
|
|
<if test="technician != null">technician = #{technician},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteScBreastRatingById" parameterType="Long">
|
|
|
|
|
delete
|
|
|
|
|
from sc_breast_rating
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteScBreastRatingByIds" parameterType="String">
|
|
|
|
|
delete from sc_breast_rating where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|