<?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="manage_tags"    />
        <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, manage_tags, 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 manage_tags 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>

    <!-- ====================== BreedRamFileMapper.xml 需要添加/更新 ====================== -->
    <!-- 根据普通耳号查询种公羊档案 -->
    <!-- 查询方法也需要修改字段名 -->
    <select id="selectBreedRamFileByOrdinaryEarNumber" resultMap="BreedRamFileResult">
        SELECT * FROM breed_ram_file
        WHERE manage_tags = #{ordinaryEarNumber} AND is_delete = 0
            LIMIT 1
    </select>

    <!-- 根据电子耳号查询种公羊档案 -->
    <select id="selectBreedRamFileByElectronicTags" parameterType="String" resultType="BreedRamFile">
        SELECT * FROM breed_ram_file
        WHERE electronic_tags = #{electronicTags}
          AND is_delete = 0
            LIMIT 1
    </select>

    <!-- 根据牧场ID查询种公羊档案列表 -->
    <select id="selectBreedRamFileListByRanchId" parameterType="Long" resultType="BreedRamFile">
        SELECT * FROM breed_ram_file
        WHERE ranch_id = #{ranchId}
          AND is_delete = 0
        ORDER BY id DESC
    </select>

    <!-- 根据羊舍ID查询种公羊档案列表 -->
    <select id="selectBreedRamFileListBySheepfoldId" parameterType="Long" resultType="BreedRamFile">
        SELECT * FROM breed_ram_file
        WHERE sheepfold_id = #{sheepfoldId}
          AND is_delete = 0
        ORDER BY id DESC
    </select>

    <!-- 查询核心羊群种公羊档案列表 -->
    <select id="selectCoreFlockBreedRamFileList" parameterType="BreedRamFile" resultType="BreedRamFile">
        SELECT * FROM breed_ram_file
        WHERE is_core_flock = 1
        AND is_delete = 0
        <if test="ranchId != null">
            AND ranch_id = #{ranchId}
        </if>
        <if test="varietyId != null">
            AND variety_id = #{varietyId}
        </if>
        ORDER BY id DESC
    </select>

    <!-- 查询种用种公羊档案列表 -->
    <select id="selectBreedingUseBreedRamFileList" parameterType="BreedRamFile" resultType="BreedRamFile">
        SELECT * FROM breed_ram_file
        WHERE is_breeding_use = 1
        AND is_delete = 0
        <if test="ranchId != null">
            AND ranch_id = #{ranchId}
        </if>
        <if test="varietyId != null">
            AND variety_id = #{varietyId}
        </if>
        ORDER BY id DESC
    </select>



    <!-- 修正后的 insertBreedRamFile -->
    <insert id="insertBreedRamFile" parameterType="BreedRamFile" useGeneratedKeys="true" keyProperty="id">
        insert into breed_ram_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="manageTags != null and manageTags != ''">manage_tags,</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="offspringCount != null">offspring_count,</if>
            <if test="prolificacy != null">prolificacy,</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="manageTags != null and manageTags != ''">#{manageTags},</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="offspringCount != null">#{offspringCount},</if>
            <if test="prolificacy != null">#{prolificacy},</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">manage_tags = #{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>