Merge remote-tracking branch 'origin/main'

# Conflicts:
#	zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java
#	zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml
This commit is contained in:
wyt
2025-07-18 12:52:26 +08:00
51 changed files with 3460 additions and 356 deletions

View File

@@ -119,6 +119,17 @@
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}

View File

@@ -0,0 +1,125 @@
<?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.dairyProducts.yogurtTest.mapper.NpYogurtInspMapper">
<resultMap type="NpYogurtInsp" id="NpYogurtInspResult">
<result property="id" column="id" />
<result property="source" column="source" />
<result property="datetime" column="datetime" />
<result property="fat" column="fat" />
<result property="protein" column="protein" />
<result property="nonFat" column="non_fat" />
<result property="acidity" column="acidity" />
<result property="bacterialColony1" column="bacterial_colony_1" />
<result property="bacterialClony2" column="bacterial_clony_2" />
<result property="bacterialClony3" column="bacterial_clony_3" />
<result property="bacterialClony4" column="bacterial_clony_4" />
<result property="bacterialClony5" column="bacterial_clony_5" />
<result property="yeast" column="yeast" />
<result property="mould" column="mould" />
<result property="lacto" column="lacto" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectNpYogurtInspVo">
select id, source, datetime, fat, protein, non_fat, acidity, bacterial_colony_1, bacterial_clony_2, bacterial_clony_3, bacterial_clony_4, bacterial_clony_5, yeast, mould, lacto, comment, create_by, create_time from np_yogurt_insp
</sql>
<select id="selectNpYogurtInspList" parameterType="NpYogurtInsp" resultMap="NpYogurtInspResult">
<include refid="selectNpYogurtInspVo"/>
<where>
<if test="source != null and source != ''">
and source like concat('%', #{source}, '%')
</if>
<if test="datetime != null ">
and datetime = #{datetime}
</if>
</where>
</select>
<select id="selectNpYogurtInspById" parameterType="Long" resultMap="NpYogurtInspResult">
<include refid="selectNpYogurtInspVo"/>
where id = #{id}
</select>
<insert id="insertNpYogurtInsp" parameterType="NpYogurtInsp" useGeneratedKeys="true" keyProperty="id">
insert into np_yogurt_insp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="source != null">source,</if>
<if test="datetime != null">datetime,</if>
<if test="fat != null">fat,</if>
<if test="protein != null">protein,</if>
<if test="nonFat != null">non_fat,</if>
<if test="acidity != null">acidity,</if>
<if test="bacterialColony1 != null">bacterial_colony_1,</if>
<if test="bacterialClony2 != null">bacterial_clony_2,</if>
<if test="bacterialClony3 != null">bacterial_clony_3,</if>
<if test="bacterialClony4 != null">bacterial_clony_4,</if>
<if test="bacterialClony5 != null">bacterial_clony_5,</if>
<if test="yeast != null">yeast,</if>
<if test="mould != null">mould,</if>
<if test="lacto != null">lacto,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="source != null">#{source},</if>
<if test="datetime != null">#{datetime},</if>
<if test="fat != null">#{fat},</if>
<if test="protein != null">#{protein},</if>
<if test="nonFat != null">#{nonFat},</if>
<if test="acidity != null">#{acidity},</if>
<if test="bacterialColony1 != null">#{bacterialColony1},</if>
<if test="bacterialClony2 != null">#{bacterialClony2},</if>
<if test="bacterialClony3 != null">#{bacterialClony3},</if>
<if test="bacterialClony4 != null">#{bacterialClony4},</if>
<if test="bacterialClony5 != null">#{bacterialClony5},</if>
<if test="yeast != null">#{yeast},</if>
<if test="mould != null">#{mould},</if>
<if test="lacto != null">#{lacto},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateNpYogurtInsp" parameterType="NpYogurtInsp">
update np_yogurt_insp
<trim prefix="SET" suffixOverrides=",">
<if test="source != null">source = #{source},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="fat != null">fat = #{fat},</if>
<if test="protein != null">protein = #{protein},</if>
<if test="nonFat != null">non_fat = #{nonFat},</if>
<if test="acidity != null">acidity = #{acidity},</if>
<if test="bacterialColony1 != null">bacterial_colony_1 = #{bacterialColony1},</if>
<if test="bacterialClony2 != null">bacterial_clony_2 = #{bacterialClony2},</if>
<if test="bacterialClony3 != null">bacterial_clony_3 = #{bacterialClony3},</if>
<if test="bacterialClony4 != null">bacterial_clony_4 = #{bacterialClony4},</if>
<if test="bacterialClony5 != null">bacterial_clony_5 = #{bacterialClony5},</if>
<if test="yeast != null">yeast = #{yeast},</if>
<if test="mould != null">mould = #{mould},</if>
<if test="lacto != null">lacto = #{lacto},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNpYogurtInspById" parameterType="Long">
delete from np_yogurt_insp where id = #{id}
</delete>
<delete id="deleteNpYogurtInspByIds" parameterType="String">
delete from np_yogurt_insp where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -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.drymilk.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>

View File

@@ -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.mating_plan.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>

View File

@@ -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.mating_plan.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>

View File

@@ -1,45 +1,60 @@
<?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">
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">
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="transTo" column="trans_to" />
<result property="transFrom" column="trans_from" />
<result property="transType" column="trans_type" />
<result property="technician" column="technician" />
<result property="status" column="status" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="varietyId" column="variety_id"/>
<result property="varietyName" column="varietyName"/>
<result property="transTo" column="trans_to"/>
<result property="transFrom" column="trans_from"/>
<result property="transType" column="trans_type"/>
<result property="transTypeText" column="trans_type_text"/>
<result property="technician" column="technician"/>
<result property="status" column="status"/>
<result property="comment" column="comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScTransitionInfoVo">
select id, sheep_id, trans_to, trans_from, trans_type, technician, status, comment, create_by, create_time from sc_transition_info
SELECT t.*, bv.variety AS varietyName,
CASE t.trans_type
WHEN 0 THEN '内部转场'
WHEN 1 THEN '跨场转场'
WHEN 2 THEN '销售转场'
ELSE '未知'
END AS trans_type_text
FROM sc_transition_info t
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
</sql>
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/>
<where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<if test="transTo != null and transTo != ''"> and trans_to = #{transTo}</if>
<if test="transFrom != null and transFrom != ''"> and trans_from = #{transFrom}</if>
<if test="status != null "> and status = #{status}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="varietyId != null">and t.variety_id = #{varietyId}</if>
<if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
<if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
<if test="status != null ">and status = #{status}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/>
where id = #{id}
WHERE t.id = #{id}
</select>
<insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">
insert into sc_transition_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="varietyId != null">variety_id,</if>
<if test="transTo != null and transTo != ''">trans_to,</if>
<if test="transFrom != null and transFrom != ''">trans_from,</if>
<if test="transType != null">trans_type,</if>
@@ -48,9 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="transTo != null and transTo != ''">#{transTo},</if>
<if test="transFrom != null and transFrom != ''">#{transFrom},</if>
<if test="transType != null">#{transType},</if>
@@ -59,13 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</trim>
</insert>
<update id="updateScTransitionInfo" parameterType="ScTransitionInfo">
update sc_transition_info
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
<if test="transType != null">trans_type = #{transType},</if>
@@ -79,11 +96,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteScTransitionInfoById" parameterType="Integer">
delete from sc_transition_info where id = #{id}
delete
from sc_transition_info
where id = #{id}
</delete>
<delete id="deleteScTransitionInfoByIds" parameterType="String">
delete from sc_transition_info where id in
delete from sc_transition_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@@ -6,8 +6,9 @@
<resultMap type="ScFixHoof" id="ScFixHoofResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/>
<result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
@@ -17,15 +18,19 @@
<sql id="selectScFixHoofVo">
select fh.id,
fh.sheep_id,
bs.manage_tags AS manageTags,
fh.sheepfold,
sf.sheepfold_name as sheepfoldName,
sf.sheepfold_name AS sheepfoldName,
fh.variety_id,
bv.variety AS varietyName,
fh.comment,
fh.technician,
fh.create_by,
fh.create_time
from sc_fix_hoof fh
left join bas_sheep bs on fh.sheep_id = bs.id
left join da_sheepfold sf on fh.sheepfold = sf.id
left join bas_sheep_variety bv on fh.variety_id = bv.id
</sql>
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
@@ -33,9 +38,15 @@
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
<if test="varietyId != null">
and fh.variety_id = #{varietyId}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where>
</select>
@@ -44,24 +55,24 @@
where fh.id = #{id}
</select>
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
insert into sc_fix_hoof
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">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>
<if test="sheepfold != null">#{sheepfold},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
<insert id="insertScFixHoof" parameterType="ScFixHoof"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_fix_hoof
(sheep_id,
sheepfold,
variety_id,
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if>
create_by,
create_time)
VALUES
(#{sheepId},
#{sheepfold},
<if test="varietyId != null">#{varietyId},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if>
#{createBy},
#{createTime})
</insert>
<update id="updateScFixHoof" parameterType="ScFixHoof">
@@ -69,6 +80,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="varietyId != null">variety_id=#{varietyId},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
@@ -89,4 +101,6 @@
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -3,7 +3,7 @@
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" />
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasSheepList" parameterType="BasSheep" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
<where>
<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>
@@ -91,10 +91,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectBasSheepById" parameterType="Long" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
where id = #{id}
<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">
@@ -234,9 +249,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteBasSheepByIds" parameterType="String">
delete from bas_sheep where id in
delete from bas_sheep where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>