2025-07-15 17:08:09 +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.biosafety.mapper.ImmunityMapper" >
<resultMap type= "Immunity" id= "ImmunityResult" >
<result property= "id" column= "id" />
<result property= "sheepId" column= "sheep_id" />
2025-07-25 15:12:35 +08:00
<result property= "sheepNo" column= "sheep_no" />
2025-07-15 17:08:09 +08:00
<result property= "usageId" column= "usage_id" />
<result property= "variety" column= "variety" />
<result property= "sheepType" column= "sheep_type" />
<result property= "gender" column= "gender" />
<result property= "monthAge" column= "month_age" />
<result property= "parity" column= "parity" />
2025-07-25 15:12:35 +08:00
<result property= "breed" column= "breed" />
2025-07-15 17:08:09 +08:00
<result property= "datetime" column= "datetime" />
<result property= "technical" column= "technical" />
<result property= "comment" column= "comment" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "createBy" column= "create_by" />
</resultMap>
<sql id= "selectImmunityVo" >
2025-07-25 15:12:35 +08:00
select s.id, datetime, sheep_id, usage_id, variety, sheep_type, s.gender, month_age, s.parity, breed, technical,
s.comment, s.update_by, s.update_time, s.create_by, s.create_time,
bs.manage_tags sheep_no
from sw_immunity s
left join bas_sheep bs on s.sheep_id = bs.id
2025-07-15 17:08:09 +08:00
</sql>
<select id= "selectImmunityList" parameterType= "Immunity" resultMap= "ImmunityResult" >
<include refid= "selectImmunityVo" />
<where >
<if test= "sheepId != null " > and sheep_id = #{sheepId}</if>
<if test= "sheepType != null " > and sheep_type = #{sheepType}</if>
<if test= "params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''" > and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test= "technical != null and technical != ''" > and technical = #{technical}</if>
</where>
2025-08-24 00:03:46 +08:00
ORDER BY datetime DESC
2025-07-15 17:08:09 +08:00
</select>
<select id= "selectImmunityById" parameterType= "Long" resultMap= "ImmunityResult" >
<include refid= "selectImmunityVo" />
2025-07-25 15:12:35 +08:00
where s.id = #{id}
2025-07-15 17:08:09 +08:00
</select>
<insert id= "insertImmunity" parameterType= "Immunity" useGeneratedKeys= "true" keyProperty= "id" >
insert into sw_immunity
2025-07-25 15:12:35 +08:00
(sheep_id, usage_id, variety, sheep_type, gender, month_age,
parity, breed,datetime, technical, comment,
update_by, update_time, create_by, create_time)
values
<foreach collection= "list" item= "d" separator= "," >
(#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType},
#{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime},
#{d.technical}, #{d.comment},
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
</foreach>
2025-07-15 17:08:09 +08:00
</insert>
<update id= "updateImmunity" parameterType= "Immunity" >
update sw_immunity
<trim prefix= "SET" suffixOverrides= "," >
<if test= "sheepId != null" > sheep_id = #{sheepId},</if>
<if test= "usageId != null" > usage_id = #{usageId},</if>
<if test= "variety != null" > variety = #{variety},</if>
<if test= "sheepType != null" > sheep_type = #{sheepType},</if>
<if test= "gender != null" > gender = #{gender},</if>
<if test= "monthAge != null" > month_age = #{monthAge},</if>
<if test= "parity != null" > parity = #{parity},</if>
2025-07-23 18:33:08 +08:00
<if test= "breed != null" > breed = #{breed},</if>
2025-07-15 17:08:09 +08:00
<if test= "datetime != null" > datetime = #{datetime},</if>
<if test= "technical != null" > technical = #{technical},</if>
<if test= "comment != null" > comment = #{comment},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "createBy != null" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id= "deleteImmunityById" parameterType= "Long" >
delete from sw_immunity where id = #{id}
</delete>
<delete id= "deleteImmunityByIds" parameterType= "String" >
delete from sw_immunity where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
</mapper>