业务结构调整
This commit is contained in:
@@ -0,0 +1,208 @@
|
||||
<?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.breed.mapper.ScBreedPlanGenerateMapper">
|
||||
|
||||
<resultMap type="ScBreedPlanGenerate" id="ScBreedPlanGenerateResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="planName" column="plan_name" />
|
||||
<result property="planType" column="plan_type" />
|
||||
<result property="planDate" column="plan_date" />
|
||||
<result property="totalEweCount" column="total_ewe_count" />
|
||||
<result property="totalRamCount" column="total_ram_count" />
|
||||
<result property="breedRatio" column="breed_ratio" />
|
||||
<result property="status" column="status" />
|
||||
<result property="approver" column="approver" />
|
||||
<result property="approveTime" column="approve_time" />
|
||||
<result property="approveRemark" column="approve_remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBreedPlanGenerateVo">
|
||||
select id, plan_name, plan_type, plan_date, total_ewe_count, total_ram_count,
|
||||
breed_ratio, status, approver, approve_time, approve_remark,
|
||||
create_by, create_time, update_by, update_time
|
||||
from sc_breed_plan_generate
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreedPlanGenerateList" parameterType="ScBreedPlanGenerate" resultMap="ScBreedPlanGenerateResult">
|
||||
<include refid="selectScBreedPlanGenerateVo"/>
|
||||
<where>
|
||||
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
|
||||
<if test="planType != null"> and plan_type = #{planType}</if>
|
||||
<if test="planDate != null"> and plan_date = #{planDate}</if>
|
||||
<if test="status != null"> and status = #{status}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectScBreedPlanGenerateById" parameterType="Long" resultMap="ScBreedPlanGenerateResult">
|
||||
<include refid="selectScBreedPlanGenerateVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 筛选符合条件的母羊 -->
|
||||
<select id="selectEligibleEwe" resultType="Map">
|
||||
select
|
||||
sf.id,
|
||||
sf.bs_manage_tags,
|
||||
sf.variety,
|
||||
sf.name as sheep_type,
|
||||
sf.gender,
|
||||
sf.month_age,
|
||||
sf.current_weight,
|
||||
sf.post_lambing_day,
|
||||
sf.breed
|
||||
from sheep_file sf
|
||||
where sf.gender = 1
|
||||
and sf.is_delete = 0
|
||||
and (sf.status_id = 1 or sf.status_id is null)
|
||||
and (
|
||||
-- 青年羊或超龄羊的配种条件
|
||||
(sf.name in ('青年羊', '超龄羊') and (
|
||||
(sf.variety = '湖羊' and sf.month_age >= 7.5 and sf.current_weight >= 33) or
|
||||
(sf.variety = '东佛里生' and sf.month_age >= 9 and sf.current_weight >= 50) or
|
||||
(sf.variety not in ('湖羊', '东佛里生') and sf.month_age >= 9 and sf.current_weight >= 50)
|
||||
))
|
||||
or
|
||||
-- 泌乳羊或种母羊的配种条件
|
||||
(sf.name in ('泌乳羊', '种母羊') and sf.post_lambing_day > 45 and sf.current_weight > 0)
|
||||
)
|
||||
order by sf.variety, sf.month_age desc
|
||||
</select>
|
||||
|
||||
<!-- 筛选符合条件的公羊 -->
|
||||
<select id="selectEligibleRam" resultType="Map">
|
||||
select
|
||||
sf.id,
|
||||
sf.manage_tags as bs_manage_tags,
|
||||
bv.variety as variety,
|
||||
bst.name as sheep_type,
|
||||
sf.gender,
|
||||
TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) as month_age,
|
||||
sf.current_weight,
|
||||
bbs.breed as breed
|
||||
from bas_sheep sf
|
||||
left join bas_sheep_variety bv on sf.variety_id = bv.id
|
||||
left join bas_sheep_type bst on sf.type_id = bst.id
|
||||
left join bas_breed_status bbs on sf.breed_status_id = bbs.id
|
||||
where sf.gender = 2
|
||||
and sf.is_delete = 0
|
||||
and sf.status_id = 1
|
||||
and (
|
||||
-- 青年羊或超龄羊的参配条件
|
||||
(bst.name in ('青年羊', '超龄羊') and (
|
||||
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 7.5 and sf.current_weight >= 33) or
|
||||
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50) or
|
||||
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50)
|
||||
))
|
||||
or
|
||||
-- 其他类型公羊
|
||||
bst.name not in ('青年羊', '超龄羊')
|
||||
)
|
||||
order by bv.variety, TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) desc
|
||||
</select>
|
||||
|
||||
<insert id="insertScBreedPlanGenerate" parameterType="ScBreedPlanGenerate" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_breed_plan_generate
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="planName != null">plan_name,</if>
|
||||
<if test="planType != null">plan_type,</if>
|
||||
<if test="planDate != null">plan_date,</if>
|
||||
<if test="totalEweCount != null">total_ewe_count,</if>
|
||||
<if test="totalRamCount != null">total_ram_count,</if>
|
||||
<if test="breedRatio != null">breed_ratio,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="approver != null">approver,</if>
|
||||
<if test="approveTime != null">approve_time,</if>
|
||||
<if test="approveRemark != null">approve_remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="planName != null">#{planName},</if>
|
||||
<if test="planType != null">#{planType},</if>
|
||||
<if test="planDate != null">#{planDate},</if>
|
||||
<if test="totalEweCount != null">#{totalEweCount},</if>
|
||||
<if test="totalRamCount != null">#{totalRamCount},</if>
|
||||
<if test="breedRatio != null">#{breedRatio},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="approver != null">#{approver},</if>
|
||||
<if test="approveTime != null">#{approveTime},</if>
|
||||
<if test="approveRemark != null">#{approveRemark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 插入临时配种计划 -->
|
||||
<insert id="insertTempBreedPlan">
|
||||
insert into sc_breed_plan_temp (plan_generate_id, ram_id, ewe_id, breed_type, create_time)
|
||||
values (#{planGenerateId}, #{breedPlan.ramId}, #{breedPlan.eweId}, #{breedPlan.breedType}, now())
|
||||
</insert>
|
||||
|
||||
<update id="updateScBreedPlanGenerate" parameterType="ScBreedPlanGenerate">
|
||||
update sc_breed_plan_generate
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="planName != null">plan_name = #{planName},</if>
|
||||
<if test="planType != null">plan_type = #{planType},</if>
|
||||
<if test="planDate != null">plan_date = #{planDate},</if>
|
||||
<if test="totalEweCount != null">total_ewe_count = #{totalEweCount},</if>
|
||||
<if test="totalRamCount != null">total_ram_count = #{totalRamCount},</if>
|
||||
<if test="breedRatio != null">breed_ratio = #{breedRatio},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="approver != null">approver = #{approver},</if>
|
||||
<if test="approveTime != null">approve_time = #{approveTime},</if>
|
||||
<if test="approveRemark != null">approve_remark = #{approveRemark},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 将临时配种计划转为正式配种计划 -->
|
||||
<insert id="transferTempToFormal">
|
||||
insert into sc_breed_plan (ram_id, ewe_id, breed_type)
|
||||
select ram_id, ewe_id, breed_type
|
||||
from sc_breed_plan_temp
|
||||
where plan_generate_id = #{planGenerateId}
|
||||
</insert>
|
||||
|
||||
<!-- 获取配种计划详情 -->
|
||||
<select id="selectBreedPlanDetails" parameterType="Long" resultType="Map">
|
||||
select
|
||||
temp.id,
|
||||
temp.ram_id,
|
||||
temp.ewe_id,
|
||||
temp.breed_type,
|
||||
ram.bs_manage_tags as ram_manage_tags,
|
||||
ram.variety as ram_variety,
|
||||
ewe.bs_manage_tags as ewe_manage_tags,
|
||||
ewe.variety as ewe_variety,
|
||||
ewe.current_weight as ewe_weight
|
||||
from sc_breed_plan_temp temp
|
||||
left join sheep_file ram on temp.ram_id = ram.id
|
||||
left join sheep_file ewe on temp.ewe_id = ewe.id
|
||||
where temp.plan_generate_id = #{planGenerateId}
|
||||
order by temp.ram_id, temp.ewe_id
|
||||
</select>
|
||||
|
||||
<delete id="deleteScBreedPlanGenerateById" parameterType="Long">
|
||||
delete from sc_breed_plan_generate where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScBreedPlanGenerateByIds" parameterType="String">
|
||||
delete from sc_breed_plan_generate where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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.breed.mapper.ScBreedPlanMapper">
|
||||
|
||||
<resultMap type="ScBreedPlan" id="ScBreedPlanResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ramId" column="ram_id" />
|
||||
<result property="eweId" column="ewe_id" />
|
||||
<result property="breedType" column="breed_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBreedPlanVo">
|
||||
select id, ram_id, ewe_id, breed_type from sc_breed_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreedPlanList" parameterType="ScBreedPlan" resultMap="ScBreedPlanResult">
|
||||
<include refid="selectScBreedPlanVo"/>
|
||||
<where>
|
||||
<if test="ramId != null and ramId != ''"> and ram_id = #{ramId}</if>
|
||||
<if test="eweId != null and eweId != ''"> and ewe_id = #{eweId}</if>
|
||||
<if test="breedType != null "> and breed_type = #{breedType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScBreedPlanById" parameterType="Long" resultMap="ScBreedPlanResult">
|
||||
<include refid="selectScBreedPlanVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScBreedPlan" parameterType="ScBreedPlan" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_breed_plan
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ramId != null">ram_id,</if>
|
||||
<if test="eweId != null">ewe_id,</if>
|
||||
<if test="breedType != null">breed_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ramId != null">#{ramId},</if>
|
||||
<if test="eweId != null">#{eweId},</if>
|
||||
<if test="breedType != null">#{breedType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScBreedPlan" parameterType="ScBreedPlan">
|
||||
update sc_breed_plan
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ramId != null">ram_id = #{ramId},</if>
|
||||
<if test="eweId != null">ewe_id = #{eweId},</if>
|
||||
<if test="breedType != null">breed_type = #{breedType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScBreedPlanById" parameterType="Long">
|
||||
delete from sc_breed_plan where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScBreedPlanByIds" parameterType="String">
|
||||
delete from sc_breed_plan where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,108 @@
|
||||
<?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.breed.mapper.ScDryMilkMapper">
|
||||
|
||||
<resultMap type="ScDryMilk" id="ScDryMilkResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="status" column="status" />
|
||||
<result property="sheepfold" column="sheepfold" />
|
||||
<result property="tecahnician" column="tecahnician" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="comment" column="comment" />
|
||||
<!-- 联表查询字段 -->
|
||||
<result property="manageTags" column="bs_manage_tags" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepfoldName" column="sheepfold_name" />
|
||||
<result property="eventType" column="event_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScDryMilkVo">
|
||||
select d.id, d.sheep_id, d.datetime, d.status, d.sheepfold, d.tecahnician,
|
||||
d.create_by, d.create_time, d.comment,
|
||||
s.bs_manage_tags, s.variety, s.sheepfold_name,
|
||||
'干奶' as event_type
|
||||
from sc_dry_milk d
|
||||
left join sheep_file s on d.sheep_id = s.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScDryMilkList" parameterType="ScDryMilk" resultMap="ScDryMilkResult">
|
||||
<include refid="selectScDryMilkVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null and sheepId != ''"> and d.sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''"> and s.bs_manage_tags like concat('%', #{manageTags}, '%')</if>
|
||||
<if test="datetime != null "> and d.datetime = #{datetime}</if>
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
<if test="sheepfold != null "> and d.sheepfold = #{sheepfold}</if>
|
||||
<if test="tecahnician != null and tecahnician != ''"> and d.tecahnician like concat('%', #{tecahnician}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and d.create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and d.create_time = #{createTime}</if>
|
||||
<if test="variety != null and variety != ''"> and s.variety like concat('%', #{variety}, '%')</if>
|
||||
</where>
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectScDryMilkById" parameterType="Long" resultMap="ScDryMilkResult">
|
||||
<include refid="selectScDryMilkVo"/>
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据耳号查询羊只ID -->
|
||||
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||
select id from sheep_file where bs_manage_tags = #{manageTags}
|
||||
</select>
|
||||
|
||||
<insert id="insertScDryMilk" parameterType="ScDryMilk" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_dry_milk
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="sheepfold != null">sheepfold,</if>
|
||||
<if test="tecahnician != null">tecahnician,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="sheepfold != null">#{sheepfold},</if>
|
||||
<if test="tecahnician != null">#{tecahnician},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScDryMilk" parameterType="ScDryMilk">
|
||||
update sc_dry_milk
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="datetime != null">datetime = #{datetime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
|
||||
<if test="tecahnician != null">tecahnician = #{tecahnician},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScDryMilkById" parameterType="Long">
|
||||
delete from sc_dry_milk where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScDryMilkByIds" parameterType="String">
|
||||
delete from sc_dry_milk where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,256 @@
|
||||
<?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.breed.mapper.ScLambDetailMapper">
|
||||
|
||||
<!-- 羔羊详情结果映射 -->
|
||||
<resultMap type="ScLambDetail" id="ScLambDetailResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="lambingRecordId" column="lambing_record_id" />
|
||||
<result property="lambEarNumber" column="lamb_ear_number" />
|
||||
<result property="lambBreed" column="lamb_breed" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="birthWeight" column="birth_weight" />
|
||||
<result property="isRetained" column="is_retained" />
|
||||
<result property="lineage" column="lineage" />
|
||||
<result property="birthday" column="birthday" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础查询SQL -->
|
||||
<sql id="selectScLambDetailVo">
|
||||
select id, lambing_record_id, lamb_ear_number, lamb_breed, gender, birth_weight,
|
||||
is_retained, lineage, birthday, create_by, create_time, update_by, update_time
|
||||
from sc_lamb_detail
|
||||
</sql>
|
||||
|
||||
<!-- 查询羔羊详情列表 -->
|
||||
<select id="selectScLambDetailList" parameterType="ScLambDetail" resultMap="ScLambDetailResult">
|
||||
<include refid="selectScLambDetailVo"/>
|
||||
<where>
|
||||
<if test="lambingRecordId != null"> and lambing_record_id = #{lambingRecordId}</if>
|
||||
<if test="lambEarNumber != null and lambEarNumber != ''"> and lamb_ear_number like concat('%', #{lambEarNumber}, '%')</if>
|
||||
<if test="lambBreed != null"> and lamb_breed = #{lambBreed}</if>
|
||||
<if test="gender != null"> and gender = #{gender}</if>
|
||||
<if test="isRetained != null"> and is_retained = #{isRetained}</if>
|
||||
<if test="lineage != null and lineage != ''"> and lineage like concat('%', #{lineage}, '%')</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 查询羔羊详情 -->
|
||||
<select id="selectScLambDetailById" parameterType="Long" resultMap="ScLambDetailResult">
|
||||
<include refid="selectScLambDetailVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据产羔记录ID查询羔羊详情列表 -->
|
||||
<select id="selectScLambDetailByLambingRecordId" parameterType="Long" resultMap="ScLambDetailResult">
|
||||
<include refid="selectScLambDetailVo"/>
|
||||
where lambing_record_id = #{lambingRecordId}
|
||||
order by create_time asc
|
||||
</select>
|
||||
|
||||
<!-- 检查羔羊耳号是否已存在 -->
|
||||
<select id="checkLambEarNumberExists" resultType="int">
|
||||
select count(*) from sc_lamb_detail
|
||||
where lamb_ear_number = #{lambEarNumber}
|
||||
<if test="excludeId != null">
|
||||
and id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 新增羔羊详情(同步录入到bas_sheep表) -->
|
||||
<insert id="insertScLambDetail" parameterType="ScLambDetail" useGeneratedKeys="true" keyProperty="id">
|
||||
<!-- 插入到sc_lamb_detail表 -->
|
||||
insert into sc_lamb_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="lambingRecordId != null">lambing_record_id,</if>
|
||||
<if test="lambEarNumber != null and lambEarNumber != ''">lamb_ear_number,</if>
|
||||
<if test="lambBreed != null">lamb_breed,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="birthWeight != null">birth_weight,</if>
|
||||
<if test="isRetained != null">is_retained,</if>
|
||||
<if test="lineage != null">lineage,</if>
|
||||
<if test="birthday != null">birthday,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="lambingRecordId != null">#{lambingRecordId},</if>
|
||||
<if test="lambEarNumber != null and lambEarNumber != ''">#{lambEarNumber},</if>
|
||||
<if test="lambBreed != null">#{lambBreed},</if>
|
||||
<if test="gender != null ">#{gender},</if>
|
||||
<if test="birthWeight != null">#{birthWeight},</if>
|
||||
<if test="isRetained != null">#{isRetained},</if>
|
||||
<if test="lineage != null">#{lineage},</if>
|
||||
<if test="birthday != null">#{birthday},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 同步插入到bas_sheep表 -->
|
||||
<insert id="insertBasSheep" parameterType="ScLambDetail">
|
||||
insert into bas_sheep
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="lambEarNumber != null and lambEarNumber != ''">manage_tags,</if>
|
||||
<if test="lambBreed != null">variety_id,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="birthday != null">birthday,</if>
|
||||
<if test="birthWeight != null">birth_weight,</if>
|
||||
<if test="lineage != null">family,</if>
|
||||
<if test="motherId != null">mother_id,</if>
|
||||
<if test="fatherId != null">father_id,</if>
|
||||
<if test="ranchId != null">ranch_id,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="isRetained != null">status_id,</if>
|
||||
type_id,
|
||||
breed_status_id,
|
||||
is_delete,
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="lambEarNumber != null and lambEarNumber != ''">#{lambEarNumber},</if>
|
||||
<if test="lambBreed != null">#{lambBreed},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
<if test="birthday != null">#{birthday},</if>
|
||||
<if test="birthWeight != null">#{birthWeight},</if>
|
||||
<if test="lineage != null">#{lineage},</if>
|
||||
<if test="motherId != null">#{motherId},</if>
|
||||
<if test="fatherId != null">#{fatherId},</if>
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="isRetained != null">#{isRetained},</if>
|
||||
3, <!-- type_id: 3表示羔羊 -->
|
||||
1, <!-- breed_status_id: 1表示初始繁育状态 -->
|
||||
0, <!-- is_delete: 0表示未删除 -->
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 批量新增羔羊详情(同步录入到bas_sheep表) -->
|
||||
<insert id="insertScLambDetailBatch" parameterType="java.util.List">
|
||||
<!-- 批量插入到sc_lamb_detail表 -->
|
||||
insert into sc_lamb_detail (lambing_record_id, lamb_ear_number, lamb_breed, gender, birth_weight,
|
||||
is_retained, lineage, birthday, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.lambingRecordId}, #{item.lambEarNumber}, #{item.lambBreed}, #{item.gender},
|
||||
#{item.birthWeight}, #{item.isRetained}, #{item.lineage}, #{item.birthday},
|
||||
#{item.createBy}, #{item.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量同步插入到bas_sheep表 -->
|
||||
<insert id="insertBasSheepBatch" parameterType="java.util.List">
|
||||
insert into bas_sheep (manage_tags, variety_id, gender, birthday, birth_weight, family,
|
||||
mother_id, father_id, ranch_id, sheepfold_id, parity, status_id, type_id, breed_status_id, is_delete, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.lambEarNumber}, #{item.lambBreed}, #{item.gender}, #{item.birthday},
|
||||
#{item.birthWeight}, #{item.lineage}, #{item.motherId}, #{item.fatherId},
|
||||
#{item.ranchId}, #{item.sheepfoldId}, #{item.parity}, #{item.isRetained},
|
||||
3, 1, 0, #{item.createBy}, #{item.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 修改羔羊详情(同步更新bas_sheep表) -->
|
||||
<update id="updateScLambDetail" parameterType="ScLambDetail">
|
||||
update sc_lamb_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="lambingRecordId != null">lambing_record_id = #{lambingRecordId},</if>
|
||||
<if test="lambEarNumber != null and lambEarNumber != ''">lamb_ear_number = #{lambEarNumber},</if>
|
||||
<if test="lambBreed != null">lamb_breed = #{lambBreed},</if>
|
||||
<if test="gender != null">gender = #{gender},</if>
|
||||
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
|
||||
<if test="isRetained != null">is_retained = #{isRetained},</if>
|
||||
<if test="lineage != null">lineage = #{lineage},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 同步更新bas_sheep表 -->
|
||||
<update id="updateBasSheep" parameterType="ScLambDetail">
|
||||
update bas_sheep
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="lambEarNumber != null and lambEarNumber != ''">manage_tags = #{lambEarNumber},</if>
|
||||
<if test="lambBreed != null">variety_id = #{lambBreed},</if>
|
||||
<if test="gender != null ">gender = #{gender},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
|
||||
<if test="lineage != null">family = #{lineage},</if>
|
||||
<if test="isRetained != null">status_id = #{isRetained},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where manage_tags = #{lambEarNumber} and is_delete = 0
|
||||
</update>
|
||||
|
||||
<!-- 删除羔羊详情(同步删除bas_sheep表) -->
|
||||
<delete id="deleteScLambDetailById" parameterType="Long">
|
||||
delete from sc_lamb_detail where id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 同步删除bas_sheep表中的羔羊记录 -->
|
||||
<update id="deleteBasSheepByEarNumber" parameterType="String">
|
||||
update bas_sheep set is_delete = 1 where manage_tags = #{lambEarNumber}
|
||||
</update>
|
||||
|
||||
<!-- 批量删除羔羊详情(同步删除bas_sheep表) -->
|
||||
<delete id="deleteScLambDetailByIds" parameterType="String">
|
||||
delete from sc_lamb_detail where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 批量同步删除bas_sheep表中的羔羊记录 -->
|
||||
<update id="deleteBasSheepByEarNumbers" parameterType="String">
|
||||
update bas_sheep set is_delete = 1 where manage_tags in
|
||||
<foreach item="earNumber" collection="array" open="(" separator="," close=")">
|
||||
#{earNumber}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 根据产羔记录ID删除羔羊详情(同步删除bas_sheep表) -->
|
||||
<delete id="deleteScLambDetailByLambingRecordId" parameterType="Long">
|
||||
delete from sc_lamb_detail where lambing_record_id = #{lambingRecordId}
|
||||
</delete>
|
||||
|
||||
<!-- 同步删除bas_sheep表中对应产羔记录的羔羊 -->
|
||||
<update id="deleteBasSheepByLambingRecordId" parameterType="Long">
|
||||
update bas_sheep set is_delete = 1
|
||||
where manage_tags in (
|
||||
select lamb_ear_number from sc_lamb_detail
|
||||
where lambing_record_id = #{lambingRecordId}
|
||||
)
|
||||
</update>
|
||||
|
||||
<!-- 根据产羔记录获取母羊和父羊信息 -->
|
||||
<select id="getParentInfoByLambingRecordId" parameterType="Long" resultType="java.util.Map">
|
||||
SELECT
|
||||
lr.sheep_id as motherId,
|
||||
mother.ranch_id as ranchId,
|
||||
mother.sheepfold_id as sheepfoldId,
|
||||
mother.parity as parity,
|
||||
father.id as fatherId
|
||||
FROM sc_lambing_record lr
|
||||
LEFT JOIN bas_sheep mother ON lr.sheep_id = mother.id
|
||||
LEFT JOIN sc_breed_record br ON lr.sheep_id = br.ewe_id AND lr.parity = mother.parity
|
||||
LEFT JOIN bas_sheep father ON br.ram_id = father.id
|
||||
WHERE lr.id = #{lambingRecordId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,212 @@
|
||||
<?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.breed.mapper.ScLambingRecordMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<resultMap type="ScLambingRecord" id="ScLambingRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="lambsBorn" column="lambs_born" />
|
||||
<result property="survival" column="survival" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="score" column="score" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_tme" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 详细结果映射(包含关联信息) -->
|
||||
<resultMap type="ScLambingRecord" id="ScLambingRecordDetailResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="lambsBorn" column="lambs_born" />
|
||||
<result property="survival" column="survival" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="score" column="score" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_tme" />
|
||||
|
||||
<!-- 母羊信息 -->
|
||||
<result property="femaleEarNumber" column="female_ear_number" />
|
||||
<result property="femaleBreed" column="female_breed" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="currentShed" column="current_shed" />
|
||||
<result property="farm" column="farm" />
|
||||
|
||||
<!-- 公羊信息 -->
|
||||
<result property="maleEarNumber" column="male_ear_number" />
|
||||
<result property="maleBreed" column="male_breed" />
|
||||
|
||||
<!-- 配种信息 -->
|
||||
<result property="breedingDate" column="breeding_date" />
|
||||
<result property="pregnancyDays" column="pregnancy_days" />
|
||||
|
||||
<!-- 统计信息 -->
|
||||
<result property="maleCount" column="male_count" />
|
||||
<result property="femaleCount" column="female_count" />
|
||||
<result property="retainedMaleCount" column="retained_male_count" />
|
||||
<result property="retainedFemaleCount" column="retained_female_count" />
|
||||
<result property="unretainedMaleCount" column="unretained_male_count" />
|
||||
<result property="unretainedFemaleCount" column="unretained_female_count" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础查询SQL -->
|
||||
<sql id="selectScLambingRecordVo">
|
||||
select id, sheep_id, parity, lambs_born, survival, technician, score, comment, create_by, create_tme from sc_lambing_record
|
||||
</sql>
|
||||
|
||||
<!-- 详细查询SQL(包含关联信息) -->
|
||||
<sql id="selectScLambingRecordDetailVo">
|
||||
SELECT
|
||||
lr.id, lr.sheep_id, lr.parity, lr.lambs_born, lr.survival,
|
||||
lr.technician, lr.score, lr.comment, lr.create_by, lr.create_tme,
|
||||
|
||||
-- 从bas_sheep表获取母羊信息
|
||||
mother.manage_tags as female_ear_number,
|
||||
mother.variety_id as female_breed,
|
||||
TIMESTAMPDIFF(MONTH, mother.birthday, NOW()) as month_age,
|
||||
mother.sheepfold_id as current_shed,
|
||||
mother.ranch_id as farm,
|
||||
|
||||
-- 从sc_breed_record表获取配种信息
|
||||
br.create_time as breeding_date,
|
||||
DATEDIFF(lr.create_tme, br.create_time) as pregnancy_days,
|
||||
|
||||
-- 从bas_sheep表获取公羊信息
|
||||
father.manage_tags as male_ear_number,
|
||||
father.variety_id as male_breed,
|
||||
|
||||
-- 统计羔羊信息(从bas_sheep表统计,根据母羊ID)
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 1 AND lamb.is_delete = 0) as male_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 0 AND lamb.is_delete = 0) as female_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 1 AND lamb.status_id = 1 AND lamb.is_delete = 0) as retained_male_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 0 AND lamb.status_id = 1 AND lamb.is_delete = 0) as retained_female_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 1 AND lamb.status_id != 1 AND lamb.is_delete = 0) as unretained_male_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 0 AND lamb.status_id != 1 AND lamb.is_delete = 0) as unretained_female_count
|
||||
|
||||
FROM sc_lambing_record lr
|
||||
LEFT JOIN bas_sheep mother ON lr.sheep_id = mother.id
|
||||
LEFT JOIN sc_breed_record br ON lr.sheep_id = br.ewe_id AND lr.parity = mother.parity
|
||||
LEFT JOIN bas_sheep father ON br.ram_id = father.id
|
||||
</sql>
|
||||
|
||||
<!-- 查询产羔记录列表(包含关联信息) -->
|
||||
<select id="selectScLambingRecordList" parameterType="ScLambingRecord" resultMap="ScLambingRecordDetailResult">
|
||||
<include refid="selectScLambingRecordDetailVo"/>
|
||||
<where>
|
||||
<if test="femaleEarNumber != null and femaleEarNumber != ''"> and mother.manage_tags LIKE CONCAT('%', #{femaleEarNumber}, '%')</if>
|
||||
<if test="femaleBreed != null and femaleBreed != ''"> and mother.variety_id = #{femaleBreed}</if>
|
||||
<if test="farm != null and farm != ''"> and mother.ranch_id = #{farm}</if>
|
||||
<if test="sheepId != null and sheepId != ''"> and lr.sheep_id = #{sheepId}</if>
|
||||
<if test="parity != null"> and lr.parity = #{parity}</if>
|
||||
<if test="lambsBorn != null"> and lr.lambs_born = #{lambsBorn}</if>
|
||||
<if test="survival != null"> and lr.survival = #{survival}</if>
|
||||
<if test="technician != null and technician != ''"> and lr.technician LIKE CONCAT('%', #{technician}, '%')</if>
|
||||
<if test="score != null"> and lr.score = #{score}</if>
|
||||
<if test="comment != null and comment != ''"> and lr.comment LIKE CONCAT('%', #{comment}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and lr.create_by = #{createBy}</if>
|
||||
<if test="createTime != null"> and DATE(lr.create_tme) = #{createTime}</if>
|
||||
<if test="params.beginBreedingDate != null and params.beginBreedingDate != ''"><!-- 配种日期开始 -->
|
||||
and DATE(br.create_time) >= #{params.beginBreedingDate}
|
||||
</if>
|
||||
<if test="params.endBreedingDate != null and params.endBreedingDate != ''"><!-- 配种日期结束 -->
|
||||
and DATE(br.create_time) <= #{params.endBreedingDate}
|
||||
</if>
|
||||
and mother.is_delete = 0
|
||||
</where>
|
||||
ORDER BY lr.create_tme DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询产羔记录基础信息 -->
|
||||
<select id="selectScLambingRecordById" parameterType="Long" resultMap="ScLambingRecordResult">
|
||||
<include refid="selectScLambingRecordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 查询产羔记录详细信息(包含关联信息) -->
|
||||
<select id="selectScLambingRecordDetailById" parameterType="Long" resultMap="ScLambingRecordDetailResult">
|
||||
<include refid="selectScLambingRecordDetailVo"/>
|
||||
where lr.id = #{id} and mother.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 查询羔羊详情(从sc_lamb_detail表查询) -->
|
||||
<select id="selectLambDetailByLambingRecordId" parameterType="Long" resultType="ScLambDetail">
|
||||
SELECT
|
||||
id,
|
||||
lambing_record_id as lambingRecordId,
|
||||
lamb_ear_number as lambEarNumber,
|
||||
lamb_breed as lambBreed,
|
||||
gender,
|
||||
birth_weight as birthWeight,
|
||||
is_retained as isRetained,
|
||||
lineage,
|
||||
birthday,
|
||||
create_by as createBy,
|
||||
create_time as createTime
|
||||
FROM sc_lamb_detail
|
||||
WHERE lambing_record_id = #{lambingRecordId}
|
||||
ORDER BY create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 新增产羔记录 -->
|
||||
<insert id="insertScLambingRecord" parameterType="ScLambingRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_lambing_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="lambsBorn != null">lambs_born,</if>
|
||||
<if test="survival != null">survival,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="score != null">score,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_tme,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="lambsBorn != null">#{lambsBorn},</if>
|
||||
<if test="survival != null">#{survival},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="score != null">#{score},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 修改产羔记录 -->
|
||||
<update id="updateScLambingRecord" parameterType="ScLambingRecord">
|
||||
update sc_lambing_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="lambsBorn != null">lambs_born = #{lambsBorn},</if>
|
||||
<if test="survival != null">survival = #{survival},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="score != null">score = #{score},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_tme = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除产羔记录 -->
|
||||
<delete id="deleteScLambingRecordById" parameterType="Long">
|
||||
delete from sc_lambing_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量删除产羔记录 -->
|
||||
<delete id="deleteScLambingRecordByIds" parameterType="String">
|
||||
delete from sc_lambing_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,145 @@
|
||||
<?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.breed.mapper.ScWeanRecordMapper">
|
||||
|
||||
<resultMap type="ScWeanRecord" id="ScWeanRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="weight" column="weight" />
|
||||
<result property="status" column="status" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="electronicTags" column="electronic_tags" />
|
||||
<!-- 关联查询的字段 -->
|
||||
<result property="earNumber" column="bs_manage_tags" />
|
||||
<result property="breed" column="variety" />
|
||||
<result property="eventType" column="event_type" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="fatherNumber" column="father_manage_tags" />
|
||||
<result property="motherNumber" column="mother_manage_tags" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="birthWeight" column="birth_weight" />
|
||||
<result property="sheepPen" column="sheepfold_name" />
|
||||
<result property="breedingStatus" column="breed" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 带关联查询的基础SQL -->
|
||||
<sql id="selectScWeanRecordVo">
|
||||
select
|
||||
wr.id, wr.sheep_id, wr.datetime, wr.weight, wr.status, wr.technician,
|
||||
wr.comment, wr.create_by, wr.create_time, wr.electronic_tags,
|
||||
sf.bs_manage_tags, sf.variety, sf.gender, sf.father_manage_tags, sf.mother_manage_tags,
|
||||
sf.birth_weight, sf.sheepfold_name, sf.breed, sf.month_age,
|
||||
'断奶' as event_type
|
||||
from sc_wean_record wr
|
||||
left join sheep_file sf on wr.sheep_id = sf.id
|
||||
</sql>
|
||||
|
||||
<!-- 查询断奶记录列表 -->
|
||||
<select id="selectScWeanRecordList" parameterType="ScWeanRecord" resultMap="ScWeanRecordResult">
|
||||
<include refid="selectScWeanRecordVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null "> and wr.sheep_id = #{sheepId}</if>
|
||||
<if test="earNumber != null and earNumber != ''"> and sf.bs_manage_tags like concat('%', #{earNumber}, '%')</if>
|
||||
<if test="datetime != null "> and wr.datetime = #{datetime}</if>
|
||||
<if test="weight != null "> and wr.weight = #{weight}</if>
|
||||
<if test="status != null "> and wr.status = #{status}</if>
|
||||
<if test="technician != null and technician != ''"> and wr.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="comment != null and comment != ''"> and wr.comment like concat('%', #{comment}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and wr.create_by like concat('%', #{createBy}, '%')</if>
|
||||
<if test="createTime != null "> and wr.create_time = #{createTime}</if>
|
||||
<if test="electronicTags != null and electronicTags != ''"> and wr.electronic_tags like concat('%', #{electronicTags}, '%')</if>
|
||||
<if test="breed != null and breed != ''"> and sf.variety like concat('%', #{breed}, '%')</if>
|
||||
<if test="gender != null and gender != ''"> and sf.gender = #{gender}</if>
|
||||
<if test="fatherNumber != null and fatherNumber != ''"> and sf.father_manage_tags like concat('%', #{fatherNumber}, '%')</if>
|
||||
<if test="motherNumber != null and motherNumber != ''"> and sf.mother_manage_tags like concat('%', #{motherNumber}, '%')</if>
|
||||
<if test="sheepPen != null and sheepPen != ''"> and sf.sheepfold_name like concat('%', #{sheepPen}, '%')</if>
|
||||
<if test="breedingStatus != null and breedingStatus != ''"> and sf.breed = #{breedingStatus}</if>
|
||||
</where>
|
||||
order by wr.create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 根据ID查询断奶记录 -->
|
||||
<select id="selectScWeanRecordById" parameterType="Long" resultMap="ScWeanRecordResult">
|
||||
<include refid="selectScWeanRecordVo"/>
|
||||
where wr.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据耳号查询羊只ID -->
|
||||
<select id="selectSheepIdByEarNumber" parameterType="String" resultType="Long">
|
||||
select id from sheep_file where bs_manage_tags = #{earNumber}
|
||||
</select>
|
||||
|
||||
<!-- 插入断奶记录 -->
|
||||
<insert id="insertScWeanRecord" parameterType="ScWeanRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_wean_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="weight != null">weight,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="electronicTags != null">electronic_tags,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="weight != null">#{weight},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="electronicTags != null">#{electronicTags},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 更新断奶记录 -->
|
||||
<update id="updateScWeanRecord" parameterType="ScWeanRecord">
|
||||
update sc_wean_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="datetime != null">datetime = #{datetime},</if>
|
||||
<if test="weight != null">weight = #{weight},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据耳号更新bas_sheep表中的断奶信息 -->
|
||||
<update id="updateBasSheepWeaningInfo" parameterType="ScWeanRecord">
|
||||
update bas_sheep
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="datetime != null">weaning_date = #{datetime},</if>
|
||||
<if test="weight != null">weaning_weight = #{weight},</if>
|
||||
<if test="electronicTags != null and electronicTags != ''">electronic_tags = #{electronicTags},</if>
|
||||
</trim>
|
||||
where manage_tags = #{earNumber}
|
||||
</update>
|
||||
|
||||
<!-- 删除断奶记录 -->
|
||||
<delete id="deleteScWeanRecordById" parameterType="Long">
|
||||
delete from sc_wean_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量删除断奶记录 -->
|
||||
<delete id="deleteScWeanRecordByIds" parameterType="String">
|
||||
delete from sc_wean_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -3,10 +3,10 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper">
|
||||
|
||||
<!-- 1. 结果映射:包含羊舍名称、品种名称 -->
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep" id="ScAddSheepResult">
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScAddSheep" id="ScAddSheepResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="earNumber" column="ear_number"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
@@ -2,7 +2,7 @@
|
||||
<!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.trans_group.mapper.ScTransGroupMapper">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransGroupMapper">
|
||||
|
||||
<resultMap type="ScTransGroup" id="ScTransGroupResult">
|
||||
<result property="id" column="id"/>
|
||||
@@ -2,7 +2,7 @@
|
||||
<!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.transition_info.mapper.ScTransitionInfoMapper">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransitionInfoMapper">
|
||||
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.other.castrate.mapper.ScCastrateMapper">
|
||||
<mapper namespace="com.zhyc.module.produce.other.mapper.ScCastrateMapper">
|
||||
|
||||
<resultMap type="ScCastrate" id="ScCastrateResult">
|
||||
<result property="id" column="id"/>
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper">
|
||||
<mapper namespace="com.zhyc.module.produce.other.mapper.ScFixHoofMapper">
|
||||
|
||||
<resultMap type="ScFixHoof" id="ScFixHoofResult">
|
||||
<result property="id" column="id"/>
|
||||
@@ -1,259 +0,0 @@
|
||||
<?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.sheep.mapper.BasSheepMapper">
|
||||
|
||||
<resultMap type="BasSheep" id="BasSheepResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="manageTags" column="manage_tags" />
|
||||
<result property="ranchId" column="ranch_id" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="electronicTags" column="electronic_tags" />
|
||||
<result property="varietyId" column="variety_id" />
|
||||
<result property="family" column="family" />
|
||||
<result property="typeId" column="type_id" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="birthday" column="birthday" />
|
||||
<result property="birthWeight" column="birth_weight" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="statusId" column="status_id" />
|
||||
<result property="weaningDate" column="weaning_date" />
|
||||
<result property="weaningWeight" column="weaning_weight" />
|
||||
<result property="breedStatusId" column="breed_status_id" />
|
||||
<result property="fatherId" column="father_id" />
|
||||
<result property="motherId" column="mother_id" />
|
||||
<result property="receptorId" column="receptor_id" />
|
||||
<result property="matingDate" column="mating_date" />
|
||||
<result property="matingTypeId" column="mating_type_id" />
|
||||
<result property="pregDate" column="preg_date" />
|
||||
<result property="lambingDate" column="lambing_date" />
|
||||
<result property="lambingDay" column="lambing_day" />
|
||||
<result property="expectedDate" column="expected_date" />
|
||||
<result property="controlled" column="controlled" />
|
||||
<result property="matingCounts" column="mating_counts" />
|
||||
<result property="matingTotal" column="mating_total" />
|
||||
<result property="miscarriageCounts" column="miscarriage_counts" />
|
||||
<result property="body" column="body" />
|
||||
<result property="breast" column="breast" />
|
||||
<result property="source" column="source" />
|
||||
<result property="sourceDate" column="source_date" />
|
||||
<result property="sourceRanchId" column="source_ranch_id" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasSheepVo">
|
||||
select id, manage_tags, ranch_id, sheepfold_id, electronic_tags, variety_id, family, type_id, gender, birthday, birth_weight, parity, status_id, weaning_date, weaning_weight, breed_status_id, father_id, mother_id, receptor_id, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, expected_date, controlled, mating_counts, mating_total, miscarriage_counts, body, breast, source, source_date, source_ranch_id, comment, update_by, update_time, create_by, create_time, is_delete from bas_sheep
|
||||
</sql>
|
||||
|
||||
<select id="selectBasSheepList" parameterType="BasSheep" resultMap="BasSheepResult">
|
||||
<include refid="selectBasSheepVo"/>
|
||||
<where>
|
||||
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
|
||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
|
||||
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
||||
<if test="family != null and family != ''"> and family = #{family}</if>
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
<if test="gender != null "> and gender = #{gender}</if>
|
||||
<if test="birthday != null "> and birthday = #{birthday}</if>
|
||||
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
|
||||
<if test="parity != null "> and parity = #{parity}</if>
|
||||
<if test="statusId != null "> and status_id = #{statusId}</if>
|
||||
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
|
||||
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
|
||||
<if test="breedStatusId != null "> and breed_status_id = #{breedStatusId}</if>
|
||||
<if test="fatherId != null "> and father_id = #{fatherId}</if>
|
||||
<if test="motherId != null "> and mother_id = #{motherId}</if>
|
||||
<if test="receptorId != null "> and receptor_id = #{receptorId}</if>
|
||||
<if test="matingDate != null "> and mating_date = #{matingDate}</if>
|
||||
<if test="matingTypeId != null "> and mating_type_id = #{matingTypeId}</if>
|
||||
<if test="pregDate != null "> and preg_date = #{pregDate}</if>
|
||||
<if test="lambingDate != null "> and lambing_date = #{lambingDate}</if>
|
||||
<if test="lambingDay != null "> and lambing_day = #{lambingDay}</if>
|
||||
<if test="expectedDate != null "> and expected_date = #{expectedDate}</if>
|
||||
<if test="controlled != null "> and controlled = #{controlled}</if>
|
||||
<if test="matingCounts != null "> and mating_counts = #{matingCounts}</if>
|
||||
<if test="matingTotal != null "> and mating_total = #{matingTotal}</if>
|
||||
<if test="miscarriageCounts != null "> and miscarriage_counts = #{miscarriageCounts}</if>
|
||||
<if test="body != null "> and body = #{body}</if>
|
||||
<if test="breast != null "> and breast = #{breast}</if>
|
||||
<if test="source != null and source != ''"> and source = #{source}</if>
|
||||
<if test="sourceDate != null "> and source_date = #{sourceDate}</if>
|
||||
<if test="sourceRanchId != null "> and source_ranch_id = #{sourceRanchId}</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
|
||||
SELECT s.id,
|
||||
s.sheepfold_id AS sheepfoldId,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
s.variety_id AS varietyId,
|
||||
bv.variety AS varietyName
|
||||
FROM bas_sheep s
|
||||
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
|
||||
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
||||
WHERE s.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepByManageTags" parameterType="string" resultType="com.zhyc.module.produce.sheep.domain.BasSheep">
|
||||
SELECT id, sheepfold_id AS sheepfoldId, variety_id AS varietyId
|
||||
FROM bas_sheep
|
||||
WHERE LOWER(TRIM(manage_tags)) = LOWER(TRIM(#{manageTags}))
|
||||
AND is_delete = 0
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bas_sheep
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="manageTags != null">manage_tags,</if>
|
||||
<if test="ranchId != null">ranch_id,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="electronicTags != null">electronic_tags,</if>
|
||||
<if test="varietyId != null">variety_id,</if>
|
||||
<if test="family != null">family,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="birthday != null">birthday,</if>
|
||||
<if test="birthWeight != null">birth_weight,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="statusId != null">status_id,</if>
|
||||
<if test="weaningDate != null">weaning_date,</if>
|
||||
<if test="weaningWeight != null">weaning_weight,</if>
|
||||
<if test="breedStatusId != null">breed_status_id,</if>
|
||||
<if test="fatherId != null">father_id,</if>
|
||||
<if test="motherId != null">mother_id,</if>
|
||||
<if test="receptorId != null">receptor_id,</if>
|
||||
<if test="matingDate != null">mating_date,</if>
|
||||
<if test="matingTypeId != null">mating_type_id,</if>
|
||||
<if test="pregDate != null">preg_date,</if>
|
||||
<if test="lambingDate != null">lambing_date,</if>
|
||||
<if test="lambingDay != null">lambing_day,</if>
|
||||
<if test="expectedDate != null">expected_date,</if>
|
||||
<if test="controlled != null">controlled,</if>
|
||||
<if test="matingCounts != null">mating_counts,</if>
|
||||
<if test="matingTotal != null">mating_total,</if>
|
||||
<if test="miscarriageCounts != null">miscarriage_counts,</if>
|
||||
<if test="body != null">body,</if>
|
||||
<if test="breast != null">breast,</if>
|
||||
<if test="source != null">source,</if>
|
||||
<if test="sourceDate != null">source_date,</if>
|
||||
<if test="sourceRanchId != null">source_ranch_id,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="manageTags != null">#{manageTags},</if>
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="electronicTags != null">#{electronicTags},</if>
|
||||
<if test="varietyId != null">#{varietyId},</if>
|
||||
<if test="family != null">#{family},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
<if test="birthday != null">#{birthday},</if>
|
||||
<if test="birthWeight != null">#{birthWeight},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="statusId != null">#{statusId},</if>
|
||||
<if test="weaningDate != null">#{weaningDate},</if>
|
||||
<if test="weaningWeight != null">#{weaningWeight},</if>
|
||||
<if test="breedStatusId != null">#{breedStatusId},</if>
|
||||
<if test="fatherId != null">#{fatherId},</if>
|
||||
<if test="motherId != null">#{motherId},</if>
|
||||
<if test="receptorId != null">#{receptorId},</if>
|
||||
<if test="matingDate != null">#{matingDate},</if>
|
||||
<if test="matingTypeId != null">#{matingTypeId},</if>
|
||||
<if test="pregDate != null">#{pregDate},</if>
|
||||
<if test="lambingDate != null">#{lambingDate},</if>
|
||||
<if test="lambingDay != null">#{lambingDay},</if>
|
||||
<if test="expectedDate != null">#{expectedDate},</if>
|
||||
<if test="controlled != null">#{controlled},</if>
|
||||
<if test="matingCounts != null">#{matingCounts},</if>
|
||||
<if test="matingTotal != null">#{matingTotal},</if>
|
||||
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
|
||||
<if test="body != null">#{body},</if>
|
||||
<if test="breast != null">#{breast},</if>
|
||||
<if test="source != null">#{source},</if>
|
||||
<if test="sourceDate != null">#{sourceDate},</if>
|
||||
<if test="sourceRanchId != null">#{sourceRanchId},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasSheep" parameterType="BasSheep">
|
||||
update bas_sheep
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="manageTags != null">manage_tags = #{manageTags},</if>
|
||||
<if test="ranchId != null">ranch_id = #{ranchId},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
|
||||
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
||||
<if test="family != null">family = #{family},</if>
|
||||
<if test="typeId != null">type_id = #{typeId},</if>
|
||||
<if test="gender != null">gender = #{gender},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="statusId != null">status_id = #{statusId},</if>
|
||||
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
|
||||
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
|
||||
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
|
||||
<if test="fatherId != null">father_id = #{fatherId},</if>
|
||||
<if test="motherId != null">mother_id = #{motherId},</if>
|
||||
<if test="receptorId != null">receptor_id = #{receptorId},</if>
|
||||
<if test="matingDate != null">mating_date = #{matingDate},</if>
|
||||
<if test="matingTypeId != null">mating_type_id = #{matingTypeId},</if>
|
||||
<if test="pregDate != null">preg_date = #{pregDate},</if>
|
||||
<if test="lambingDate != null">lambing_date = #{lambingDate},</if>
|
||||
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
|
||||
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
|
||||
<if test="controlled != null">controlled = #{controlled},</if>
|
||||
<if test="matingCounts != null">mating_counts = #{matingCounts},</if>
|
||||
<if test="matingTotal != null">mating_total = #{matingTotal},</if>
|
||||
<if test="miscarriageCounts != null">miscarriage_counts = #{miscarriageCounts},</if>
|
||||
<if test="body != null">body = #{body},</if>
|
||||
<if test="breast != null">breast = #{breast},</if>
|
||||
<if test="source != null">source = #{source},</if>
|
||||
<if test="sourceDate != null">source_date = #{sourceDate},</if>
|
||||
<if test="sourceRanchId != null">source_ranch_id = #{sourceRanchId},</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>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasSheepById" parameterType="Long">
|
||||
delete from bas_sheep where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasSheepByIds" parameterType="String">
|
||||
delete from bas_sheep where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user