Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -128,7 +128,8 @@
|
||||
<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>
|
||||
<if test="isDelete == null">and is_delete = 0</if>
|
||||
<if test="isDelete != null">and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -151,20 +152,24 @@
|
||||
bv.variety AS varietyName
|
||||
FROM bas_sheep s
|
||||
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
||||
WHERE s.manage_tags = #{manageTags} LIMIT 1
|
||||
WHERE s.manage_tags = #{manageTags}
|
||||
AND s.is_delete = 0 LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepBySheepfold" parameterType="BasSheep" resultMap="BasSheepResult">
|
||||
<include refid="selectBasSheepVo"/>
|
||||
<where>
|
||||
sheepfold_id = #{id}
|
||||
and is_delete = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getSheepByRanchId" resultMap="BasSheepResult">
|
||||
SELECT *
|
||||
FROM bas_sheep
|
||||
WHERE ranch_id = #{ranchId}
|
||||
<include refid="selectBasSheepVo"/>
|
||||
<where>
|
||||
ranch_id = #{ranchId}
|
||||
and is_delete = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepListByIds" parameterType="list" resultMap="BasSheepResult">
|
||||
@@ -320,10 +325,16 @@
|
||||
</delete>
|
||||
|
||||
<select id="existsByManageTag" resultType="int">
|
||||
SELECT COUNT(*) FROM bas_sheep WHERE manage_tags = #{tag} AND is_delete = 0
|
||||
SELECT COUNT(*)
|
||||
FROM bas_sheep
|
||||
WHERE manage_tags = #{tag}
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="existsByElectronicTag" resultType="int">
|
||||
SELECT COUNT(*) FROM bas_sheep WHERE electronic_tags = #{tag} AND is_delete = 0
|
||||
SELECT COUNT(*)
|
||||
FROM bas_sheep
|
||||
WHERE electronic_tags = #{tag}
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,417 @@
|
||||
<?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.base.mapper.BreedRamFileMapper">
|
||||
|
||||
<resultMap type="BreedRamFile" id="BreedRamFileResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ordinaryEarNumber" column="ordinary_ear_number" />
|
||||
<result property="ranchId" column="ranch_id" />
|
||||
<result property="ranchName" column="ranch_name" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="sheepfoldName" column="sheepfold_name" />
|
||||
<result property="electronicTags" column="electronic_tags" />
|
||||
<result property="varietyId" column="variety_id" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepCategory" column="sheep_category" />
|
||||
<result property="currentStatus" column="current_status" />
|
||||
<result property="birthday" column="birthday" />
|
||||
<result property="dynamicInfo" column="dynamic_info" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="birthWeight" column="birth_weight" />
|
||||
<result property="weaningDate" column="weaning_date" />
|
||||
<result property="weaningDayAge" column="weaning_day_age" />
|
||||
<result property="weaningWeight" column="weaning_weight" />
|
||||
<result property="weaningDailyGain" column="weaning_daily_gain" />
|
||||
<result property="postWeaningDailyGain" column="post_weaning_daily_gain" />
|
||||
<result property="currentWeight" column="current_weight" />
|
||||
<result property="currentWeightDate" column="current_weight_date" />
|
||||
<result property="activityLevel" column="activity_level" />
|
||||
<result property="sexualStatus" column="sexual_status" />
|
||||
<result property="scrotumCircumference" column="scrotum_circumference" />
|
||||
<result property="spermCollectionTime" column="sperm_collection_time" />
|
||||
<result property="spermVolume" column="sperm_volume" />
|
||||
<result property="spermVitality" column="sperm_vitality" />
|
||||
<result property="spermDensity" column="sperm_density" />
|
||||
<result property="spermQuality" column="sperm_quality" />
|
||||
<result property="breedingStatus" column="breeding_status" />
|
||||
<result property="lastPlanTime" column="last_plan_time" />
|
||||
<result property="currentPlanTime" column="current_plan_time" />
|
||||
<result property="remark" column="comment" />
|
||||
<result property="proteinRateEbv" column="protein_rate_ebv" />
|
||||
<result property="milkFatRateEbv" column="milk_fat_rate_ebv" />
|
||||
<result property="scsEbv" column="scs_ebv" />
|
||||
<result property="growthPerformanceEbv" column="growth_performance_ebv" />
|
||||
<result property="resistanceEbv" column="resistance_ebv" />
|
||||
<result property="reproductionPerformanceEbv" column="reproduction_performance_ebv" />
|
||||
<result property="bodyTypeEbv" column="body_type_ebv" />
|
||||
<result property="comprehensiveBreedingValue" column="comprehensive_breeding_value" />
|
||||
<result property="fatherNumber" column="father_number" />
|
||||
<result property="motherNumber" column="mother_number" />
|
||||
<result property="grandfatherNumber" column="grandfather_number" />
|
||||
<result property="grandmotherNumber" column="grandmother_number" />
|
||||
<result property="maternalGrandfatherNumber" column="maternal_grandfather_number" />
|
||||
<result property="maternalGrandmotherNumber" column="maternal_grandmother_number" />
|
||||
<result property="isCoreFlock" column="is_core_flock" />
|
||||
<result property="isBreedingUse" column="is_breeding_use" />
|
||||
<result property="pregnancyCheck" column="pregnancy_check" />
|
||||
<result property="totalMatedEwes" column="total_mated_ewes" />
|
||||
<result property="naturalPregnancyCheckEwes" column="natural_pregnancy_check_ewes" />
|
||||
<result property="naturalConceptionRate" column="natural_conception_rate" />
|
||||
<result property="artificialPregnancyCheckEwes" column="artificial_pregnancy_check_ewes" />
|
||||
<result property="artificialConceptionRate" column="artificial_conception_rate" />
|
||||
<result property="ramMotherMilkVolume" column="ram_mother_milk_volume" />
|
||||
<result property="milkProductionEbv" column="milk_production_ebv" />
|
||||
<result property="accuracy" column="accuracy" />
|
||||
<result property="informationCount" column="information_count" />
|
||||
<result property="isPaternityTested" column="is_paternity_tested" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBreedRamFileVo">
|
||||
select id, ordinary_ear_number, ranch_id, ranch_name, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, sheep_category, current_status, birthday, dynamic_info, month_age, birth_weight, weaning_date, weaning_day_age, weaning_weight, weaning_daily_gain, post_weaning_daily_gain, current_weight, current_weight_date, activity_level, sexual_status, scrotum_circumference, sperm_collection_time, sperm_volume, sperm_vitality, sperm_density, sperm_quality, breeding_status, last_plan_time, current_plan_time, comment, protein_rate_ebv, milk_fat_rate_ebv, scs_ebv, growth_performance_ebv, resistance_ebv, reproduction_performance_ebv, body_type_ebv, comprehensive_breeding_value, father_number, mother_number, grandfather_number, grandmother_number, maternal_grandfather_number, maternal_grandmother_number, is_core_flock, is_breeding_use, pregnancy_check, total_mated_ewes, natural_pregnancy_check_ewes, natural_conception_rate, artificial_pregnancy_check_ewes, artificial_conception_rate, ram_mother_milk_volume, milk_production_ebv, accuracy, information_count, is_paternity_tested, create_by, create_time, update_by, update_time, is_delete from breed_ram_file
|
||||
</sql>
|
||||
|
||||
<select id="selectBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
<where>
|
||||
<if test="ordinaryEarNumber != null and ordinaryEarNumber != ''"> and ordinary_ear_number like concat('%', #{ordinaryEarNumber}, '%')</if>
|
||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||
<if test="ranchName != null and ranchName != ''"> and ranch_name like concat('%', #{ranchName}, '%')</if>
|
||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="sheepfoldName != null and sheepfoldName != ''"> and sheepfold_name like concat('%', #{sheepfoldName}, '%')</if>
|
||||
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags like concat('%', #{electronicTags}, '%')</if>
|
||||
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
||||
<if test="variety != null and variety != ''"> and variety like concat('%', #{variety}, '%')</if>
|
||||
<if test="sheepCategory != null and sheepCategory != ''"> and sheep_category = #{sheepCategory}</if>
|
||||
<if test="currentStatus != null and currentStatus != ''"> and current_status = #{currentStatus}</if>
|
||||
<if test="birthday != null "> and birthday = #{birthday}</if>
|
||||
<if test="dynamicInfo != null and dynamicInfo != ''"> and dynamic_info = #{dynamicInfo}</if>
|
||||
<if test="monthAge != null "> and month_age = #{monthAge}</if>
|
||||
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
|
||||
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
|
||||
<if test="weaningDayAge != null "> and weaning_day_age = #{weaningDayAge}</if>
|
||||
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
|
||||
<if test="weaningDailyGain != null "> and weaning_daily_gain = #{weaningDailyGain}</if>
|
||||
<if test="postWeaningDailyGain != null "> and post_weaning_daily_gain = #{postWeaningDailyGain}</if>
|
||||
<if test="currentWeight != null "> and current_weight = #{currentWeight}</if>
|
||||
<if test="currentWeightDate != null "> and current_weight_date = #{currentWeightDate}</if>
|
||||
<if test="activityLevel != null and activityLevel != ''"> and activity_level = #{activityLevel}</if>
|
||||
<if test="sexualStatus != null and sexualStatus != ''"> and sexual_status = #{sexualStatus}</if>
|
||||
<if test="scrotumCircumference != null "> and scrotum_circumference = #{scrotumCircumference}</if>
|
||||
<if test="spermCollectionTime != null "> and sperm_collection_time = #{spermCollectionTime}</if>
|
||||
<if test="spermVolume != null "> and sperm_volume = #{spermVolume}</if>
|
||||
<if test="spermVitality != null and spermVitality != ''"> and sperm_vitality = #{spermVitality}</if>
|
||||
<if test="spermDensity != null and spermDensity != ''"> and sperm_density = #{spermDensity}</if>
|
||||
<if test="spermQuality != null and spermQuality != ''"> and sperm_quality = #{spermQuality}</if>
|
||||
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
|
||||
<if test="lastPlanTime != null "> and last_plan_time = #{lastPlanTime}</if>
|
||||
<if test="currentPlanTime != null "> and current_plan_time = #{currentPlanTime}</if>
|
||||
<if test="proteinRateEbv != null "> and protein_rate_ebv = #{proteinRateEbv}</if>
|
||||
<if test="milkFatRateEbv != null "> and milk_fat_rate_ebv = #{milkFatRateEbv}</if>
|
||||
<if test="scsEbv != null "> and scs_ebv = #{scsEbv}</if>
|
||||
<if test="growthPerformanceEbv != null "> and growth_performance_ebv = #{growthPerformanceEbv}</if>
|
||||
<if test="resistanceEbv != null "> and resistance_ebv = #{resistanceEbv}</if>
|
||||
<if test="reproductionPerformanceEbv != null "> and reproduction_performance_ebv = #{reproductionPerformanceEbv}</if>
|
||||
<if test="bodyTypeEbv != null "> and body_type_ebv = #{bodyTypeEbv}</if>
|
||||
<if test="comprehensiveBreedingValue != null "> and comprehensive_breeding_value = #{comprehensiveBreedingValue}</if>
|
||||
<if test="fatherNumber != null and fatherNumber != ''"> and father_number = #{fatherNumber}</if>
|
||||
<if test="motherNumber != null and motherNumber != ''"> and mother_number = #{motherNumber}</if>
|
||||
<if test="grandfatherNumber != null and grandfatherNumber != ''"> and grandfather_number = #{grandfatherNumber}</if>
|
||||
<if test="grandmotherNumber != null and grandmotherNumber != ''"> and grandmother_number = #{grandmotherNumber}</if>
|
||||
<if test="maternalGrandfatherNumber != null and maternalGrandfatherNumber != ''"> and maternal_grandfather_number = #{maternalGrandfatherNumber}</if>
|
||||
<if test="maternalGrandmotherNumber != null and maternalGrandmotherNumber != ''"> and maternal_grandmother_number = #{maternalGrandmotherNumber}</if>
|
||||
<if test="isCoreFlock != null "> and is_core_flock = #{isCoreFlock}</if>
|
||||
<if test="isBreedingUse != null "> and is_breeding_use = #{isBreedingUse}</if>
|
||||
<if test="pregnancyCheck != null and pregnancyCheck != ''"> and pregnancy_check = #{pregnancyCheck}</if>
|
||||
<if test="totalMatedEwes != null "> and total_mated_ewes = #{totalMatedEwes}</if>
|
||||
<if test="naturalPregnancyCheckEwes != null "> and natural_pregnancy_check_ewes = #{naturalPregnancyCheckEwes}</if>
|
||||
<if test="naturalConceptionRate != null "> and natural_conception_rate = #{naturalConceptionRate}</if>
|
||||
<if test="artificialPregnancyCheckEwes != null "> and artificial_pregnancy_check_ewes = #{artificialPregnancyCheckEwes}</if>
|
||||
<if test="artificialConceptionRate != null "> and artificial_conception_rate = #{artificialConceptionRate}</if>
|
||||
<if test="ramMotherMilkVolume != null "> and ram_mother_milk_volume = #{ramMotherMilkVolume}</if>
|
||||
<if test="milkProductionEbv != null "> and milk_production_ebv = #{milkProductionEbv}</if>
|
||||
<if test="accuracy != null "> and accuracy = #{accuracy}</if>
|
||||
<if test="informationCount != null "> and information_count = #{informationCount}</if>
|
||||
<if test="isPaternityTested != null "> and is_paternity_tested = #{isPaternityTested}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectBreedRamFileById" parameterType="Long" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectBreedRamFileByOrdinaryEarNumber" parameterType="String" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
where ordinary_ear_number = #{ordinaryEarNumber}
|
||||
</select>
|
||||
|
||||
<select id="selectBreedRamFileByElectronicTags" parameterType="String" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
where electronic_tags = #{electronicTags}
|
||||
</select>
|
||||
|
||||
<select id="selectBreedRamFileListByRanchId" parameterType="Long" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
where ranch_id = #{ranchId} and (is_delete = 0 or is_delete is null)
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectBreedRamFileListBySheepfoldId" parameterType="Long" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
where sheepfold_id = #{sheepfoldId} and (is_delete = 0 or is_delete is null)
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCoreFlockBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
<where>
|
||||
is_core_flock = 1
|
||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
||||
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectBreedingUseBreedRamFileList" parameterType="BreedRamFile" resultMap="BreedRamFileResult">
|
||||
<include refid="selectBreedRamFileVo"/>
|
||||
<where>
|
||||
is_breeding_use = 1
|
||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
||||
<if test="breedingStatus != null "> and breeding_status = #{breedingStatus}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insertBreedRamFile" parameterType="BreedRamFile" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into breed_ram_file
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ordinaryEarNumber != null">ordinary_ear_number,</if>
|
||||
<if test="ranchId != null">ranch_id,</if>
|
||||
<if test="ranchName != null">ranch_name,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="sheepfoldName != null">sheepfold_name,</if>
|
||||
<if test="electronicTags != null">electronic_tags,</if>
|
||||
<if test="varietyId != null">variety_id,</if>
|
||||
<if test="variety != null">variety,</if>
|
||||
<if test="sheepCategory != null">sheep_category,</if>
|
||||
<if test="currentStatus != null">current_status,</if>
|
||||
<if test="birthday != null">birthday,</if>
|
||||
<if test="dynamicInfo != null">dynamic_info,</if>
|
||||
<if test="monthAge != null">month_age,</if>
|
||||
<if test="birthWeight != null">birth_weight,</if>
|
||||
<if test="weaningDate != null">weaning_date,</if>
|
||||
<if test="weaningDayAge != null">weaning_day_age,</if>
|
||||
<if test="weaningWeight != null">weaning_weight,</if>
|
||||
<if test="weaningDailyGain != null">weaning_daily_gain,</if>
|
||||
<if test="postWeaningDailyGain != null">post_weaning_daily_gain,</if>
|
||||
<if test="currentWeight != null">current_weight,</if>
|
||||
<if test="currentWeightDate != null">current_weight_date,</if>
|
||||
<if test="activityLevel != null">activity_level,</if>
|
||||
<if test="sexualStatus != null">sexual_status,</if>
|
||||
<if test="scrotumCircumference != null">scrotum_circumference,</if>
|
||||
<if test="spermCollectionTime != null">sperm_collection_time,</if>
|
||||
<if test="spermVolume != null">sperm_volume,</if>
|
||||
<if test="spermVitality != null">sperm_vitality,</if>
|
||||
<if test="spermDensity != null">sperm_density,</if>
|
||||
<if test="spermQuality != null">sperm_quality,</if>
|
||||
<if test="breedingStatus != null">breeding_status,</if>
|
||||
<if test="lastPlanTime != null">last_plan_time,</if>
|
||||
<if test="currentPlanTime != null">current_plan_time,</if>
|
||||
<if test="remark != null">comment,</if>
|
||||
<if test="proteinRateEbv != null">protein_rate_ebv,</if>
|
||||
<if test="milkFatRateEbv != null">milk_fat_rate_ebv,</if>
|
||||
<if test="scsEbv != null">scs_ebv,</if>
|
||||
<if test="growthPerformanceEbv != null">growth_performance_ebv,</if>
|
||||
<if test="resistanceEbv != null">resistance_ebv,</if>
|
||||
<if test="reproductionPerformanceEbv != null">reproduction_performance_ebv,</if>
|
||||
<if test="bodyTypeEbv != null">body_type_ebv,</if>
|
||||
<if test="comprehensiveBreedingValue != null">comprehensive_breeding_value,</if>
|
||||
<if test="fatherNumber != null">father_number,</if>
|
||||
<if test="motherNumber != null">mother_number,</if>
|
||||
<if test="grandfatherNumber != null">grandfather_number,</if>
|
||||
<if test="grandmotherNumber != null">grandmother_number,</if>
|
||||
<if test="maternalGrandfatherNumber != null">maternal_grandfather_number,</if>
|
||||
<if test="maternalGrandmotherNumber != null">maternal_grandmother_number,</if>
|
||||
<if test="isCoreFlock != null">is_core_flock,</if>
|
||||
<if test="isBreedingUse != null">is_breeding_use,</if>
|
||||
<if test="pregnancyCheck != null">pregnancy_check,</if>
|
||||
<if test="totalMatedEwes != null">total_mated_ewes,</if>
|
||||
<if test="naturalPregnancyCheckEwes != null">natural_pregnancy_check_ewes,</if>
|
||||
<if test="naturalConceptionRate != null">natural_conception_rate,</if>
|
||||
<if test="artificialPregnancyCheckEwes != null">artificial_pregnancy_check_ewes,</if>
|
||||
<if test="artificialConceptionRate != null">artificial_conception_rate,</if>
|
||||
<if test="ramMotherMilkVolume != null">ram_mother_milk_volume,</if>
|
||||
<if test="milkProductionEbv != null">milk_production_ebv,</if>
|
||||
<if test="accuracy != null">accuracy,</if>
|
||||
<if test="informationCount != null">information_count,</if>
|
||||
<if test="isPaternityTested != null">is_paternity_tested,</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>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ordinaryEarNumber != null">#{ordinaryEarNumber},</if>
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
<if test="ranchName != null">#{ranchName},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="sheepfoldName != null">#{sheepfoldName},</if>
|
||||
<if test="electronicTags != null">#{electronicTags},</if>
|
||||
<if test="varietyId != null">#{varietyId},</if>
|
||||
<if test="variety != null">#{variety},</if>
|
||||
<if test="sheepCategory != null">#{sheepCategory},</if>
|
||||
<if test="currentStatus != null">#{currentStatus},</if>
|
||||
<if test="birthday != null">#{birthday},</if>
|
||||
<if test="dynamicInfo != null">#{dynamicInfo},</if>
|
||||
<if test="monthAge != null">#{monthAge},</if>
|
||||
<if test="birthWeight != null">#{birthWeight},</if>
|
||||
<if test="weaningDate != null">#{weaningDate},</if>
|
||||
<if test="weaningDayAge != null">#{weaningDayAge},</if>
|
||||
<if test="weaningWeight != null">#{weaningWeight},</if>
|
||||
<if test="weaningDailyGain != null">#{weaningDailyGain},</if>
|
||||
<if test="postWeaningDailyGain != null">#{postWeaningDailyGain},</if>
|
||||
<if test="currentWeight != null">#{currentWeight},</if>
|
||||
<if test="currentWeightDate != null">#{currentWeightDate},</if>
|
||||
<if test="activityLevel != null">#{activityLevel},</if>
|
||||
<if test="sexualStatus != null">#{sexualStatus},</if>
|
||||
<if test="scrotumCircumference != null">#{scrotumCircumference},</if>
|
||||
<if test="spermCollectionTime != null">#{spermCollectionTime},</if>
|
||||
<if test="spermVolume != null">#{spermVolume},</if>
|
||||
<if test="spermVitality != null">#{spermVitality},</if>
|
||||
<if test="spermDensity != null">#{spermDensity},</if>
|
||||
<if test="spermQuality != null">#{spermQuality},</if>
|
||||
<if test="breedingStatus != null">#{breedingStatus},</if>
|
||||
<if test="lastPlanTime != null">#{lastPlanTime},</if>
|
||||
<if test="currentPlanTime != null">#{currentPlanTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="proteinRateEbv != null">#{proteinRateEbv},</if>
|
||||
<if test="milkFatRateEbv != null">#{milkFatRateEbv},</if>
|
||||
<if test="scsEbv != null">#{scsEbv},</if>
|
||||
<if test="growthPerformanceEbv != null">#{growthPerformanceEbv},</if>
|
||||
<if test="resistanceEbv != null">#{resistanceEbv},</if>
|
||||
<if test="reproductionPerformanceEbv != null">#{reproductionPerformanceEbv},</if>
|
||||
<if test="bodyTypeEbv != null">#{bodyTypeEbv},</if>
|
||||
<if test="comprehensiveBreedingValue != null">#{comprehensiveBreedingValue},</if>
|
||||
<if test="fatherNumber != null">#{fatherNumber},</if>
|
||||
<if test="motherNumber != null">#{motherNumber},</if>
|
||||
<if test="grandfatherNumber != null">#{grandfatherNumber},</if>
|
||||
<if test="grandmotherNumber != null">#{grandmotherNumber},</if>
|
||||
<if test="maternalGrandfatherNumber != null">#{maternalGrandfatherNumber},</if>
|
||||
<if test="maternalGrandmotherNumber != null">#{maternalGrandmotherNumber},</if>
|
||||
<if test="isCoreFlock != null">#{isCoreFlock},</if>
|
||||
<if test="isBreedingUse != null">#{isBreedingUse},</if>
|
||||
<if test="pregnancyCheck != null">#{pregnancyCheck},</if>
|
||||
<if test="totalMatedEwes != null">#{totalMatedEwes},</if>
|
||||
<if test="naturalPregnancyCheckEwes != null">#{naturalPregnancyCheckEwes},</if>
|
||||
<if test="naturalConceptionRate != null">#{naturalConceptionRate},</if>
|
||||
<if test="artificialPregnancyCheckEwes != null">#{artificialPregnancyCheckEwes},</if>
|
||||
<if test="artificialConceptionRate != null">#{artificialConceptionRate},</if>
|
||||
<if test="ramMotherMilkVolume != null">#{ramMotherMilkVolume},</if>
|
||||
<if test="milkProductionEbv != null">#{milkProductionEbv},</if>
|
||||
<if test="accuracy != null">#{accuracy},</if>
|
||||
<if test="informationCount != null">#{informationCount},</if>
|
||||
<if test="isPaternityTested != null">#{isPaternityTested},</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>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBreedRamFile" parameterType="BreedRamFile">
|
||||
update breed_ram_file
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ordinaryEarNumber != null">ordinary_ear_number = #{ordinaryEarNumber},</if>
|
||||
<if test="ranchId != null">ranch_id = #{ranchId},</if>
|
||||
<if test="ranchName != null">ranch_name = #{ranchName},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="sheepfoldName != null">sheepfold_name = #{sheepfoldName},</if>
|
||||
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
|
||||
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
||||
<if test="variety != null">variety = #{variety},</if>
|
||||
<if test="sheepCategory != null">sheep_category = #{sheepCategory},</if>
|
||||
<if test="currentStatus != null">current_status = #{currentStatus},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="dynamicInfo != null">dynamic_info = #{dynamicInfo},</if>
|
||||
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
|
||||
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
|
||||
<if test="weaningDayAge != null">weaning_day_age = #{weaningDayAge},</if>
|
||||
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
|
||||
<if test="weaningDailyGain != null">weaning_daily_gain = #{weaningDailyGain},</if>
|
||||
<if test="postWeaningDailyGain != null">post_weaning_daily_gain = #{postWeaningDailyGain},</if>
|
||||
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
|
||||
<if test="currentWeightDate != null">current_weight_date = #{currentWeightDate},</if>
|
||||
<if test="activityLevel != null">activity_level = #{activityLevel},</if>
|
||||
<if test="sexualStatus != null">sexual_status = #{sexualStatus},</if>
|
||||
<if test="scrotumCircumference != null">scrotum_circumference = #{scrotumCircumference},</if>
|
||||
<if test="spermCollectionTime != null">sperm_collection_time = #{spermCollectionTime},</if>
|
||||
<if test="spermVolume != null">sperm_volume = #{spermVolume},</if>
|
||||
<if test="spermVitality != null">sperm_vitality = #{spermVitality},</if>
|
||||
<if test="spermDensity != null">sperm_density = #{spermDensity},</if>
|
||||
<if test="spermQuality != null">sperm_quality = #{spermQuality},</if>
|
||||
<if test="breedingStatus != null">breeding_status = #{breedingStatus},</if>
|
||||
<if test="lastPlanTime != null">last_plan_time = #{lastPlanTime},</if>
|
||||
<if test="currentPlanTime != null">current_plan_time = #{currentPlanTime},</if>
|
||||
<if test="remark != null">comment = #{remark},</if>
|
||||
<if test="proteinRateEbv != null">protein_rate_ebv = #{proteinRateEbv},</if>
|
||||
<if test="milkFatRateEbv != null">milk_fat_rate_ebv = #{milkFatRateEbv},</if>
|
||||
<if test="scsEbv != null">scs_ebv = #{scsEbv},</if>
|
||||
<if test="growthPerformanceEbv != null">growth_performance_ebv = #{growthPerformanceEbv},</if>
|
||||
<if test="resistanceEbv != null">resistance_ebv = #{resistanceEbv},</if>
|
||||
<if test="reproductionPerformanceEbv != null">reproduction_performance_ebv = #{reproductionPerformanceEbv},</if>
|
||||
<if test="bodyTypeEbv != null">body_type_ebv = #{bodyTypeEbv},</if>
|
||||
<if test="comprehensiveBreedingValue != null">comprehensive_breeding_value = #{comprehensiveBreedingValue},</if>
|
||||
<if test="fatherNumber != null">father_number = #{fatherNumber},</if>
|
||||
<if test="motherNumber != null">mother_number = #{motherNumber},</if>
|
||||
<if test="grandfatherNumber != null">grandfather_number = #{grandfatherNumber},</if>
|
||||
<if test="grandmotherNumber != null">grandmother_number = #{grandmotherNumber},</if>
|
||||
<if test="maternalGrandfatherNumber != null">maternal_grandfather_number = #{maternalGrandfatherNumber},</if>
|
||||
<if test="maternalGrandmotherNumber != null">maternal_grandmother_number = #{maternalGrandmotherNumber},</if>
|
||||
<if test="isCoreFlock != null">is_core_flock = #{isCoreFlock},</if>
|
||||
<if test="isBreedingUse != null">is_breeding_use = #{isBreedingUse},</if>
|
||||
<if test="pregnancyCheck != null">pregnancy_check = #{pregnancyCheck},</if>
|
||||
<if test="totalMatedEwes != null">total_mated_ewes = #{totalMatedEwes},</if>
|
||||
<if test="naturalPregnancyCheckEwes != null">natural_pregnancy_check_ewes = #{naturalPregnancyCheckEwes},</if>
|
||||
<if test="naturalConceptionRate != null">natural_conception_rate = #{naturalConceptionRate},</if>
|
||||
<if test="artificialPregnancyCheckEwes != null">artificial_pregnancy_check_ewes = #{artificialPregnancyCheckEwes},</if>
|
||||
<if test="artificialConceptionRate != null">artificial_conception_rate = #{artificialConceptionRate},</if>
|
||||
<if test="ramMotherMilkVolume != null">ram_mother_milk_volume = #{ramMotherMilkVolume},</if>
|
||||
<if test="milkProductionEbv != null">milk_production_ebv = #{milkProductionEbv},</if>
|
||||
<if test="accuracy != null">accuracy = #{accuracy},</if>
|
||||
<if test="informationCount != null">information_count = #{informationCount},</if>
|
||||
<if test="isPaternityTested != null">is_paternity_tested = #{isPaternityTested},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBreedRamFileById" parameterType="Long">
|
||||
delete from breed_ram_file where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBreedRamFileByIds" parameterType="String">
|
||||
delete from breed_ram_file where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -28,16 +28,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</sql>
|
||||
|
||||
<select id="selectDisinfectList" parameterType="Disinfect" resultMap="DisinfectResult">
|
||||
<include refid="selectDisinfectVo"/>
|
||||
<where>
|
||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="datetime != null "> and datetime = #{datetime}</if>
|
||||
<if test="technician != null and technician != ''"> and technician = #{technician}</if>
|
||||
<if test="way != null and way != ''"> and way = #{way}</if>
|
||||
<if test="usageId != null "> and usage_id = #{usageId}</if>
|
||||
<if test="ratio != null and ratio != ''"> and ratio = #{ratio}</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
</where>
|
||||
SELECT sd.id,
|
||||
sd.sheepfold_id,
|
||||
sd.datetime,
|
||||
sd.technician,
|
||||
sd.way,
|
||||
sd.usage_id,
|
||||
sd.ratio,
|
||||
sd.comment,
|
||||
sd.update_by,
|
||||
sd.update_time,
|
||||
sd.create_by,
|
||||
sd.create_time,
|
||||
ds.sheepfold_name
|
||||
FROM sw_disinfect sd
|
||||
LEFT JOIN da_sheepfold ds ON ds.id = sd.sheepfold_id
|
||||
WHERE 1 = 1
|
||||
<if test="sheepfoldId != null"> AND sd.sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="datetime != null"> AND sd.datetime = #{datetime}</if>
|
||||
<if test="technician != null and technician != ''"> AND sd.technician = #{technician}</if>
|
||||
<if test="way != null and way != ''"> AND sd.way = #{way}</if>
|
||||
<if test="usageId != null"> AND sd.usage_id = #{usageId}</if>
|
||||
<if test="ratio != null and ratio != ''"> AND sd.ratio = #{ratio}</if>
|
||||
<if test="comment != null and comment != ''"> AND sd.comment = #{comment}</if>
|
||||
<!-- 子表过滤条件:仅保留满足药品名称的记录 -->
|
||||
<if test="mediName != null and mediName != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM sw_medicine_usage_details mud
|
||||
JOIN sw_medicine sm ON sm.id = mud.medi_id
|
||||
WHERE mud.medi_usage = sd.usage_id
|
||||
AND sm.name like concat('%',#{mediName},'%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectDisinfectById" parameterType="Long" resultMap="DisinfectResult">
|
||||
@@ -71,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where sd.id = #{id}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDisinfectById" parameterType="Long">
|
||||
|
||||
@@ -30,11 +30,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectQuarantineReportVo">
|
||||
select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
|
||||
select sqr.id, sheep_type,sqr.gender,sqr.parity,sqr.breed,sqr.month_age,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
|
||||
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
|
||||
sqi.name as item_name,
|
||||
sqs.name as sample,
|
||||
sf.bs_manage_tags sheep_no,sf.gender,sf.parity,sf.breed,sf.month_age
|
||||
sf.bs_manage_tags sheep_no
|
||||
from sw_quarantine_report sqr
|
||||
left join sw_quarantine_items sqi on sqr.quar_item = sqi.id
|
||||
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
|
||||
@@ -48,10 +48,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
|
||||
<if test="quarItem != null "> and quar_item = #{quarItem}</if>
|
||||
<if test="sampleType != null "> and sample_type = #{sampleType}</if>
|
||||
<if test="sampler != null and sampler != ''"> and sampler = #{sampler}</if>
|
||||
<if test="quarOfficer != null and quarOfficer != ''"> and quar_officer = #{quarOfficer}</if>
|
||||
<if test="sampler != null and sampler != ''"> and sampler like concat('%',#{sampler},'%') </if>
|
||||
<if test="quarOfficer != null and quarOfficer != ''"> and quar_officer like concat('%',#{quarOfficer},'%')</if>
|
||||
<if test="result != null "> and result = #{result}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="sheepType != null and sheepType!= ''"> and sqr.sheep_type=#{sheepType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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.common.mapper.UserPostMapper">
|
||||
|
||||
<resultMap type="UserPost" id="UserPostResult">
|
||||
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="postName" column="post_name"/>
|
||||
<result property="postCode" column="post_code" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getUserPostListByCode" resultMap="UserPostResult">
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -2,151 +2,61 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpSheepMilkAnalysisMapper">
|
||||
|
||||
<resultMap id="NpSheepMilkAnalysisResultMap" type="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
|
||||
<id column="id" property="id"/>
|
||||
<result column="manage_ear_tag" property="manageEarTag"/>
|
||||
<result column="variety" property="variety"/>
|
||||
<result column="milking_date" property="milkingDate"/>
|
||||
<result column="dry_date" property="dryDate"/>
|
||||
<result column="milking_days" property="milkingDays"/>
|
||||
<result column="max_parity" property="maxParity"/>
|
||||
<result column="total_milk" property="totalMilk"/>
|
||||
<result column="total_corrected_milk" property="totalCorrectedMilk"/>
|
||||
<result column="avg_daily_corrected_milk" property="avgDailyCorrectedMilk"/>
|
||||
<result column="parity1_total_milk" property="parity1TotalMilk"/>
|
||||
<result column="parity2_total_milk" property="parity2TotalMilk"/>
|
||||
<result column="parity3_total_milk" property="parity3TotalMilk"/>
|
||||
<result column="parity4_total_milk" property="parity4TotalMilk"/>
|
||||
<result column="parity1_avg_milk" property="parity1AvgMilk"/>
|
||||
<result column="parity2_avg_milk" property="parity2AvgMilk"/>
|
||||
<result column="parity3_avg_milk" property="parity3AvgMilk"/>
|
||||
<result column="parity4_avg_milk" property="parity4AvgMilk"/>
|
||||
<result column="lactation_days" property="lactationDays"/>
|
||||
<result column="last_7_avg_milk" property="last7AvgMilk"/>
|
||||
<result column="last_7_corrected_milk" property="last7CorrectedMilk"/>
|
||||
<result column="last_14_avg_milk" property="last14AvgMilk"/>
|
||||
<result column="last_30_avg_milk" property="last30AvgMilk"/>
|
||||
<result column="sheep_type" property="sheepType"/>
|
||||
<result column="birthday" property="birthday"/>
|
||||
<result column="current_parity" property="currentParity"/>
|
||||
<result column="month_age" property="monthAge"/>
|
||||
<result column="current_weight" property="currentWeight"/>
|
||||
<result column="breed_status" property="breedStatus"/>
|
||||
<result column="father_tag" property="fatherTag"/>
|
||||
<result column="mother_tag" property="motherTag"/>
|
||||
<result column="ranch" property="ranch"/>
|
||||
<result column="family" property="family"/>
|
||||
<result column="mother_milking_days" property="motherMilkingDays"/>
|
||||
<result column="mother_total_corrected_milk" property="motherTotalCorrectedMilk"/>
|
||||
<result column="mother_max_parity" property="motherMaxParity"/>
|
||||
<result column="mother_avg_corrected" property="motherAvgCorrected"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, manage_ear_tag, variety, milking_date, dry_date, milking_days,
|
||||
screen_days, max_parity, total_milk, total_corrected_milk,
|
||||
avg_daily_corrected_milk, parity1_total_milk, parity2_total_milk,
|
||||
parity3_total_milk, parity4_total_milk, parity1_avg_milk,
|
||||
parity2_avg_milk, parity3_avg_milk, parity4_avg_milk,
|
||||
lactation_days, last_7_avg_milk, last_7_corrected_milk,
|
||||
last_14_avg_milk, last_30_avg_milk, sheep_type, birthday,
|
||||
current_parity, month_age, current_weight, breed_status,
|
||||
father_tag, mother_tag, ranch, family, mother_milking_days,
|
||||
mother_total_corrected_milk, mother_max_parity,
|
||||
mother_avg_corrected
|
||||
</sql>
|
||||
|
||||
<select id="selectNpSheepMilkAnalysisById" resultMap="NpSheepMilkAnalysisResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM np_sheep_milk_analysis
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectNpSheepMilkAnalysisList" resultMap="NpSheepMilkAnalysisResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM np_sheep_milk_analysis
|
||||
<!-- 1) 获取 distinct sheep_id(支持按 sheep_file.bs_manage_tags 模糊搜索) -->
|
||||
<select id="selectDistinctSheepIds" resultType="string" parameterType="map">
|
||||
SELECT DISTINCT a.sheep_id
|
||||
FROM np_milk_prod_classes a
|
||||
LEFT JOIN sheep_file sf ON a.sheep_id = sf.id
|
||||
<where>
|
||||
<if test="manageEarTag != null and manageEarTag != ''">
|
||||
AND manage_ear_tag LIKE CONCAT('%', #{manageEarTag}, '%')
|
||||
AND sf.bs_manage_tags LIKE CONCAT('%', #{manageEarTag}, '%')
|
||||
</if>
|
||||
<!-- 可继续添加其他搜索条件 -->
|
||||
</where>
|
||||
ORDER BY milking_date DESC
|
||||
ORDER BY a.sheep_id
|
||||
</select>
|
||||
|
||||
<insert id="insertNpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
|
||||
INSERT INTO np_sheep_milk_analysis (
|
||||
<include refid="Base_Column_List"/>
|
||||
) VALUES (
|
||||
#{id}, #{manageEarTag}, #{variety}, #{milkingDate}, #{dryDate},
|
||||
#{milkingDays}, #{screenDays}, #{maxParity}, #{totalMilk},
|
||||
#{totalCorrectedMilk}, #{avgDailyCorrectedMilk}, #{parity1TotalMilk},
|
||||
#{parity2TotalMilk}, #{parity3TotalMilk}, #{parity4TotalMilk},
|
||||
#{parity1AvgMilk}, #{parity2AvgMilk}, #{parity3AvgMilk},
|
||||
#{parity4AvgMilk}, #{lactationDays}, #{last7AvgMilk},
|
||||
#{last7CorrectedMilk}, #{last14AvgMilk}, #{last30AvgMilk},
|
||||
#{sheepType}, #{birthday}, #{currentParity}, #{monthAge},
|
||||
#{currentWeight}, #{breedStatus}, #{fatherTag}, #{motherTag},
|
||||
#{ranch}, #{family}, #{motherMilkingDays},
|
||||
#{motherTotalCorrectedMilk}, #{motherMaxParity},
|
||||
#{motherAvgCorrected}
|
||||
)
|
||||
</insert>
|
||||
<!-- 2) 获取某只羊的所有班次记录(按班次日期升序) -->
|
||||
<!-- 假设表中字段:class_date, system_milk, corrected_milk, parity -->
|
||||
<select id="selectMilkRecordsBySheepId" resultType="map" parameterType="string">
|
||||
SELECT
|
||||
datetime AS classDate,
|
||||
milk AS systemMilk,
|
||||
corrected_milk AS correctedMilk,
|
||||
classes AS parity
|
||||
FROM np_milk_prod_classes
|
||||
WHERE sheep_id = #{sheepId}
|
||||
ORDER BY datetime ASC
|
||||
</select>
|
||||
|
||||
<update id="updateNpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
|
||||
UPDATE np_sheep_milk_analysis
|
||||
SET manage_ear_tag = #{manageEarTag},
|
||||
variety = #{variety},
|
||||
milking_date = #{milkingDate},
|
||||
dry_date = #{dryDate},
|
||||
milking_days = #{milkingDays},
|
||||
screen_days = #{screenDays},
|
||||
max_parity = #{maxParity},
|
||||
total_milk = #{totalMilk},
|
||||
total_corrected_milk = #{totalCorrectedMilk},
|
||||
avg_daily_corrected_milk = #{avgDailyCorrectedMilk},
|
||||
parity1_total_milk = #{parity1TotalMilk},
|
||||
parity2_total_milk = #{parity2TotalMilk},
|
||||
parity3_total_milk = #{parity3TotalMilk},
|
||||
parity4_total_milk = #{parity4TotalMilk},
|
||||
parity1_avg_milk = #{parity1AvgMilk},
|
||||
parity2_avg_milk = #{parity2AvgMilk},
|
||||
parity3_avg_milk = #{parity3AvgMilk},
|
||||
parity4_avg_milk = #{parity4AvgMilk},
|
||||
lactation_days = #{lactationDays},
|
||||
last_7_avg_milk = #{last7AvgMilk},
|
||||
last_7_corrected_milk = #{last7CorrectedMilk},
|
||||
last_14_avg_milk = #{last14AvgMilk},
|
||||
last_30_avg_milk = #{last30AvgMilk},
|
||||
sheep_type = #{sheepType},
|
||||
birthday = #{birthday},
|
||||
current_parity = #{currentParity},
|
||||
month_age = #{monthAge},
|
||||
current_weight = #{currentWeight},
|
||||
breed_status = #{breedStatus},
|
||||
father_tag = #{fatherTag},
|
||||
mother_tag = #{motherTag},
|
||||
ranch = #{ranch},
|
||||
family = #{family},
|
||||
mother_milking_days = #{motherMilkingDays},
|
||||
mother_total_corrected_milk = #{motherTotalCorrectedMilk},
|
||||
mother_max_parity = #{motherMaxParity},
|
||||
mother_avg_corrected = #{motherAvgCorrected}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNpSheepMilkAnalysisById" parameterType="Long">
|
||||
DELETE FROM np_sheep_milk_analysis WHERE id = #{id}
|
||||
</delete>
|
||||
<!-- 3) 获取该羊在 sheep_file 视图中的基础信息 -->
|
||||
<!-- 假设字段名称:bs_manage_tags、variety、lactation_day、name、birthday、parity、month_age、current_weight、breed、father_manage_tags、mother_manage_tags、dr_ranch、family -->
|
||||
<select id="selectSheepFileBySheepId" resultType="map" parameterType="string">
|
||||
SELECT
|
||||
id AS sheep_id,
|
||||
bs_manage_tags AS manageEarTag,
|
||||
variety,
|
||||
lactation_day AS lactationDay,
|
||||
name AS sheepType,
|
||||
birthday,
|
||||
parity AS currentParity,
|
||||
month_age AS monthAge,
|
||||
current_weight AS currentWeight,
|
||||
breed AS breedStatus,
|
||||
father_manage_tags AS fatherManageTags,
|
||||
mother_manage_tags AS motherManageTags,
|
||||
dr_ranch AS ranchName,
|
||||
family
|
||||
FROM sheep_file
|
||||
WHERE id = #{sheepId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteNpSheepMilkAnalysisByIds" parameterType="Long">
|
||||
DELETE FROM np_sheep_milk_analysis WHERE id IN
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<!-- 4) 兼容旧 list 查询(返回 domain 对象列表),但在我们的实现中 service 会构造最终的 NpSheepMilkAnalysis 列表 -->
|
||||
<select id="selectNpSheepMilkAnalysisList" resultType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
|
||||
<!-- 如果你仍需基于某张表的简单映射,可在此实现;当前我们在 ServiceImpl 中组装对象,所以该查询不做复杂实现 -->
|
||||
SELECT 1 FROM dual WHERE 1=0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?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.feed.mapper.SgFeedListMapper">
|
||||
|
||||
<resultMap type="SgFeedList" id="SgFeedListResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="formulaBatchId" column="formula_batch_id" />
|
||||
<result property="zookeeper" column="zookeeper" />
|
||||
<result property="deployDate" column="deploy_date" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedListVo">
|
||||
select id, formula_id, formula_batch_id, zookeeper, deploy_date from sg_feed_list
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult">
|
||||
<include refid="selectSgFeedListVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if>
|
||||
<if test="deployDate != null "> and deploy_date = #{deployDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedListById" parameterType="Long" resultMap="SgFeedListResult">
|
||||
<include refid="selectSgFeedListVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFeedList" parameterType="SgFeedList" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sg_feed_list
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="formulaId != null">formula_id,</if>
|
||||
<if test="formulaBatchId != null">formula_batch_id,</if>
|
||||
<if test="zookeeper != null">zookeeper,</if>
|
||||
<if test="deployDate != null">deploy_date,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="formulaId != null">#{formulaId},</if>
|
||||
<if test="formulaBatchId != null">#{formulaBatchId},</if>
|
||||
<if test="zookeeper != null">#{zookeeper},</if>
|
||||
<if test="deployDate != null">#{deployDate},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedList" parameterType="SgFeedList">
|
||||
update sg_feed_list
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="formulaId != null">formula_id = #{formulaId},</if>
|
||||
<if test="formulaBatchId != null">formula_batch_id = #{formulaBatchId},</if>
|
||||
<if test="zookeeper != null">zookeeper = #{zookeeper},</if>
|
||||
<if test="deployDate != null">deploy_date = #{deployDate},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedListById" parameterType="Long">
|
||||
delete from sg_feed_list where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedListByIds" parameterType="String">
|
||||
delete from sg_feed_list where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
146
zhyc-module/src/main/resources/mapper/feed/SgFeedPlanMapper.xml
Normal file
146
zhyc-module/src/main/resources/mapper/feed/SgFeedPlanMapper.xml
Normal file
@@ -0,0 +1,146 @@
|
||||
<?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.feed.mapper.SgFeedPlanMapper">
|
||||
|
||||
<resultMap type="SgFeedPlan" id="SgFeedPlanResult">
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="sheepHouseId" column="sheep_house_id" />
|
||||
<result property="sheepCount" column="sheep_count" />
|
||||
<result property="planDailySize" column="plan_daily_size" />
|
||||
<result property="ratioMorning" column="ratio_morning" />
|
||||
<result property="ratioNoon" column="ratio_noon" />
|
||||
<result property="ratioAfternoon" column="ratio_afternoon" />
|
||||
<result property="planMorningSize" column="plan_morning_size" />
|
||||
<result property="planMorningTotal" column="plan_morning_total" />
|
||||
<result property="actualMorningSize" column="actual_morning_size" />
|
||||
<result property="planNoonSize" column="plan_noon_size" />
|
||||
<result property="planNoonTotal" column="plan_noon_total" />
|
||||
<result property="actualNoonSize" column="actual_noon_size" />
|
||||
<result property="planAfternoonSize" column="plan_afternoon_size" />
|
||||
<result property="planAfternoonTotal" column="plan_afternoon_total" />
|
||||
<result property="actualAfternoonSize" column="actual_afternoon_size" />
|
||||
<result property="planFeedTotal" column="plan_feed_total" />
|
||||
<result property="zookeeper" column="zookeeper" />
|
||||
<result property="planDate" column="plan_date" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedPlanVo">
|
||||
select create_date, formula_id, batch_id, sheep_house_id, sheep_count, plan_daily_size, ratio_morning, ratio_noon, ratio_afternoon, plan_morning_size, plan_morning_total, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult">
|
||||
<include refid="selectSgFeedPlanVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="sheepHouseId != null "> and sheep_house_id = #{sheepHouseId}</if>
|
||||
</where>
|
||||
ORDER BY formula_id ASC, plan_date ASC
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedPlanByCreateDate" parameterType="Date" resultMap="SgFeedPlanResult">
|
||||
<include refid="selectSgFeedPlanVo"/>
|
||||
where create_date = #{createDate}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFeedPlan" parameterType="SgFeedPlan">
|
||||
insert into sg_feed_plan
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="createDate != null">create_date,</if>
|
||||
<if test="formulaId != null and formulaId != ''">formula_id,</if>
|
||||
<if test="batchId != null and batchId != ''">batch_id,</if>
|
||||
<if test="sheepHouseId != null">sheep_house_id,</if>
|
||||
<if test="sheepCount != null">sheep_count,</if>
|
||||
<if test="planDailySize != null">plan_daily_size,</if>
|
||||
<if test="ratioMorning != null">ratio_morning,</if>
|
||||
<if test="ratioNoon != null">ratio_noon,</if>
|
||||
<if test="ratioAfternoon != null">ratio_afternoon,</if>
|
||||
<if test="planMorningSize != null">plan_morning_size,</if>
|
||||
<if test="planMorningTotal != null">plan_morning_total,</if>
|
||||
<if test="actualMorningSize != null">actual_morning_size,</if>
|
||||
<if test="planNoonSize != null">plan_noon_size,</if>
|
||||
<if test="planNoonTotal != null">plan_noon_total,</if>
|
||||
<if test="actualNoonSize != null">actual_noon_size,</if>
|
||||
<if test="planAfternoonSize != null">plan_afternoon_size,</if>
|
||||
<if test="planAfternoonTotal != null">plan_afternoon_total,</if>
|
||||
<if test="actualAfternoonSize != null">actual_afternoon_size,</if>
|
||||
<if test="planFeedTotal != null">plan_feed_total,</if>
|
||||
<if test="zookeeper != null">zookeeper,</if>
|
||||
<if test="planDate != null">plan_date,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
<if test="batchId != null and batchId != ''">#{batchId},</if>
|
||||
<if test="sheepHouseId != null">#{sheepHouseId},</if>
|
||||
<if test="sheepCount != null">#{sheepCount},</if>
|
||||
<if test="planDailySize != null">#{planDailySize},</if>
|
||||
<if test="ratioMorning != null">#{ratioMorning},</if>
|
||||
<if test="ratioNoon != null">#{ratioNoon},</if>
|
||||
<if test="ratioAfternoon != null">#{ratioAfternoon},</if>
|
||||
<if test="planMorningSize != null">#{planMorningSize},</if>
|
||||
<if test="planMorningTotal != null">#{planMorningTotal},</if>
|
||||
<if test="actualMorningSize != null">#{actualMorningSize},</if>
|
||||
<if test="planNoonSize != null">#{planNoonSize},</if>
|
||||
<if test="planNoonTotal != null">#{planNoonTotal},</if>
|
||||
<if test="actualNoonSize != null">#{actualNoonSize},</if>
|
||||
<if test="planAfternoonSize != null">#{planAfternoonSize},</if>
|
||||
<if test="planAfternoonTotal != null">#{planAfternoonTotal},</if>
|
||||
<if test="actualAfternoonSize != null">#{actualAfternoonSize},</if>
|
||||
<if test="planFeedTotal != null">#{planFeedTotal},</if>
|
||||
<if test="zookeeper != null">#{zookeeper},</if>
|
||||
<if test="planDate != null">#{planDate},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedPlan" parameterType="SgFeedPlan">
|
||||
update sg_feed_plan
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="formulaId != null and formulaId != ''">formula_id = #{formulaId},</if>
|
||||
<if test="batchId != null and batchId != ''">batch_id = #{batchId},</if>
|
||||
<if test="sheepHouseId != null">sheep_house_id = #{sheepHouseId},</if>
|
||||
<if test="sheepCount != null">sheep_count = #{sheepCount},</if>
|
||||
<if test="planDailySize != null">plan_daily_size = #{planDailySize},</if>
|
||||
<if test="ratioMorning != null">ratio_morning = #{ratioMorning},</if>
|
||||
<if test="ratioNoon != null">ratio_noon = #{ratioNoon},</if>
|
||||
<if test="ratioAfternoon != null">ratio_afternoon = #{ratioAfternoon},</if>
|
||||
<if test="planMorningSize != null">plan_morning_size = #{planMorningSize},</if>
|
||||
<if test="planMorningTotal != null">plan_morning_total = #{planMorningTotal},</if>
|
||||
<if test="actualMorningSize != null">actual_morning_size = #{actualMorningSize},</if>
|
||||
<if test="planNoonSize != null">plan_noon_size = #{planNoonSize},</if>
|
||||
<if test="planNoonTotal != null">plan_noon_total = #{planNoonTotal},</if>
|
||||
<if test="actualNoonSize != null">actual_noon_size = #{actualNoonSize},</if>
|
||||
<if test="planAfternoonSize != null">plan_afternoon_size = #{planAfternoonSize},</if>
|
||||
<if test="planAfternoonTotal != null">plan_afternoon_total = #{planAfternoonTotal},</if>
|
||||
<if test="actualAfternoonSize != null">actual_afternoon_size = #{actualAfternoonSize},</if>
|
||||
<if test="planFeedTotal != null">plan_feed_total = #{planFeedTotal},</if>
|
||||
<if test="zookeeper != null">zookeeper = #{zookeeper},</if>
|
||||
<if test="planDate != null">plan_date = #{planDate},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where create_date = #{createDate}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedPlanByCreateDate" parameterType="Date">
|
||||
delete from sg_feed_plan where create_date = #{createDate}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedPlanByCreateDates" parameterType="String">
|
||||
delete from sg_feed_plan where create_date in
|
||||
<foreach item="createDate" collection="array" open="(" separator="," close=")">
|
||||
#{createDate}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectSheepCountByFoldId" parameterType="Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM bas_sheep
|
||||
WHERE sheepfold_id = #{foldId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?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.feed.mapper.SgFormulaListMapper">
|
||||
|
||||
<resultMap type="SgFormulaList" id="SgFormulaListResult">
|
||||
<result property="code" column="code" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="ratio" column="ratio" />
|
||||
<result property="isGranular" column="is_granular" />
|
||||
<result property="isSupplement" column="is_supplement" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFormulaListVo">
|
||||
select code, formula_id, material_id, material_name, ratio, is_granular, is_supplement from sg_formula_list
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFormulaListList" parameterType="SgFormulaList" resultMap="SgFormulaListResult">
|
||||
<include refid="selectSgFormulaListVo"/>
|
||||
<where>
|
||||
<if test="materialId != null and materialId != ''">material_id = #{materialId}</if>
|
||||
<if test="formulaId != null and formulaId != ''">and formula_id = #{formulaId}</if>
|
||||
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFormulaListByCode" parameterType="Long" resultMap="SgFormulaListResult">
|
||||
<include refid="selectSgFormulaListVo"/>
|
||||
where code = #{code}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFormulaList" parameterType="SgFormulaList">
|
||||
insert into sg_formula_list
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">code,</if>
|
||||
<if test="formulaId != null">formula_id,</if>
|
||||
<if test="batchId != null">batch_id,</if>
|
||||
<if test="materialId != null">material_id,</if>
|
||||
<if test="materialName != null">material_name,</if>
|
||||
<if test="ratio != null">ratio,</if>
|
||||
<if test="isGranular != null">is_granular,</if>
|
||||
<if test="isSupplement != null">is_supplement,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="formulaId != null">#{formulaId},</if>
|
||||
<if test="batchId != null">#{batchId},</if>
|
||||
<if test="materialId != null">#{materialId},</if>
|
||||
<if test="materialName != null">#{materialName},</if>
|
||||
<if test="ratio != null">#{ratio},</if>
|
||||
<if test="isGranular != null">#{isGranular},</if>
|
||||
<if test="isSupplement != null">#{isSupplement},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFormulaList" parameterType="SgFormulaList">
|
||||
update sg_formula_list
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="formulaId != null">formula_id = #{formulaId},</if>
|
||||
<if test="materialId != null">material_id = #{materialId},</if>
|
||||
<if test="materialName != null">material_name = #{materialName},</if>
|
||||
<if test="ratio != null">ratio = #{ratio},</if>
|
||||
<if test="isGranular != null">is_granular = #{isGranular},</if>
|
||||
<if test="isSupplement != null">is_supplement = #{isSupplement},</if>
|
||||
</trim>
|
||||
where code = #{code}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFormulaListByCode" parameterType="Long">
|
||||
delete from sg_formula_list where code = #{code}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFormulaListByCodes" parameterType="String">
|
||||
delete from sg_formula_list where code in
|
||||
<foreach item="code" collection="array" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFormulaListByFormulaIdAndBatchId" parameterType="SgFormulaList">
|
||||
DELETE FROM sg_formula_list WHERE formula_id = #{formulaId} AND batch_id = #{batchId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?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.feed.mapper.SgFormulaManagementMapper">
|
||||
|
||||
<resultMap type="SgFormulaManagement" id="SgFormulaManagementResult">
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="feedStage" column="feed_stage" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="useStartDate" column="use_start_date" />
|
||||
<result property="useEndDate" column="use_end_date" />
|
||||
<result property="useState" column="use_state" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFormulaManagementVo">
|
||||
select formula_id, feed_stage, batch_id, use_start_date, use_end_date, use_state, remark from sg_formula_management
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement" resultMap="SgFormulaManagementResult">
|
||||
<include refid="selectSgFormulaManagementVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="feedStage != null and feedStage != ''"> and feed_stage = #{feedStage}</if>
|
||||
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFormulaManagementByFormulaId" parameterType="String" resultMap="SgFormulaManagementResult">
|
||||
<include refid="selectSgFormulaManagementVo"/>
|
||||
where formula_id = #{formulaId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFormulaManagement" parameterType="SgFormulaManagement">
|
||||
insert into sg_formula_management
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="formulaId != null and formulaId != ''">formula_id,</if>
|
||||
<if test="feedStage != null and feedStage != ''">feed_stage,</if>
|
||||
<if test="batchId != null">batch_id,</if>
|
||||
<if test="useStartDate != null">use_start_date,</if>
|
||||
<if test="useEndDate != null">use_end_date,</if>
|
||||
<if test="useState != null">use_state,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
<if test="feedStage != null and feedStage != ''">#{feedStage},</if>
|
||||
<if test="batchId != null">#{batchId},</if>
|
||||
<if test="useStartDate != null">#{useStartDate},</if>
|
||||
<if test="useEndDate != null">#{useEndDate},</if>
|
||||
<if test="useState != null">#{useState},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFormulaManagement" parameterType="SgFormulaManagement">
|
||||
update sg_formula_management
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="feedStage != null and feedStage != ''">feed_stage = #{feedStage},</if>
|
||||
<if test="useStartDate != null">use_start_date = #{useStartDate},</if>
|
||||
<if test="useEndDate != null">use_end_date = #{useEndDate},</if>
|
||||
<if test="useState != null">use_state = #{useState},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where formula_id = #{formulaId} AND batch_id = #{batchId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFormulaManagementByFormulaId" parameterType="String">
|
||||
delete from sg_formula_management where formula_id = #{formulaId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFormulaManagementByFormulaIds" parameterType="String">
|
||||
delete from sg_formula_management where formula_id in
|
||||
<foreach item="formulaId" collection="array" open="(" separator="," close=")">
|
||||
#{formulaId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteSgFormulaManagement" parameterType="SgFormulaManagement">
|
||||
delete from sg_formula_management where formula_id = #{formulaId} and batch_id = #{batchId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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.feed.mapper.SgMaterialMapper">
|
||||
|
||||
<resultMap type="SgMaterial" id="SgMaterialResult">
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="isGranular" column="is_granular" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgMaterialVo">
|
||||
select material_id, material_name, is_granular from sg_material
|
||||
</sql>
|
||||
|
||||
<select id="selectSgMaterialList" parameterType="SgMaterial" resultMap="SgMaterialResult">
|
||||
<include refid="selectSgMaterialVo"/>
|
||||
<where>
|
||||
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
<if test="isGranular != null "> and is_granular = #{isGranular}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgMaterialByMaterialId" parameterType="String" resultMap="SgMaterialResult">
|
||||
<include refid="selectSgMaterialVo"/>
|
||||
where material_id = #{materialId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgMaterial" parameterType="SgMaterial">
|
||||
insert into sg_material
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="materialId != null">material_id,</if>
|
||||
<if test="materialName != null and materialName != ''">material_name,</if>
|
||||
<if test="isGranular != null">is_granular,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="materialId != null">#{materialId},</if>
|
||||
<if test="materialName != null and materialName != ''">#{materialName},</if>
|
||||
<if test="isGranular != null">#{isGranular},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgMaterial" parameterType="SgMaterial">
|
||||
update sg_material
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
|
||||
<if test="isGranular != null">is_granular = #{isGranular},</if>
|
||||
</trim>
|
||||
where material_id = #{materialId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgMaterialByMaterialId" parameterType="String">
|
||||
delete from sg_material where material_id = #{materialId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgMaterialByMaterialIds" parameterType="String">
|
||||
delete from sg_material where material_id in
|
||||
<foreach item="materialId" collection="array" open="(" separator="," close=")">
|
||||
#{materialId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -8,6 +8,18 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="sheepfoldId" column="sheepfold_id"/>
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="variety_name"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="sheepTypeName" column="sheep_type_name"/>
|
||||
<result property="measureDate" column="measure_date"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="birthWeight" column="birth_weight"/>
|
||||
<result property="weaningWeight" column="weaning_weight"/>
|
||||
<result property="currentWeight" column="current_weight"/>
|
||||
<result property="height" column="height"/>
|
||||
<result property="bust" column="bust"/>
|
||||
<result property="bodyLength" column="body_length"/>
|
||||
@@ -18,6 +30,10 @@
|
||||
<result property="rumpHeignt" column="rump_heignt"/>
|
||||
<result property="hipWidth" column="hip_width"/>
|
||||
<result property="hipCrossHeight" column="hip_cross_height"/>
|
||||
<result property="breedStatusName" column="breed_status_name"/>
|
||||
<result property="lactationDay" column="lactation_day"/>
|
||||
<result property="gestationDay" column="gestation_day"/>
|
||||
<result property="postMatingDay" column="post_mating_day"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@@ -28,6 +44,18 @@
|
||||
select sm.id,
|
||||
sm.sheep_id,
|
||||
bs.manage_tags,
|
||||
ds.id as sheepfold_id,
|
||||
ds.sheepfold_name,
|
||||
bsv.id as variety_id,
|
||||
bsv.variety as variety_name,
|
||||
'体尺测量' as event_type,
|
||||
bst.name as sheep_type_name,
|
||||
sm.measure_date,
|
||||
bs.gender,
|
||||
bs.parity,
|
||||
bs.birth_weight as birth_weight,
|
||||
bs.weaning_weight as weaning_weight,
|
||||
bs.current_weight as current_weight,
|
||||
sm.height,
|
||||
sm.bust,
|
||||
sm.body_length,
|
||||
@@ -38,21 +66,38 @@
|
||||
sm.rump_heignt,
|
||||
sm.hip_width,
|
||||
sm.hip_cross_height,
|
||||
bbs.breed as breed_status_name,
|
||||
bs.lactation_day as lactation_day,
|
||||
bs.gestation_day as gestation_day,
|
||||
case when bs.mating_date is not null
|
||||
then DATEDIFF(NOW(), bs.mating_date)
|
||||
else null
|
||||
end as post_mating_day,
|
||||
sm.comment,
|
||||
sm.technician,
|
||||
sm.create_by,
|
||||
sm.create_time
|
||||
from sc_body_measure sm
|
||||
left join bas_sheep bs on sm.sheep_id = bs.id
|
||||
LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id
|
||||
LEFT JOIN bas_breed_status bbs ON bs.breed_status_id = bbs.id
|
||||
LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.id
|
||||
LEFT JOIN bas_sheep_type bst ON bs.type_id = bst.id
|
||||
LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScBodyMeasureList" parameterType="ScBodyMeasure" resultMap="ScBodyMeasureResult">
|
||||
<include refid="selectScBodyMeasureVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null ">and sm.sheep_id = #{sheepId}</if>
|
||||
<if test="params.beginMeasureDate != null and params.endMeasureDate != null">
|
||||
and sm.measure_date between #{params.beginMeasureDate} and #{params.endMeasureDate}
|
||||
</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="sheepfoldId != null">AND bs.sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="varietyId != null">AND bsv.id = #{varietyId}</if>
|
||||
<if test="sheepTypeId != null">and bs.type_id = #{sheepTypeId}</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
@@ -68,6 +113,7 @@
|
||||
insert into sc_body_measure
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="measureDate != null">measure_date,</if>
|
||||
<if test="height != null">height,</if>
|
||||
<if test="bust != null">bust,</if>
|
||||
<if test="bodyLength != null">body_length,</if>
|
||||
@@ -85,6 +131,7 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="measureDate != null">#{measureDate},</if>
|
||||
<if test="height != null">#{height},</if>
|
||||
<if test="bust != null">#{bust},</if>
|
||||
<if test="bodyLength != null">#{bodyLength},</if>
|
||||
@@ -106,6 +153,7 @@
|
||||
update sc_body_measure
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="measureDate != null">measure_date = #{measureDate},</if>
|
||||
<if test="height != null">height = #{height},</if>
|
||||
<if test="bust != null">bust = #{bust},</if>
|
||||
<if test="bodyLength != null">body_length = #{bodyLength},</if>
|
||||
|
||||
@@ -8,9 +8,13 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="varietyId" column="varietyId"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="datetime" column="datetime"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@@ -21,9 +25,11 @@
|
||||
select sbs.id,
|
||||
sbs.sheep_id,
|
||||
bs.manage_tags,
|
||||
bsv.id as varietyId,
|
||||
bsv.variety as varietyName,
|
||||
'体况评分' as event_type,
|
||||
sbs.datetime,
|
||||
sbs.score,
|
||||
sbs.sheepfold,
|
||||
ds.sheepfold_name as sheepfoldName,
|
||||
sbs.comment,
|
||||
sbs.technician,
|
||||
@@ -31,18 +37,20 @@
|
||||
sbs.create_time
|
||||
from sc_body_score sbs
|
||||
left join bas_sheep bs on sbs.sheep_id = bs.id
|
||||
left join da_sheepfold ds on sbs.sheepfold = ds.id
|
||||
left join da_sheepfold ds on bs.sheepfold_id = ds.id
|
||||
left join bas_sheep_variety bsv on bs.variety_id = bsv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScBodyScoreList" parameterType="ScBodyScore" resultMap="ScBodyScoreResult">
|
||||
<include refid="selectScBodyScoreVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null and sheepId != ''">and sbs.sheep_id = #{sheepId}</if>
|
||||
<if test="varietyId != null">and bsv.id = #{varietyId}</if>
|
||||
<if test="sheepfold != null">and bs.sheepfold_id = #{sheepfold}</if>
|
||||
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''">
|
||||
and sbs.datetime between #{params.beginDatetime} and #{params.endDatetime}
|
||||
</if>
|
||||
<if test="score != null ">and score = #{score}</if>
|
||||
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and sbs.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="varietyId" column="varietyId"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="eventDate" column="event_date"/>
|
||||
<result property="sheepfoldId" column="sheepfoldId"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="depth" column="depth"/>
|
||||
<result property="length" column="length"/>
|
||||
<result property="position" column="position"/>
|
||||
@@ -22,9 +28,17 @@
|
||||
|
||||
<sql id="selectScBreastRatingVo">
|
||||
select sbr.*,
|
||||
bs.manage_tags as manageTags
|
||||
bs.manage_tags as manageTags,
|
||||
bsv.id as varietyId,
|
||||
bsv.variety as varietyName,
|
||||
'乳房评分' as event_type,
|
||||
sf.id as sheepfoldId,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sbr.event_date
|
||||
from sc_breast_rating sbr
|
||||
left join bas_sheep bs on sbr.sheep_id = bs.id
|
||||
left join bas_sheep_variety bsv on bs.variety_id = bsv.id
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreastRatingList" parameterType="ScBreastRating" resultMap="ScBreastRatingResult">
|
||||
@@ -33,6 +47,11 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="varietyId != null">and bsv.id = #{varietyId}</if>
|
||||
<if test="sheepfoldId != null">and sf.id = #{sheepfoldId}</if>
|
||||
<if test="params.beginEventDate != null and params.endEventDate != null">
|
||||
and sbr.event_date between #{params.beginEventDate} and #{params.endEventDate}
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
@@ -48,6 +67,7 @@
|
||||
insert into sc_breast_rating
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="eventDate != null">event_date,</if>
|
||||
<if test="depth != null">depth,</if>
|
||||
<if test="length != null">length,</if>
|
||||
<if test="position != null">position,</if>
|
||||
@@ -61,6 +81,7 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="eventDate != null">#{eventDate},</if>
|
||||
<if test="depth != null">#{depth},</if>
|
||||
<if test="length != null">#{length},</if>
|
||||
<if test="position != null">#{position},</if>
|
||||
@@ -78,6 +99,7 @@
|
||||
update sc_breast_rating
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="eventDate != null">event_date = #{eventDate},</if>
|
||||
<if test="depth != null">depth = #{depth},</if>
|
||||
<if test="length != null">length = #{length},</if>
|
||||
<if test="position != null">position = #{position},</if>
|
||||
|
||||
@@ -34,8 +34,14 @@
|
||||
<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="planDate != null"> and DATE(plan_date) = DATE(#{planDate})</if>
|
||||
<if test="status != null"> and status = #{status}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
and DATE(plan_date) >= DATE(#{params.beginTime})
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
and DATE(plan_date) <= DATE(#{params.endTime})
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
@@ -48,63 +54,72 @@
|
||||
<!-- 筛选符合条件的母羊 -->
|
||||
<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)
|
||||
bs.id,
|
||||
bs.manage_tags as bs_manage_tags,
|
||||
bv.variety as variety,
|
||||
bs.family,
|
||||
bst.name as sheep_type,
|
||||
bs.gender,
|
||||
TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) as month_age,
|
||||
bs.current_weight,
|
||||
bs.post_lambing_day,
|
||||
bbs.breed as breed,
|
||||
bs.parity,
|
||||
dsf.sheepfold_name,
|
||||
bs.comment,
|
||||
CASE WHEN bs.is_core = 1 THEN '是' ELSE '否' END as is_core,
|
||||
CASE WHEN bs.is_breeding = 1 THEN '是' ELSE '否' END as is_breeding,
|
||||
CONCAT('胎次:', IFNULL(bs.parity, 0), ' 配种次数:', IFNULL(bs.mating_counts, 0)) as reproduction_info
|
||||
from bas_sheep bs
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
left join bas_sheep_type bst on bs.type_id = bst.id
|
||||
left join bas_breed_status bbs on bs.breed_status_id = bbs.id
|
||||
left join da_sheepfold dsf on bs.sheepfold_id = dsf.id
|
||||
where bs.gender = 1
|
||||
and bs.is_delete = 0
|
||||
and (bs.status_id = 1 or bs.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)
|
||||
(bst.name in ('青年羊', '超龄羊') and (
|
||||
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 7.5 and bs.current_weight >= 33) or
|
||||
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50) or
|
||||
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50)
|
||||
))
|
||||
or
|
||||
-- 泌乳羊或种母羊的配种条件
|
||||
(sf.name in ('泌乳羊', '种母羊') and sf.post_lambing_day > 45 and sf.current_weight > 0)
|
||||
(bst.name in ('泌乳羊', '种母羊') and bs.post_lambing_day > 45 and bs.current_weight > 0)
|
||||
)
|
||||
order by sf.variety, sf.month_age desc
|
||||
order by bv.variety, TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) desc
|
||||
</select>
|
||||
|
||||
<!-- 筛选符合条件的公羊 -->
|
||||
<select id="selectEligibleRam" resultType="Map">
|
||||
select
|
||||
sf.id,
|
||||
sf.manage_tags as bs_manage_tags,
|
||||
bs.id,
|
||||
bs.manage_tags as bs_manage_tags,
|
||||
bv.variety as variety,
|
||||
bs.family,
|
||||
bst.name as sheep_type,
|
||||
sf.gender,
|
||||
TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) as month_age,
|
||||
sf.current_weight,
|
||||
bs.gender,
|
||||
bs.birthday,
|
||||
TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) as month_age,
|
||||
bs.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
|
||||
from bas_sheep bs
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
left join bas_sheep_type bst on bs.type_id = bst.id
|
||||
left join bas_breed_status bbs on bs.breed_status_id = bbs.id
|
||||
where bs.gender = 2
|
||||
and bs.is_delete = 0
|
||||
and bs.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)
|
||||
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 7.5 and bs.current_weight >= 33) or
|
||||
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50) or
|
||||
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50)
|
||||
))
|
||||
or
|
||||
-- 其他类型公羊
|
||||
bst.name not in ('青年羊', '超龄羊')
|
||||
)
|
||||
order by bv.variety, TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) desc
|
||||
order by bv.variety, TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) desc
|
||||
</select>
|
||||
|
||||
<insert id="insertScBreedPlanGenerate" parameterType="ScBreedPlanGenerate" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -176,25 +191,110 @@
|
||||
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
|
||||
-- 母羊完整信息
|
||||
ewe.manage_tags as ewe_manage_tags,
|
||||
ewe_variety.variety as ewe_variety,
|
||||
ewe.family as ewe_family,
|
||||
ewe_type.name as ewe_sheep_type,
|
||||
ewe_breed.breed as ewe_breed_status,
|
||||
ewe.parity as ewe_parity,
|
||||
TIMESTAMPDIFF(MONTH, ewe.birthday, NOW()) as ewe_month_age,
|
||||
ewe.current_weight as ewe_current_weight,
|
||||
CASE WHEN ewe.is_core = 1 THEN 1 ELSE 0 END as ewe_is_core,
|
||||
CASE WHEN ewe.is_breeding = 1 THEN 1 ELSE 0 END as ewe_is_breeding,
|
||||
ewe_sheepfold.sheepfold_name as ewe_sheepfold_name,
|
||||
ewe.comment as ewe_comment,
|
||||
CONCAT('胎次:', IFNULL(ewe.parity, 0), ' 配种次数:', IFNULL(ewe.mating_counts, 0)) as ewe_reproduction_info,
|
||||
-- 公羊完整信息 - 直接关联查询耳号
|
||||
ram.manage_tags as ram_manage_tags,
|
||||
ram_variety.variety as ram_variety,
|
||||
ram.family as ram_family,
|
||||
ram_type.name as ram_sheep_type,
|
||||
ram.birthday as ram_birthday,
|
||||
TIMESTAMPDIFF(MONTH, ram.birthday, NOW()) as ram_month_age,
|
||||
ram.current_weight as ram_current_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
|
||||
left join bas_sheep ewe on ewe.id = CAST(temp.ewe_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ewe_variety on ewe.variety_id = ewe_variety.id
|
||||
left join bas_sheep_type ewe_type on ewe.type_id = ewe_type.id
|
||||
left join bas_breed_status ewe_breed on ewe.breed_status_id = ewe_breed.id
|
||||
left join da_sheepfold ewe_sheepfold on ewe.sheepfold_id = ewe_sheepfold.id
|
||||
left join bas_sheep ram on ram.id = CAST(temp.ram_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ram_variety on ram.variety_id = ram_variety.id
|
||||
left join bas_sheep_type ram_type on ram.type_id = ram_type.id
|
||||
where temp.plan_generate_id = #{planGenerateId}
|
||||
order by temp.ram_id, temp.ewe_id
|
||||
order by temp.ewe_id, temp.ram_id
|
||||
</select>
|
||||
|
||||
<!-- 获取审批详情 - 包含完整的母羊和公羊信息 -->
|
||||
<select id="selectApproveBreedPlanDetails" parameterType="Long" resultType="Map">
|
||||
select
|
||||
temp.id,
|
||||
temp.ram_id,
|
||||
temp.ewe_id,
|
||||
temp.breed_type,
|
||||
-- 母羊信息
|
||||
ewe.manage_tags as ewe_manage_tags,
|
||||
ewe_variety.variety as ewe_variety,
|
||||
ewe.family as ewe_family,
|
||||
ewe_type.name as ewe_sheep_type,
|
||||
ewe_breed.breed as ewe_breed_status,
|
||||
ewe.parity as ewe_parity,
|
||||
TIMESTAMPDIFF(MONTH, ewe.birthday, NOW()) as ewe_month_age,
|
||||
ewe.current_weight as ewe_current_weight,
|
||||
CASE WHEN ewe.is_core = 1 THEN 1 ELSE 0 END as ewe_is_core,
|
||||
CASE WHEN ewe.is_breeding = 1 THEN 1 ELSE 0 END as ewe_is_breeding,
|
||||
ewe_sheepfold.sheepfold_name as ewe_sheepfold_name,
|
||||
ewe.comment as ewe_comment,
|
||||
CONCAT('胎次:', IFNULL(ewe.parity, 0), ' 配种次数:', IFNULL(ewe.mating_counts, 0)) as ewe_reproduction_info,
|
||||
-- 公羊信息 - 直接关联查询耳号
|
||||
ram.manage_tags as ram_manage_tags,
|
||||
ram_variety.variety as ram_variety,
|
||||
ram.family as ram_family,
|
||||
ram_type.name as ram_sheep_type,
|
||||
ram.birthday as ram_birthday,
|
||||
TIMESTAMPDIFF(MONTH, ram.birthday, NOW()) as ram_month_age,
|
||||
ram.current_weight as ram_current_weight
|
||||
from sc_breed_plan_temp temp
|
||||
left join bas_sheep ewe on ewe.id = CAST(temp.ewe_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ewe_variety on ewe.variety_id = ewe_variety.id
|
||||
left join bas_sheep_type ewe_type on ewe.type_id = ewe_type.id
|
||||
left join bas_breed_status ewe_breed on ewe.breed_status_id = ewe_breed.id
|
||||
left join da_sheepfold ewe_sheepfold on ewe.sheepfold_id = ewe_sheepfold.id
|
||||
left join bas_sheep ram on ram.id = CAST(temp.ram_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ram_variety on ram.variety_id = ram_variety.id
|
||||
left join bas_sheep_type ram_type on ram.type_id = ram_type.id
|
||||
where temp.plan_generate_id = #{planGenerateId}
|
||||
order by temp.ewe_id, temp.ram_id
|
||||
</select>
|
||||
|
||||
<!-- 更新临时配种计划 -->
|
||||
<update id="updateTempBreedPlan">
|
||||
update sc_breed_plan_temp
|
||||
<set>
|
||||
<if test="ramId != null">
|
||||
ram_id = #{ramId},
|
||||
</if>
|
||||
<if test="ramId == null">
|
||||
ram_id = null,
|
||||
</if>
|
||||
<if test="breedType != null">
|
||||
breed_type = #{breedType},
|
||||
</if>
|
||||
<if test="breedType == null">
|
||||
breed_type = null,
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScBreedPlanGenerateById" parameterType="Long">
|
||||
delete from sc_breed_plan_generate where id = #{id}
|
||||
</delete>
|
||||
@@ -205,4 +305,9 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 删除临时配种计划 -->
|
||||
<delete id="deleteTempBreedPlanByPlanId" parameterType="Long">
|
||||
delete from sc_breed_plan_temp where plan_generate_id = #{planGenerateId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -11,9 +11,10 @@
|
||||
<result property="eweId" column="ewe_id" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="breedDrugs" column="breed_drugs" />
|
||||
<result property="breedType" column="breed_type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<!-- 新增显示字段 -->
|
||||
<!-- 显示字段 -->
|
||||
<result property="eweManageTags" column="ewe_manage_tags" />
|
||||
<result property="eweVariety" column="ewe_variety" />
|
||||
<result property="ramManageTags" column="ram_manage_tags" />
|
||||
@@ -29,6 +30,16 @@
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="matingCount" column="mating_count" />
|
||||
<result property="timeSincePlanning" column="time_since_planning" />
|
||||
<!-- 孕检相关字段 -->
|
||||
<result property="pregnancyCheckDate" column="pregnancy_check_date" />
|
||||
<result property="pregnancyResult" column="pregnancy_result" />
|
||||
<result property="pregnancyWay" column="pregnancy_way" />
|
||||
<result property="fetusCount" column="fetus_count" />
|
||||
<result property="pregnancyTechnician" column="pregnancy_technician" />
|
||||
<result property="pregnancyRemark" column="pregnancy_remark" />
|
||||
<result property="pregnancyRecordId" column="pregnancy_record_id" />
|
||||
<result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />
|
||||
<result property="isPregnancyChecked" column="is_pregnancy_checked" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBreedRecordVo">
|
||||
@@ -39,6 +50,7 @@
|
||||
br.ewe_id,
|
||||
br.technician,
|
||||
br.breed_drugs,
|
||||
br.breed_type,
|
||||
br.create_by,
|
||||
br.create_time,
|
||||
-- 母羊信息(从视图获取)
|
||||
@@ -56,13 +68,45 @@
|
||||
-- 公羊信息(从视图获取)
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
ram_view.variety as ram_variety,
|
||||
-- 配种方式(如果视图中没有,设为空或从其他地方获取)
|
||||
'' as mating_type,
|
||||
-- 配种方式显示
|
||||
CASE br.breed_type
|
||||
WHEN 1 THEN '同期发情'
|
||||
WHEN 2 THEN '本交'
|
||||
ELSE '未知'
|
||||
END as mating_type,
|
||||
-- 发情后配种时间(小时数)
|
||||
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning
|
||||
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning,
|
||||
-- 孕检相关信息
|
||||
pr.datetime as pregnancy_check_date,
|
||||
pr.result as pregnancy_result,
|
||||
pr.way as pregnancy_way,
|
||||
pr.fetus_count,
|
||||
pr.technician as pregnancy_technician,
|
||||
pr.remark as pregnancy_remark,
|
||||
pr.id as pregnancy_record_id,
|
||||
-- 配种到孕检间隔天数
|
||||
CASE
|
||||
WHEN pr.datetime IS NOT NULL THEN DATEDIFF(pr.datetime, br.create_time)
|
||||
ELSE NULL
|
||||
END as days_to_pregnancy_check,
|
||||
-- 是否已孕检
|
||||
CASE
|
||||
WHEN pr.id IS NOT NULL THEN 1
|
||||
ELSE 0
|
||||
END as is_pregnancy_checked
|
||||
from sc_breed_record br
|
||||
left join sheep_file ewe_view on br.ewe_id = ewe_view.id
|
||||
left join sheep_file ram_view on br.ram_id = ram_view.id
|
||||
left join sc_pregnancy_record pr on pr.sheep_id = br.ewe_id
|
||||
and pr.is_delete = 0
|
||||
and pr.datetime >= br.create_time
|
||||
and pr.datetime = (
|
||||
select min(pr2.datetime)
|
||||
from sc_pregnancy_record pr2
|
||||
where pr2.sheep_id = br.ewe_id
|
||||
and pr2.is_delete = 0
|
||||
and pr2.datetime >= br.create_time
|
||||
)
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">
|
||||
@@ -71,6 +115,7 @@
|
||||
<if test="sheepId != null "> and br.sheep_id = #{sheepId}</if>
|
||||
<if test="ramId != null and ramId != ''"> and br.ram_id = #{ramId}</if>
|
||||
<if test="eweId != null and eweId != ''"> and br.ewe_id = #{eweId}</if>
|
||||
<if test="breedType != null"> and br.breed_type = #{breedType}</if>
|
||||
<if test="technician != null and technician != ''"> and br.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="breedDrugs != null and breedDrugs != ''"> and br.breed_drugs like concat('%', #{breedDrugs}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and br.create_by like concat('%', #{createBy}, '%')</if>
|
||||
@@ -81,6 +126,12 @@
|
||||
<if test="eweVariety != null and eweVariety != ''"> and ewe_view.variety like concat('%', #{eweVariety}, '%')</if>
|
||||
<if test="ramVariety != null and ramVariety != ''"> and ram_view.variety like concat('%', #{ramVariety}, '%')</if>
|
||||
<if test="ranchId != null"> and ewe_view.ranch_id = #{ranchId}</if>
|
||||
<!-- 孕检相关查询条件 -->
|
||||
<if test="pregnancyResult != null and pregnancyResult != ''"> and pr.result like concat('%', #{pregnancyResult}, '%')</if>
|
||||
<if test="isPregnancyChecked != null">
|
||||
<if test="isPregnancyChecked == 1"> and pr.id IS NOT NULL</if>
|
||||
<if test="isPregnancyChecked == 0"> and pr.id IS NULL</if>
|
||||
</if>
|
||||
</where>
|
||||
order by br.create_time desc
|
||||
</select>
|
||||
@@ -170,19 +221,43 @@
|
||||
ewe_view.bs_manage_tags as ewe_manage_tags,
|
||||
bp.ram_id,
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
bp.plan_date,
|
||||
bp.breed_type,
|
||||
bp.technician,
|
||||
bp.status,
|
||||
bp.create_time as plan_create_time,
|
||||
TIMESTAMPDIFF(HOUR, bp.create_time, NOW()) as hours_since_plan
|
||||
CASE bp.breed_type
|
||||
WHEN 1 THEN '同期发情'
|
||||
WHEN 2 THEN '本交'
|
||||
ELSE '未知'
|
||||
END as breed_type_name,
|
||||
TIMESTAMPDIFF(HOUR, NOW(), NOW()) as hours_since_plan
|
||||
from sc_breed_plan bp
|
||||
left join sheep_file ewe_view on bp.ewe_id = ewe_view.id
|
||||
left join sheep_file ram_view on bp.ram_id = ram_view.id
|
||||
where ewe_view.bs_manage_tags = #{manageTags}
|
||||
and bp.status = '待配种'
|
||||
and bp.is_delete = 0
|
||||
order by bp.create_time desc
|
||||
order by bp.id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 根据母羊耳号获取最新的配种计划信息(从配种计划生成表) -->
|
||||
<select id="getLatestBreedPlanByEweTags" parameterType="String" resultType="map">
|
||||
select
|
||||
bpg.id as plan_generate_id,
|
||||
bpt.ewe_id,
|
||||
ewe_view.bs_manage_tags as ewe_manage_tags,
|
||||
bpt.ram_id,
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
bpt.breed_type,
|
||||
CASE bpt.breed_type
|
||||
WHEN 1 THEN '同期发情'
|
||||
WHEN 2 THEN '本交'
|
||||
ELSE '未知'
|
||||
END as breed_type_name,
|
||||
bpg.create_time as plan_create_time
|
||||
from sc_breed_plan_generate bpg
|
||||
inner join sc_breed_plan_temp bpt on bpg.id = bpt.plan_generate_id
|
||||
left join sheep_file ewe_view on bpt.ewe_id = ewe_view.id
|
||||
left join sheep_file ram_view on bpt.ram_id = ram_view.id
|
||||
where ewe_view.bs_manage_tags = #{manageTags}
|
||||
and bpg.status = 1 -- 已审批的计划
|
||||
order by bpg.create_time desc, bpt.id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
@@ -194,6 +269,7 @@
|
||||
<if test="eweId != null">ewe_id,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="breedDrugs != null">breed_drugs,</if>
|
||||
<if test="breedType != null">breed_type,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
@@ -203,6 +279,7 @@
|
||||
<if test="eweId != null">#{eweId},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="breedDrugs != null">#{breedDrugs},</if>
|
||||
<if test="breedType != null">#{breedType},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
@@ -216,6 +293,7 @@
|
||||
<if test="eweId != null">ewe_id = #{eweId},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="breedDrugs != null">breed_drugs = #{breedDrugs},</if>
|
||||
<if test="breedType != null">breed_type = #{breedType},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
@@ -232,4 +310,26 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据羊只ID和配种时间查询配种记录 -->
|
||||
<select id="selectBreedRecordByMatingTime" resultMap="ScBreedRecordResult">
|
||||
<include refid="selectScBreedRecordVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and br.ewe_id = #{sheepId}</if>
|
||||
<if test="matingDateStart != null and matingDateStart != ''">
|
||||
and br.create_time >= #{matingDateStart}
|
||||
</if>
|
||||
<if test="matingDateEnd != null and matingDateEnd != ''">
|
||||
and br.create_time <= #{matingDateEnd}
|
||||
</if>
|
||||
</where>
|
||||
order by br.create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 更新配种记录的孕检信息 -->
|
||||
<update id="updatePregnancyInfo">
|
||||
update sc_breed_record
|
||||
set pregnancy_record_id = #{pregnancyRecordId}
|
||||
where id = #{breedRecordId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -15,6 +15,7 @@
|
||||
<result property="score" column="score" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<!-- 修复:数据库字段是create_tme,不是create_time -->
|
||||
<result property="createTime" column="create_tme" />
|
||||
</resultMap>
|
||||
|
||||
@@ -66,42 +67,47 @@
|
||||
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,
|
||||
-- 从sheep_file视图获取母羊信息
|
||||
mother.bs_manage_tags as female_ear_number,
|
||||
mother.variety as female_breed,
|
||||
mother.month_age as month_age,
|
||||
mother.sheepfold_name as current_shed,
|
||||
mother.dr_ranch as farm,
|
||||
|
||||
-- 从sc_breed_record表获取配种信息
|
||||
br.create_time as breeding_date,
|
||||
DATEDIFF(lr.create_tme, br.create_time) as pregnancy_days,
|
||||
DATEDIFF(CURDATE(), br.create_time) as pregnancy_days,
|
||||
|
||||
-- 从bas_sheep表获取公羊信息
|
||||
father.manage_tags as male_ear_number,
|
||||
father.variety_id as male_breed,
|
||||
-- 从sheep_file视图获取公羊信息
|
||||
father.bs_manage_tags as male_ear_number,
|
||||
father.variety 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
|
||||
-- 统计羔羊信息(从sc_lamb_detail表统计)
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 1) as male_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 0) as female_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 1 AND sld.is_retained = 1) as retained_male_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 0 AND sld.is_retained = 1) as retained_female_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 1 AND sld.is_retained = 0) as unretained_male_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 0 AND sld.is_retained = 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
|
||||
LEFT JOIN sheep_file mother ON lr.sheep_id = mother.id
|
||||
LEFT JOIN sc_breed_record br ON lr.sheep_id = br.ewe_id AND br.create_time = (
|
||||
SELECT MAX(br2.create_time)
|
||||
FROM sc_breed_record br2
|
||||
WHERE br2.ewe_id = lr.sheep_id
|
||||
AND br2.create_time <= lr.create_tme
|
||||
)
|
||||
LEFT JOIN sheep_file 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="femaleEarNumber != null and femaleEarNumber != ''"> and mother.bs_manage_tags LIKE CONCAT('%', #{femaleEarNumber}, '%')</if>
|
||||
<if test="femaleBreed != null and femaleBreed != ''"> and mother.variety LIKE CONCAT('%', #{femaleBreed}, '%')</if>
|
||||
<if test="farm != null and farm != ''"> and mother.dr_ranch LIKE CONCAT('%', #{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>
|
||||
@@ -134,23 +140,29 @@
|
||||
where lr.id = #{id} and mother.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 查询羔羊详情(从sc_lamb_detail表查询) -->
|
||||
<select id="selectLambDetailByLambingRecordId" parameterType="Long" resultType="ScLambDetail">
|
||||
<!-- 根据母羊耳号查询最新配种记录 -->
|
||||
<select id="getLatestBreedingByEarNumber" parameterType="String" resultType="java.util.Map">
|
||||
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
|
||||
sf.id as sheep_id,
|
||||
sf.bs_manage_tags as female_ear_number,
|
||||
sf.variety as female_breed,
|
||||
sf.parity as parity,
|
||||
br.ram_id as ram_id,
|
||||
ram.bs_manage_tags as male_ear_number,
|
||||
ram.variety as male_breed,
|
||||
br.create_time as breeding_date,
|
||||
DATEDIFF(CURDATE(), br.create_time) as pregnancy_days,
|
||||
br.technician as technician
|
||||
FROM sheep_file sf
|
||||
LEFT JOIN sc_breed_record br ON sf.id = br.ewe_id
|
||||
LEFT JOIN sheep_file ram ON br.ram_id = ram.id
|
||||
WHERE sf.bs_manage_tags = #{earNumber}
|
||||
AND sf.is_delete = 0
|
||||
AND br.create_time = (
|
||||
SELECT MAX(br2.create_time)
|
||||
FROM sc_breed_record br2
|
||||
WHERE br2.ewe_id = sf.id
|
||||
)
|
||||
</select>
|
||||
|
||||
<!-- 新增产羔记录 -->
|
||||
@@ -191,8 +203,8 @@
|
||||
<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>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
<?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.ScSheepDeathMapper">
|
||||
|
||||
<resultMap type="ScSheepDeath" id="ScSheepDeathResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="manageTags" column="manage_tags" />
|
||||
<result property="eventType" column="event_type" />
|
||||
<result property="deathDate" column="death_date" />
|
||||
<result property="diseaseTypeId" column="disease_type_id" />
|
||||
<result property="diseaseSubtypeId" column="disease_subtype_id" />
|
||||
<result property="disposalDirection" column="disposal_direction" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="handler" column="handler" />
|
||||
<result property="workGroup" column="work_group" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScSheepDeathVo">
|
||||
select id, sheep_id, manage_tags, event_type, death_date, disease_type_id, disease_subtype_id, disposal_direction, technician, handler, work_group, create_by, create_time, comment, update_by, update_time, is_delete from sc_sheep_death
|
||||
</sql>
|
||||
|
||||
<select id="selectScSheepDeathList" parameterType="ScSheepDeath" resultMap="ScSheepDeathResult">
|
||||
<include refid="selectScSheepDeathVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
|
||||
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if>
|
||||
<if test="deathDate != null "> and death_date = #{deathDate}</if>
|
||||
<if test="diseaseTypeId != null "> and disease_type_id = #{diseaseTypeId}</if>
|
||||
<if test="diseaseSubtypeId != null "> and disease_subtype_id = #{diseaseSubtypeId}</if>
|
||||
<if test="disposalDirection != null and disposalDirection != ''"> and disposal_direction = #{disposalDirection}</if>
|
||||
<if test="technician != null and technician != ''"> and technician = #{technician}</if>
|
||||
<if test="handler != null and handler != ''"> and handler = #{handler}</if>
|
||||
<if test="workGroup != null and workGroup != ''"> and work_group = #{workGroup}</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScSheepDeathById" parameterType="Long" resultMap="ScSheepDeathResult">
|
||||
<include refid="selectScSheepDeathVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据管理耳号查询sheep_file视图信息 -->
|
||||
<select id="selectSheepFileByManageTags" parameterType="String" resultType="java.util.Map">
|
||||
select id as sheepId, variety, name as sheepType, gender, day_age as dayAge, parity, sheepfold_name as sheepfoldName, breed as breedStatus, post_lambing_day as postLambingDay, lactation_day as lactationDay, gestation_day as gestationDay
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertScSheepDeath" parameterType="ScSheepDeath" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_sheep_death
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="manageTags != null and manageTags != ''">manage_tags,</if>
|
||||
<if test="eventType != null">event_type,</if>
|
||||
<if test="deathDate != null">death_date,</if>
|
||||
<if test="diseaseTypeId != null">disease_type_id,</if>
|
||||
<if test="diseaseSubtypeId != null">disease_subtype_id,</if>
|
||||
<if test="disposalDirection != null">disposal_direction,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="handler != null">handler,</if>
|
||||
<if test="workGroup != null">work_group,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="manageTags != null and manageTags != ''">#{manageTags},</if>
|
||||
<if test="eventType != null">#{eventType},</if>
|
||||
<if test="deathDate != null">#{deathDate},</if>
|
||||
<if test="diseaseTypeId != null">#{diseaseTypeId},</if>
|
||||
<if test="diseaseSubtypeId != null">#{diseaseSubtypeId},</if>
|
||||
<if test="disposalDirection != null">#{disposalDirection},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="handler != null">#{handler},</if>
|
||||
<if test="workGroup != null">#{workGroup},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScSheepDeath" parameterType="ScSheepDeath">
|
||||
update sc_sheep_death
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="manageTags != null and manageTags != ''">manage_tags = #{manageTags},</if>
|
||||
<if test="eventType != null">event_type = #{eventType},</if>
|
||||
<if test="deathDate != null">death_date = #{deathDate},</if>
|
||||
<if test="diseaseTypeId != null">disease_type_id = #{diseaseTypeId},</if>
|
||||
<if test="diseaseSubtypeId != null">disease_subtype_id = #{diseaseSubtypeId},</if>
|
||||
<if test="disposalDirection != null">disposal_direction = #{disposalDirection},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="handler != null">handler = #{handler},</if>
|
||||
<if test="workGroup != null">work_group = #{workGroup},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</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="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScSheepDeathById" parameterType="Long">
|
||||
delete from sc_sheep_death where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScSheepDeathByIds" parameterType="String">
|
||||
delete from sc_sheep_death where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -18,6 +18,8 @@
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="typeId" column="type_id"/>
|
||||
<result property="typeName" column="type_name"/>
|
||||
<result property="joinDate" column="join_date"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
@@ -29,10 +31,12 @@
|
||||
SELECT
|
||||
sas.*,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
bv.variety AS varietyName
|
||||
bv.variety AS varietyName,
|
||||
st.type_name AS typeName
|
||||
FROM sc_add_sheep sas
|
||||
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
|
||||
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
|
||||
LEFT JOIN bas_sheep_type st ON sas.type_id = st.id
|
||||
<where>
|
||||
<if test="earNumber != null and earNumber != ''">
|
||||
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
|
||||
@@ -43,6 +47,9 @@
|
||||
<if test="varietyId != null">
|
||||
AND sas.variety_id = #{varietyId}
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
AND sas.type_id = #{typeId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -54,18 +61,19 @@
|
||||
|
||||
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO sc_add_sheep
|
||||
(ear_number, sheepfold, father, mother, born_weight, birthday,
|
||||
gender, parity, variety_id, join_date, comment, technician,
|
||||
create_by, create_time)
|
||||
VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight},
|
||||
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate},
|
||||
#{comment}, #{technician}, #{createBy}, #{createTime})
|
||||
(ear_number, sheepfold, ranch_id, father, mother, born_weight, birthday,
|
||||
gender, parity, variety_id, type_id, join_date, comment, technician,
|
||||
create_by, create_time)
|
||||
VALUES (#{earNumber}, #{sheepfold}, #{ranchId}, #{father}, #{mother}, #{bornWeight},
|
||||
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate},
|
||||
#{comment}, #{technician}, #{createBy}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<update id="updateScAddSheep" parameterType="ScAddSheep">
|
||||
UPDATE sc_add_sheep
|
||||
<set>
|
||||
ear_number = #{earNumber},
|
||||
ranch_id = #{ranchId},
|
||||
sheepfold = #{sheepfold},
|
||||
father = #{father},
|
||||
mother = #{mother},
|
||||
@@ -74,6 +82,7 @@
|
||||
gender = #{gender},
|
||||
parity = #{parity},
|
||||
variety_id = #{varietyId},
|
||||
type_id = #{typeId},
|
||||
join_date = #{joinDate},
|
||||
comment = #{comment},
|
||||
technician = #{technician},
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="newComment" column="new_comment"/>
|
||||
<result property="oldComment" column="old_comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@@ -17,13 +19,16 @@
|
||||
<sql id="selectScChangeCommentVo">
|
||||
select scc.id,
|
||||
scc.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
bs.manage_tags as manage_tags,
|
||||
sf.sheepfold_name as sheepfold_name,
|
||||
'改备注' as event_type,
|
||||
scc.new_comment,
|
||||
scc.old_comment,
|
||||
scc.create_by,
|
||||
scc.create_time
|
||||
from sc_change_comment scc
|
||||
left join bas_sheep bs on scc.sheep_id = bs.id
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult">
|
||||
@@ -32,6 +37,7 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="newComment != null and newComment != ''">
|
||||
and scc.new_comment like concat('%', #{newComment}, '%')
|
||||
</if>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<result property="id" column="sce_id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="earType" column="ear_type"/>
|
||||
<result property="newTag" column="newTag"/>
|
||||
<result property="oldTag" column="oldTag"/>
|
||||
@@ -20,6 +22,12 @@
|
||||
select sce.id as sce_id,
|
||||
sce.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
sf.sheepfold_name as sheepfold_name,
|
||||
case
|
||||
when sce.ear_type = 0 then '改电子耳号'
|
||||
when sce.ear_type = 1 then '改管理耳号'
|
||||
else ''
|
||||
end as event_type,
|
||||
sce.ear_type,
|
||||
sce.newTag,
|
||||
sce.oldTag as oldTag,
|
||||
@@ -28,6 +36,7 @@
|
||||
sce.create_time
|
||||
from sc_change_ear sce
|
||||
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
|
||||
LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeEarList" parameterType="ScChangeEar" resultMap="ScChangeEarResult">
|
||||
@@ -37,6 +46,10 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="sheepfoldName != null and sheepfoldName != ''">
|
||||
and sf.sheepfold_name LIKE CONCAT('%', #{sheepfoldName}, '%')
|
||||
</if>
|
||||
<if test="earType != null ">and sce.ear_type = #{earType}</if>
|
||||
<if test="newTag != null and newTag != ''">
|
||||
and sce.newTag LIKE CONCAT('%', #{newTag}, '%')
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="varietyOld" column="variety_old"/>
|
||||
<result property="varietyNew" column="variety_new"/>
|
||||
<result property="comment" column="comment"/>
|
||||
@@ -18,7 +20,9 @@
|
||||
<sql id="selectScChangeVarietyVo">
|
||||
select scv.id,
|
||||
scv.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
bs.manage_tags as manage_tags,
|
||||
sf.sheepfold_name as sheepfold_name,
|
||||
'改品种' as event_type,
|
||||
scv.variety_old,
|
||||
scv.variety_new,
|
||||
scv.comment,
|
||||
@@ -26,6 +30,7 @@
|
||||
scv.create_time
|
||||
from sc_change_variety scv
|
||||
left join bas_sheep bs on scv.sheep_id = bs.id
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeVarietyList" parameterType="ScChangeVariety" resultMap="ScChangeVarietyResult">
|
||||
@@ -35,6 +40,7 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">
|
||||
and scv.variety_old like concat('%', #{varietyOld}, '%')
|
||||
</if>
|
||||
|
||||
@@ -25,18 +25,22 @@
|
||||
SELECT tg.id,
|
||||
tg.sheep_id,
|
||||
s.manage_tags AS manageTags,
|
||||
tg.event_type AS eventType,
|
||||
tg.trans_date AS transDate,
|
||||
tg.fold_to,
|
||||
tg.fold_from,
|
||||
tg.reason,
|
||||
tg.variety_id,
|
||||
bv.variety AS varietyName,
|
||||
tg.technician,
|
||||
st.id AS sheepTypeId,
|
||||
st.name AS sheepTypeName,
|
||||
tg.status,
|
||||
tg.comment,
|
||||
tg.create_by,
|
||||
tg.create_time,
|
||||
sf_from.sheepfold_name AS foldFromName,
|
||||
sf_to.sheepfold_name AS foldToName,
|
||||
tg.technician,
|
||||
st.id AS sheepTypeId,
|
||||
st.name AS sheepTypeName
|
||||
FROM sc_trans_group tg
|
||||
@@ -54,10 +58,15 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and s.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="eventType != null">and tg.event_type = #{eventType}</if>
|
||||
<if test="params.beginTransDate != null and params.beginTransDate != '' and params.endTransDate != null and params.endTransDate != ''">
|
||||
and tg.trans_date between #{params.beginTransDate} and #{params.endTransDate}
|
||||
</if>
|
||||
<if test="foldTo != null and foldTo != ''">and fold_to = #{foldTo}</if>
|
||||
<if test="foldFrom != null and foldFrom != ''">and fold_from = #{foldFrom}</if>
|
||||
<if test="status != null">and status = #{status}</if>
|
||||
<if test="varietyId != null">and tg.variety_id = #{varietyId}</if>
|
||||
<if test="sheepTypeId != null">and st.id = #{sheepTypeId}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
@@ -75,6 +84,8 @@
|
||||
insert into sc_trans_group
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="eventType != null">event_type,</if>
|
||||
<if test="transDate != null and transDate != ''">trans_date,</if>
|
||||
<if test="foldTo != null and foldTo != ''">fold_to,</if>
|
||||
<if test="foldFrom != null and foldFrom != ''">fold_from,</if>
|
||||
<if test="varietyId != null">variety_id,</if>
|
||||
@@ -87,6 +98,8 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="eventType != null">#{eventType},</if>
|
||||
<if test="transDate != null and transDate != ''">#{transDate},</if>
|
||||
<if test="foldTo != null and foldTo != ''">#{foldTo},</if>
|
||||
<if test="foldFrom != null and foldFrom != ''">#{foldFrom},</if>
|
||||
<if test="varietyId != null">#{varietyId},</if>
|
||||
@@ -103,6 +116,8 @@
|
||||
update sc_trans_group
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="eventType != null">event_type = #{eventType},</if>
|
||||
<if test="transDate != null and transDate != ''">trans_date = #{transDate},</if>
|
||||
<if test="foldTo != null and foldTo != ''">fold_to = #{foldTo},</if>
|
||||
<if test="foldFrom != null and foldFrom != ''">fold_from = #{foldFrom},</if>
|
||||
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo" id="ScTransitionInfoResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<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="transTypeText"/>
|
||||
<result property="transitionDate" column="transition_date"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="comment" column="comment"/>
|
||||
@@ -21,23 +23,25 @@
|
||||
|
||||
<sql id="selectScTransitionInfoVo">
|
||||
SELECT t.*,
|
||||
bv.variety AS varietyName,
|
||||
bs.manage_tags AS manageTags,
|
||||
bv.variety AS varietyName,
|
||||
bs.manage_tags AS manageTags,
|
||||
t.event_type AS eventType,
|
||||
t.transition_date AS transitionDate,
|
||||
CASE t.trans_type
|
||||
WHEN 0 THEN '内部调拨'
|
||||
WHEN 1 THEN '内部销售'
|
||||
WHEN 2 THEN '育肥调拨'
|
||||
ELSE '未知'
|
||||
END AS transTypeText,
|
||||
END AS transTypeText,
|
||||
CASE t.status
|
||||
WHEN 0 THEN '待审批'
|
||||
WHEN 1 THEN '已通过'
|
||||
WHEN 2 THEN '已驳回'
|
||||
ELSE '未知状态'
|
||||
END AS statusText
|
||||
END AS statusText
|
||||
FROM sc_transition_info t
|
||||
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
|
||||
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
|
||||
LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
|
||||
@@ -47,7 +51,15 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="varietyId != null">and t.variety_id = #{varietyId}</if>
|
||||
<if test="eventType != null and eventType != ''">
|
||||
and t.event_type = #{eventType}
|
||||
</if>
|
||||
<if test="transType != null">and t.trans_type = #{transType}</if>
|
||||
<if test="params.beginTransitionDate != null and params.beginTransitionDate != ''
|
||||
and params.endTransitionDate != null and params.endTransitionDate != ''">
|
||||
and t.transition_date between #{params.beginTransitionDate} and #{params.endTransitionDate}
|
||||
</if>
|
||||
<if test="varietyId != null">and bs.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>
|
||||
@@ -69,7 +81,9 @@
|
||||
<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="eventType != null and eventType != ''">event_type,</if>
|
||||
<if test="transType != null">trans_type,</if>
|
||||
<if test="transitionDate != null">transition_date,</if>
|
||||
<if test="technician != null and technician != ''">technician,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
@@ -81,7 +95,9 @@
|
||||
<if test="varietyId != null">#{varietyId},</if>
|
||||
<if test="transTo != null and transTo != ''">#{transTo},</if>
|
||||
<if test="transFrom != null and transFrom != ''">#{transFrom},</if>
|
||||
<if test="eventType != null and eventType != ''">#{eventType},</if>
|
||||
<if test="transType != null">#{transType},</if>
|
||||
<if test="transitionDate != null">#{transitionDate},</if>
|
||||
<if test="technician != null and technician != ''">#{technician},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
@@ -93,13 +109,13 @@
|
||||
<insert id="insertScTransitionInfoBatch">
|
||||
INSERT INTO sc_transition_info (
|
||||
sheep_id, variety_id, trans_to, trans_from,
|
||||
trans_type, technician, status, comment,
|
||||
event_type,trans_type, transition_date, technician, status, comment,
|
||||
create_by, create_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom},
|
||||
#{item.transType}, #{item.technician}, #{item.status}, #{item.comment},
|
||||
#{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType},
|
||||
#{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment},
|
||||
#{item.createBy}, now()
|
||||
)
|
||||
</foreach>
|
||||
@@ -110,9 +126,12 @@
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
|
||||
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
|
||||
<if test="eventType != null and eventType != ''">event_type = #{eventType},</if>
|
||||
<if test="transType != null">trans_type = #{transType},</if>
|
||||
<if test="transitionDate != null">transition_date = #{transitionDate},</if>
|
||||
<if test="technician != null and technician != ''">technician = #{technician},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.other.mapper.ScCastrateMapper">
|
||||
|
||||
<resultMap type="ScCastrate" id="ScCastrateResult">
|
||||
<resultMap type="com.zhyc.module.produce.other.domain.ScCastrate" id="ScCastrateResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
@@ -21,19 +22,20 @@
|
||||
<sql id="selectScCastrateVo">
|
||||
select sc.id,
|
||||
sc.sheep_id,
|
||||
bs.manage_tags as manageTags,
|
||||
sc.sheepfold,
|
||||
bs.manage_tags as manageTags,
|
||||
'去势' as event_type,
|
||||
bs.sheepfold_id as sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sc.variety_id,
|
||||
bv.variety as varietyName,
|
||||
bs.variety_id as varietyId,
|
||||
bv.variety as varietyName,
|
||||
sc.comment,
|
||||
sc.technician,
|
||||
sc.create_by,
|
||||
sc.create_time
|
||||
from sc_castrate sc
|
||||
left join bas_sheep bs on sc.sheep_id = bs.id
|
||||
left join da_sheepfold sf on sc.sheepfold = sf.id
|
||||
left join bas_sheep_variety bv on sc.variety_id = bv.id
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
|
||||
@@ -42,8 +44,8 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="sheepfold != null ">and sc.sheepfold = #{sheepfold}</if>
|
||||
<if test="varietyId != null">and sc.variety_id = #{varietyId}</if>
|
||||
<if test="sheepfold != null ">and bs.sheepfold_id = #{sheepfold}</if>
|
||||
<if test="varietyId != null">and bs.variety_id = #{varietyId}</if>
|
||||
<if test="technician != null and technician != ''">and sc.technician like concat('%', #{technician}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.other.mapper.ScFixHoofMapper">
|
||||
|
||||
<resultMap type="ScFixHoof" id="ScFixHoofResult">
|
||||
<resultMap type="com.zhyc.module.produce.other.domain.ScFixHoof" id="ScFixHoofResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
@@ -18,29 +19,28 @@
|
||||
|
||||
<sql id="selectScFixHoofVo">
|
||||
select fh.id,
|
||||
bs.manage_tags AS manageTags,
|
||||
fh.sheepfold,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
fh.variety_id,
|
||||
bv.variety AS varietyName,
|
||||
bs.manage_tags as manageTags,
|
||||
'修蹄' as event_type,
|
||||
bs.sheepfold_id as sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
bs.variety_id as varietyId,
|
||||
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
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
|
||||
<include refid="selectScFixHoofVo"/>
|
||||
<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="sheepfold != null ">and bs.sheepfold_id = #{sheepfold}</if>
|
||||
<if test="varietyId != null">and bs.variety_id = #{varietyId}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and fh.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<?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.stock.mapper.WzMaterialsManagementMapper">
|
||||
|
||||
<resultMap type="WzMaterialsManagement" id="WzMaterialsManagementResult">
|
||||
<result property="materialManagementCode" column="material_management_code" />
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="materialSpecification" column="material_specification" />
|
||||
<result property="materialUnit" column="material_unit" />
|
||||
<result property="currentStock" column="current_stock" />
|
||||
<result property="stockAlarm" column="stock_alarm" />
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="expirationDate" column="expiration_date" />
|
||||
<result property="expirationAlarm" column="expiration_alarm" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWzMaterialsManagementVo">
|
||||
select material_management_code, material_id, material_name, batch_id, material_specification, material_unit, current_stock, stock_alarm, production_date, expiration_date, expiration_alarm from wz_materials_management
|
||||
</sql>
|
||||
|
||||
<select id="selectWzMaterialsManagementList" parameterType="WzMaterialsManagement" resultMap="WzMaterialsManagementResult">
|
||||
<include refid="selectWzMaterialsManagementVo"/>
|
||||
<where>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
<if test="params.beginProductionDate != null and params.beginProductionDate != '' and params.endProductionDate != null and params.endProductionDate != ''"> and production_date between #{params.beginProductionDate} and #{params.endProductionDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWzMaterialsManagementByMaterialManagementCode" parameterType="Long" resultMap="WzMaterialsManagementResult">
|
||||
<include refid="selectWzMaterialsManagementVo"/>
|
||||
where material_management_code = #{materialManagementCode}
|
||||
</select>
|
||||
|
||||
<insert id="insertWzMaterialsManagement" parameterType="WzMaterialsManagement" useGeneratedKeys="true" keyProperty="materialManagementCode">
|
||||
insert into wz_materials_management
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="materialId != null and materialId != ''">material_id,</if>
|
||||
<if test="materialName != null and materialName != ''">material_name,</if>
|
||||
<if test="batchId != null">batch_id,</if>
|
||||
<if test="materialSpecification != null">material_specification,</if>
|
||||
<if test="materialUnit != null">material_unit,</if>
|
||||
<if test="currentStock != null">current_stock,</if>
|
||||
<if test="stockAlarm != null">stock_alarm,</if>
|
||||
<if test="productionDate != null">production_date,</if>
|
||||
<if test="expirationDate != null">expiration_date,</if>
|
||||
<if test="expirationAlarm != null">expiration_alarm,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="materialId != null and materialId != ''">#{materialId},</if>
|
||||
<if test="materialName != null and materialName != ''">#{materialName},</if>
|
||||
<if test="batchId != null">#{batchId},</if>
|
||||
<if test="materialSpecification != null">#{materialSpecification},</if>
|
||||
<if test="materialUnit != null">#{materialUnit},</if>
|
||||
<if test="currentStock != null">#{currentStock},</if>
|
||||
<if test="stockAlarm != null">#{stockAlarm},</if>
|
||||
<if test="productionDate != null">#{productionDate},</if>
|
||||
<if test="expirationDate != null">#{expirationDate},</if>
|
||||
<if test="expirationAlarm != null">#{expirationAlarm},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWzMaterialsManagement" parameterType="WzMaterialsManagement">
|
||||
update wz_materials_management
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="materialId != null and materialId != ''">material_id = #{materialId},</if>
|
||||
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
|
||||
<if test="batchId != null">batch_id = #{batchId},</if>
|
||||
<if test="materialSpecification != null">material_specification = #{materialSpecification},</if>
|
||||
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
|
||||
<if test="currentStock != null">current_stock = #{currentStock},</if>
|
||||
<if test="stockAlarm != null">stock_alarm = #{stockAlarm},</if>
|
||||
<if test="productionDate != null">production_date = #{productionDate},</if>
|
||||
<if test="expirationDate != null">expiration_date = #{expirationDate},</if>
|
||||
<if test="expirationAlarm != null">expiration_alarm = #{expirationAlarm},</if>
|
||||
</trim>
|
||||
where material_id = #{materialId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWzMaterialsManagementByMaterialManagementCode" parameterType="Long">
|
||||
delete from wz_materials_management where material_management_code = #{materialManagementCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWzMaterialsManagementByMaterialManagementCodes" parameterType="String">
|
||||
delete from wz_materials_management where material_management_code in
|
||||
<foreach item="materialManagementCode" collection="array" open="(" separator="," close=")">
|
||||
#{materialManagementCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectWzMaterialsManagementByMaterialID" parameterType="String" resultMap="WzMaterialsManagementResult">
|
||||
SELECT * FROM wz_materials_management WHERE material_id = #{materialID}
|
||||
</select>
|
||||
</mapper>
|
||||
147
zhyc-module/src/main/resources/mapper/stock/WzStockInMapper.xml
Normal file
147
zhyc-module/src/main/resources/mapper/stock/WzStockInMapper.xml
Normal file
@@ -0,0 +1,147 @@
|
||||
<?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.stock.mapper.WzStockInMapper">
|
||||
|
||||
<resultMap type="WzStockIn" id="WzStockInResult">
|
||||
<result property="stockInCode" column="stock_in_code" />
|
||||
<result property="docDate" column="doc_date" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="docId" column="doc_id" />
|
||||
<result property="businessType" column="business_type" />
|
||||
<result property="repositoryId" column="repository_id" />
|
||||
<result property="repositoryName" column="repository_name" />
|
||||
<result property="stockInType" column="stock_in_type" />
|
||||
<result property="supplierId" column="supplier_id" />
|
||||
<result property="supplierName" column="supplier_name" />
|
||||
<result property="departmentId" column="department_id" />
|
||||
<result property="departmentName" column="department_name" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="operatorName" column="operator_name" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="single" column="single" />
|
||||
<result property="reviewer" column="reviewer" />
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="materialSpecification" column="material_specification" />
|
||||
<result property="materialUnit" column="material_unit" />
|
||||
<result property="count" column="count" />
|
||||
<result property="stockInAdjustRemark" column="stock_in_adjust_remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWzStockInVo">
|
||||
select stock_in_code, doc_date, create_date, doc_id, business_type, repository_id, repository_name, stock_in_type, supplier_id, supplier_name, department_id, department_name, operator_id, operator_name, remark, single, reviewer, material_id, material_name, material_specification, material_unit, count, stock_in_adjust_remark from wz_stock_in
|
||||
</sql>
|
||||
|
||||
<select id="selectWzStockInList" parameterType="WzStockIn" resultMap="WzStockInResult">
|
||||
<include refid="selectWzStockInVo"/>
|
||||
<where>
|
||||
<if test="params.beginDocDate != null and params.beginDocDate != '' and params.endDocDate != null and params.endDocDate != ''"> and doc_date between #{params.beginDocDate} and #{params.endDocDate}</if>
|
||||
<if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if>
|
||||
<if test="repositoryName != null and repositoryName != ''"> and repository_name like concat('%', #{repositoryName}, '%')</if>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWzStockInByStockInCode" parameterType="Long" resultMap="WzStockInResult">
|
||||
<include refid="selectWzStockInVo"/>
|
||||
where stock_in_code = #{stockInCode}
|
||||
</select>
|
||||
|
||||
<insert id="insertWzStockIn" parameterType="WzStockIn" useGeneratedKeys="true" keyProperty="stockInCode">
|
||||
insert into wz_stock_in
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="docDate != null">doc_date,</if>
|
||||
<if test="createDate != null">create_date,</if>
|
||||
<if test="docId != null">doc_id,</if>
|
||||
<if test="businessType != null">business_type,</if>
|
||||
<if test="repositoryId != null">repository_id,</if>
|
||||
<if test="repositoryName != null">repository_name,</if>
|
||||
<if test="stockInType != null">stock_in_type,</if>
|
||||
<if test="supplierId != null">supplier_id,</if>
|
||||
<if test="supplierName != null">supplier_name,</if>
|
||||
<if test="departmentId != null">department_id,</if>
|
||||
<if test="departmentName != null">department_name,</if>
|
||||
<if test="operatorId != null">operator_id,</if>
|
||||
<if test="operatorName != null">operator_name,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="single != null">single,</if>
|
||||
<if test="reviewer != null">reviewer,</if>
|
||||
<if test="materialId != null">material_id,</if>
|
||||
<if test="materialName != null">material_name,</if>
|
||||
<if test="materialSpecification != null">material_specification,</if>
|
||||
<if test="materialUnit != null">material_unit,</if>
|
||||
<if test="count != null">count,</if>
|
||||
<if test="stockInAdjustRemark != null">stock_in_adjust_remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="docDate != null">#{docDate},</if>
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="docId != null">#{docId},</if>
|
||||
<if test="businessType != null">#{businessType},</if>
|
||||
<if test="repositoryId != null">#{repositoryId},</if>
|
||||
<if test="repositoryName != null">#{repositoryName},</if>
|
||||
<if test="stockInType != null">#{stockInType},</if>
|
||||
<if test="supplierId != null">#{supplierId},</if>
|
||||
<if test="supplierName != null">#{supplierName},</if>
|
||||
<if test="departmentId != null">#{departmentId},</if>
|
||||
<if test="departmentName != null">#{departmentName},</if>
|
||||
<if test="operatorId != null">#{operatorId},</if>
|
||||
<if test="operatorName != null">#{operatorName},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="single != null">#{single},</if>
|
||||
<if test="reviewer != null">#{reviewer},</if>
|
||||
<if test="materialId != null">#{materialId},</if>
|
||||
<if test="materialName != null">#{materialName},</if>
|
||||
<if test="materialSpecification != null">#{materialSpecification},</if>
|
||||
<if test="materialUnit != null">#{materialUnit},</if>
|
||||
<if test="count != null">#{count},</if>
|
||||
<if test="stockInAdjustRemark != null">#{stockInAdjustRemark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWzStockIn" parameterType="WzStockIn">
|
||||
update wz_stock_in
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="docDate != null">doc_date = #{docDate},</if>
|
||||
<if test="createDate != null">create_date = #{createDate},</if>
|
||||
<if test="docId != null">doc_id = #{docId},</if>
|
||||
<if test="businessType != null">business_type = #{businessType},</if>
|
||||
<if test="repositoryId != null">repository_id = #{repositoryId},</if>
|
||||
<if test="repositoryName != null">repository_name = #{repositoryName},</if>
|
||||
<if test="stockInType != null">stock_in_type = #{stockInType},</if>
|
||||
<if test="supplierId != null">supplier_id = #{supplierId},</if>
|
||||
<if test="supplierName != null">supplier_name = #{supplierName},</if>
|
||||
<if test="departmentId != null">department_id = #{departmentId},</if>
|
||||
<if test="departmentName != null">department_name = #{departmentName},</if>
|
||||
<if test="operatorId != null">operator_id = #{operatorId},</if>
|
||||
<if test="operatorName != null">operator_name = #{operatorName},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="single != null">single = #{single},</if>
|
||||
<if test="reviewer != null">reviewer = #{reviewer},</if>
|
||||
<if test="materialId != null">material_id = #{materialId},</if>
|
||||
<if test="materialName != null">material_name = #{materialName},</if>
|
||||
<if test="materialSpecification != null">material_specification = #{materialSpecification},</if>
|
||||
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
|
||||
<if test="count != null">count = #{count},</if>
|
||||
<if test="stockInAdjustRemark != null">stock_in_adjust_remark = #{stockInAdjustRemark},</if>
|
||||
</trim>
|
||||
where stock_in_code = #{stockInCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWzStockInByStockInCode" parameterType="Long">
|
||||
delete from wz_stock_in where stock_in_code = #{stockInCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWzStockInByStockInCodes" parameterType="String">
|
||||
delete from wz_stock_in where stock_in_code in
|
||||
<foreach item="stockInCode" collection="array" open="(" separator="," close=")">
|
||||
#{stockInCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getEarliestStockIn" resultMap="WzStockInResult">
|
||||
SELECT * FROM wz_stock_in ORDER BY doc_date DESC LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
180
zhyc-module/src/main/resources/mapper/stock/WzStockOutMapper.xml
Normal file
180
zhyc-module/src/main/resources/mapper/stock/WzStockOutMapper.xml
Normal file
@@ -0,0 +1,180 @@
|
||||
<?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.stock.mapper.WzStockOutMapper">
|
||||
|
||||
<resultMap type="WzStockOut" id="WzStockOutResult">
|
||||
<result property="stockOutCode" column="stock_out_code" />
|
||||
<result property="docDate" column="doc_date" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="docId" column="doc_id" />
|
||||
<result property="businessType" column="business_type" />
|
||||
<result property="repositoryId" column="repository_id" />
|
||||
<result property="repositoryName" column="repository_name" />
|
||||
<result property="projectClassification" column="project_classification" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="projectName" column="project_name" />
|
||||
<result property="departmentId" column="department_id" />
|
||||
<result property="departmentName" column="department_name" />
|
||||
<result property="receiverId" column="receiver_id" />
|
||||
<result property="receiver" column="receiver" />
|
||||
<result property="single" column="single" />
|
||||
<result property="reviewer" column="reviewer" />
|
||||
<result property="reviewDate" column="review_date" />
|
||||
<result property="modifier" column="modifier" />
|
||||
<result property="materialClassId" column="material_class_id" />
|
||||
<result property="materialClassName" column="material_class_name" />
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="materialSpecification" column="material_specification" />
|
||||
<result property="materialUnit" column="material_unit" />
|
||||
<result property="count" column="count" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="shelfLife" column="shelf_life" />
|
||||
<result property="shelfLifeUnit" column="shelf_life_unit" />
|
||||
<result property="expirationDate" column="expiration_date" />
|
||||
<result property="agent" column="agent" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWzStockOutVo">
|
||||
select stock_out_code, doc_date, create_date, doc_id, business_type, repository_id, repository_name, project_classification, project_id, project_name, department_id, department_name,receiver_id, receiver, single, reviewer, review_date, modifier, material_class_id, material_class_name, material_id,material_name, material_specification, material_unit, count, batch_id, production_date, shelf_life, shelf_life_unit, expiration_date, agent from wz_stock_out
|
||||
</sql>
|
||||
|
||||
<select id="selectWzStockOutList" parameterType="WzStockOut" resultMap="WzStockOutResult">
|
||||
<include refid="selectWzStockOutVo"/>
|
||||
<where>
|
||||
<if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if>
|
||||
<if test="repositoryName != null and repositoryName != ''"> and repository_name like concat('%', #{repositoryName}, '%')</if>
|
||||
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
|
||||
<if test="departmentName != null and departmentName != ''"> and department_name like concat('%', #{departmentName}, '%')</if>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWzStockOutByStockOutCode" parameterType="Long" resultMap="WzStockOutResult">
|
||||
<include refid="selectWzStockOutVo"/>
|
||||
where stock_out_code = #{stockOutCode}
|
||||
</select>
|
||||
|
||||
<insert id="insertWzStockOut" parameterType="WzStockOut" useGeneratedKeys="true" keyProperty="stockOutCode">
|
||||
insert into wz_stock_out
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="docDate != null">doc_date,</if>
|
||||
<if test="createDate != null">create_date,</if>
|
||||
<if test="docId != null">doc_id,</if>
|
||||
<if test="businessType != null">business_type,</if>
|
||||
<if test="repositoryId != null">repository_id,</if>
|
||||
<if test="repositoryName != null">repository_name,</if>
|
||||
<if test="projectClassification != null">project_classification,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="projectName != null">project_name,</if>
|
||||
<if test="departmentId != null">department_id,</if>
|
||||
<if test="departmentName != null">department_name,</if>
|
||||
<if test="receiverId != null">receiver_id,</if>
|
||||
<if test="receiver != null">receiver,</if>
|
||||
<if test="single != null">single,</if>
|
||||
<if test="reviewer != null">reviewer,</if>
|
||||
<if test="reviewDate != null">review_date,</if>
|
||||
<if test="modifier != null">modifier,</if>
|
||||
<if test="materialClassId != null">material_class_id,</if>
|
||||
<if test="materialClassName != null">material_class_name,</if>
|
||||
<if test="materialId != null">material_id,</if>
|
||||
<if test="materialName != null">material_name,</if>
|
||||
<if test="materialSpecification != null">material_specification,</if>
|
||||
<if test="materialUnit != null">material_unit,</if>
|
||||
<if test="count != null">count,</if>
|
||||
<if test="batchId != null">batch_id,</if>
|
||||
<if test="productionDate != null">production_date,</if>
|
||||
<if test="shelfLife != null">shelf_life,</if>
|
||||
<if test="shelfLifeUnit != null">shelf_life_unit,</if>
|
||||
<if test="expirationDate != null">expiration_date,</if>
|
||||
<if test="agent != null">agent,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="docDate != null">#{docDate},</if>
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="docId != null">#{docId},</if>
|
||||
<if test="businessType != null">#{businessType},</if>
|
||||
<if test="repositoryId != null">#{repositoryId},</if>
|
||||
<if test="repositoryName != null">#{repositoryName},</if>
|
||||
<if test="projectClassification != null">#{projectClassification},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="projectName != null">#{projectName},</if>
|
||||
<if test="departmentId != null">#{departmentId},</if>
|
||||
<if test="departmentName != null">#{departmentName},</if>
|
||||
<if test="receiverId != null">#{receiverId},</if>
|
||||
<if test="receiver != null">#{receiver},</if>
|
||||
<if test="single != null">#{single},</if>
|
||||
<if test="reviewer != null">#{reviewer},</if>
|
||||
<if test="reviewDate != null">#{reviewDate},</if>
|
||||
<if test="modifier != null">#{modifier},</if>
|
||||
<if test="materialClassId != null">#{materialClassId},</if>
|
||||
<if test="materialClassName != null">#{materialClassName},</if>
|
||||
<if test="materialId != null">#{materialId},</if>
|
||||
<if test="materialName != null">#{materialName},</if>
|
||||
<if test="materialSpecification != null">#{materialSpecification},</if>
|
||||
<if test="materialUnit != null">#{materialUnit},</if>
|
||||
<if test="count != null">#{count},</if>
|
||||
<if test="batchId != null">#{batchId},</if>
|
||||
<if test="productionDate != null">#{productionDate},</if>
|
||||
<if test="shelfLife != null">#{shelfLife},</if>
|
||||
<if test="shelfLifeUnit != null">#{shelfLifeUnit},</if>
|
||||
<if test="expirationDate != null">#{expirationDate},</if>
|
||||
<if test="agent != null">#{agent},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWzStockOut" parameterType="WzStockOut">
|
||||
update wz_stock_out
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="docDate != null">doc_date = #{docDate},</if>
|
||||
<if test="createDate != null">create_date = #{createDate},</if>
|
||||
<if test="docId != null">doc_id = #{docId},</if>
|
||||
<if test="businessType != null">business_type = #{businessType},</if>
|
||||
<if test="repositoryId != null">repository_id = #{repositoryId},</if>
|
||||
<if test="repositoryName != null">repository_name = #{repositoryName},</if>
|
||||
<if test="projectClassification != null">project_classification = #{projectClassification},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="projectName != null">project_name = #{projectName},</if>
|
||||
<if test="departmentId != null">department_id = #{departmentId},</if>
|
||||
<if test="departmentName != null">department_name = #{departmentName},</if>
|
||||
<if test="receiverId != null">receiver_id = #{receiverId},</if>
|
||||
<if test="receiver != null">receiver = #{receiver},</if>
|
||||
<if test="single != null">single = #{single},</if>
|
||||
<if test="reviewer != null">reviewer = #{reviewer},</if>
|
||||
<if test="reviewDate != null">review_date = #{reviewDate},</if>
|
||||
<if test="modifier != null">modifier = #{modifier},</if>
|
||||
<if test="materialClassId != null">material_class_id = #{materialClassId},</if>
|
||||
<if test="materialClassName != null">material_class_name = #{materialClassName},</if>
|
||||
<if test="materialId != null">material_id = #{materialId},</if>
|
||||
<if test="materialName != null">material_name = #{materialName},</if>
|
||||
<if test="materialSpecification != null">material_specification = #{materialSpecification},</if>
|
||||
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
|
||||
<if test="count != null">count = #{count},</if>
|
||||
<if test="batchId != null">batch_id = #{batchId},</if>
|
||||
<if test="productionDate != null">production_date = #{productionDate},</if>
|
||||
<if test="shelfLife != null">shelf_life = #{shelfLife},</if>
|
||||
<if test="shelfLifeUnit != null">shelf_life_unit = #{shelfLifeUnit},</if>
|
||||
<if test="expirationDate != null">expiration_date = #{expirationDate},</if>
|
||||
<if test="agent != null">agent = #{agent},</if>
|
||||
</trim>
|
||||
where stock_out_code = #{stockOutCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWzStockOutByStockOutCode" parameterType="Long">
|
||||
delete from wz_stock_out where stock_out_code = #{stockOutCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWzStockOutByStockOutCodes" parameterType="String">
|
||||
delete from wz_stock_out where stock_out_code in
|
||||
<foreach item="stockOutCode" collection="array" open="(" separator="," close=")">
|
||||
#{stockOutCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getEarliestStockOut" resultMap="WzStockOutResult">
|
||||
SELECT * FROM wz_stock_out ORDER BY create_date DESC LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user