2025-07-09 14:31:05 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
2025-07-15 18:40:22 +08:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2025-07-18 15:27:22 +08:00
<mapper namespace= "com.zhyc.module.produce.other.mapper.ScFixHoofMapper" >
2025-07-15 18:40:22 +08:00
2025-08-19 17:07:16 +08:00
<resultMap type= "com.zhyc.module.produce.other.domain.ScFixHoof" id= "ScFixHoofResult" >
2025-07-15 18:40:22 +08:00
<result property= "id" column= "id" />
2025-07-22 14:55:18 +08:00
<result property= "manageTags" column= "manageTags" />
2025-08-19 17:07:16 +08:00
<result property= "eventType" column= "event_type" />
2025-07-15 18:40:22 +08:00
<result property= "sheepfold" column= "sheepfold" />
2025-07-22 14:55:18 +08:00
<result property= "varietyId" column= "variety_id" />
2025-07-15 18:40:22 +08:00
<result property= "sheepfoldName" column= "sheepfoldName" />
<result property= "comment" column= "comment" />
<result property= "technician" column= "technician" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
2025-10-23 16:36:01 +08:00
<result property= "eventDate" column= "eventDate" />
2025-07-09 14:31:05 +08:00
</resultMap>
2025-07-12 17:56:28 +08:00
<sql id= "selectScFixHoofVo" >
2025-07-15 18:40:22 +08:00
select fh.id,
2025-08-14 15:54:50 +08:00
bs.manage_tags as manageTags,
2026-02-03 14:41:28 +08:00
'修蹄' as event_type,
2025-08-14 15:54:50 +08:00
bs.sheepfold_id as sheepfold,
sf.sheepfold_name as sheepfoldName,
bs.variety_id as varietyId,
bv.variety as varietyName,
2025-07-15 18:40:22 +08:00
fh.comment,
fh.technician,
fh.create_by,
2025-10-23 16:36:01 +08:00
fh.create_time,
fh.event_date as eventDate
2025-07-15 18:40:22 +08:00
from sc_fix_hoof fh
2025-07-22 14:55:18 +08:00
left join bas_sheep bs on fh.sheep_id = bs.id
2025-08-14 15:54:50 +08:00
left join da_sheepfold sf on bs.sheepfold_id = sf.id
left join bas_sheep_variety bv on bs.variety_id = bv.id
2025-07-09 14:31:05 +08:00
</sql>
2026-01-16 12:34:24 +08:00
<select id= "selectScFixHoofList" resultMap= "ScFixHoofResult" >
2025-07-12 17:56:28 +08:00
<include refid= "selectScFixHoofVo" />
2025-07-15 18:40:22 +08:00
<where >
2026-01-16 12:34:24 +08:00
<if test= "manageTagsList != null and manageTagsList.size() > 0" >
<foreach collection= "manageTagsList" item= "tag" separator= "or" open= "and (" close= ")" >
bs.manage_tags like concat('%', #{tag}, '%')
</foreach>
2025-07-15 18:40:22 +08:00
</if>
2026-01-16 12:34:24 +08:00
<if test= "sc.sheepfold != null" > and bs.sheepfold_id = #{sc.sheepfold}</if>
<if test= "sc.varietyId != null" > and bs.variety_id = #{sc.varietyId}</if>
2026-02-03 14:41:28 +08:00
<if test= "sc.technician != null and sc.technician != ''" > and fh.technician like concat('%',
#{sc.technician}, '%')
</if>
2026-01-16 12:34:24 +08:00
<if test= "sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''" >
and fh.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
2025-07-22 14:55:18 +08:00
</if>
2026-01-16 12:34:24 +08:00
<if test= "sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''" >
and fh.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
2025-10-23 16:36:01 +08:00
</if>
2026-02-03 14:41:28 +08:00
<if test= "sc.isDelete != null" >
and bs.is_delete = #{sc.isDelete}
</if>
2026-02-09 20:22:51 +08:00
${sc.params.dataScope}
2025-07-09 14:31:05 +08:00
</where>
2025-08-22 19:32:56 +08:00
ORDER BY fh.create_time DESC
2025-07-09 14:31:05 +08:00
</select>
2025-07-15 18:40:22 +08:00
<select id= "selectScFixHoofById" parameterType= "java.lang.Integer" resultMap= "ScFixHoofResult" >
2025-07-12 17:56:28 +08:00
<include refid= "selectScFixHoofVo" />
2025-07-15 18:40:22 +08:00
where fh.id = #{id}
2025-07-09 14:31:05 +08:00
</select>
2026-02-09 20:22:51 +08:00
<insert id= "insertScFixHoof" parameterType= "ScFixHoof" useGeneratedKeys= "true" keyProperty= "id" >
insert into sc_fix_hoof
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "sheepId != null" > sheep_id,</if>
<if test= "sheepfold != null" > sheepfold,</if>
<if test= "varietyId != null" > variety_id,</if>
<if test= "comment != null" > comment,</if>
<if test= "technician != null and technician != ''" > technician,</if>
<if test= "eventDate != null and eventDate != ''" > event_date,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "userId != null" > user_id,</if>
<if test= "deptId != null" > dept_id,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "sheepId != null" > #{sheepId},</if>
<if test= "sheepfold != null" > #{sheepfold},</if>
<if test= "varietyId != null" > #{varietyId},</if>
<if test= "comment != null" > #{comment},</if>
<if test= "technician != null and technician != ''" > #{technician},</if>
<if test= "eventDate != null and eventDate != ''" > #{eventDate},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "userId != null" > #{userId},</if>
<if test= "deptId != null" > #{deptId},</if>
</trim>
2025-07-09 14:31:05 +08:00
</insert>
2025-07-12 17:56:28 +08:00
<update id= "updateScFixHoof" parameterType= "ScFixHoof" >
update sc_fix_hoof
2025-07-09 14:31:05 +08:00
<trim prefix= "SET" suffixOverrides= "," >
<if test= "sheepId != null" > sheep_id = #{sheepId},</if>
<if test= "sheepfold != null" > sheepfold = #{sheepfold},</if>
2025-07-22 14:55:18 +08:00
<if test= "varietyId != null" > variety_id=#{varietyId},</if>
2025-07-09 14:31:05 +08:00
<if test= "comment != null" > comment = #{comment},</if>
2025-07-12 17:56:28 +08:00
<if test= "technician != null and technician != ''" > technician = #{technician},</if>
2025-07-09 14:31:05 +08:00
<if test= "createBy != null" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
2025-07-15 18:40:22 +08:00
<delete id= "deleteScFixHoofById" parameterType= "java.lang.Integer" >
delete
from sc_fix_hoof
where id = #{id}
2025-07-09 14:31:05 +08:00
</delete>
2025-07-15 18:40:22 +08:00
<delete id= "deleteScFixHoofByIds" parameterType= "java.lang.Integer" >
delete from sc_fix_hoof where id in
2025-07-09 14:31:05 +08:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2025-07-22 14:55:18 +08:00
2026-01-16 12:34:24 +08:00
<select id= "searchEarNumbers" resultType= "java.lang.String" >
SELECT DISTINCT bs.manage_tags
FROM bas_sheep bs
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
AND bs.is_delete = 0
ORDER BY bs.manage_tags
</select>
2025-07-09 14:31:05 +08:00
</mapper>