|
|
|
|
@@ -6,7 +6,7 @@
|
|
|
|
|
|
|
|
|
|
<resultMap type="BreedRamFile" id="BreedRamFileResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="ordinaryEarNumber" column="ordinary_ear_number" />
|
|
|
|
|
<result property="ordinaryEarNumber" column="manage_tags" />
|
|
|
|
|
<result property="ranchId" column="ranch_id" />
|
|
|
|
|
<result property="ranchName" column="ranch_name" />
|
|
|
|
|
<result property="sheepfoldId" column="sheepfold_id" />
|
|
|
|
|
@@ -74,13 +74,13 @@
|
|
|
|
|
</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
|
|
|
|
|
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 ordinary_ear_number like concat('%', #{ordinaryEarNumber}, '%')</if>
|
|
|
|
|
<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>
|
|
|
|
|
@@ -149,56 +149,74 @@
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectBreedRamFileByOrdinaryEarNumber" parameterType="String" resultMap="BreedRamFileResult">
|
|
|
|
|
<include refid="selectBreedRamFileVo"/>
|
|
|
|
|
where ordinary_ear_number = #{ordinaryEarNumber}
|
|
|
|
|
<!-- ====================== 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" resultMap="BreedRamFileResult">
|
|
|
|
|
<include refid="selectBreedRamFileVo"/>
|
|
|
|
|
where electronic_tags = #{electronicTags}
|
|
|
|
|
<!-- 根据电子耳号查询种公羊档案 -->
|
|
|
|
|
<select id="selectBreedRamFileByElectronicTags" parameterType="String" resultType="BreedRamFile">
|
|
|
|
|
SELECT * FROM breed_ram_file
|
|
|
|
|
WHERE electronic_tags = #{electronicTags}
|
|
|
|
|
AND is_delete = 0
|
|
|
|
|
LIMIT 1
|
|
|
|
|
</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
|
|
|
|
|
<!-- 根据牧场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>
|
|
|
|
|
|
|
|
|
|
<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
|
|
|
|
|
<!-- 根据羊舍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" 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 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" 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 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="ordinaryEarNumber != null">ordinary_ear_number,</if>
|
|
|
|
|
<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>
|
|
|
|
|
@@ -258,6 +276,8 @@
|
|
|
|
|
<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>
|
|
|
|
|
@@ -265,7 +285,7 @@
|
|
|
|
|
<if test="isDelete != null">is_delete,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="ordinaryEarNumber != null">#{ordinaryEarNumber},</if>
|
|
|
|
|
<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>
|
|
|
|
|
@@ -325,6 +345,8 @@
|
|
|
|
|
<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>
|
|
|
|
|
@@ -336,7 +358,7 @@
|
|
|
|
|
<update id="updateBreedRamFile" parameterType="BreedRamFile">
|
|
|
|
|
update breed_ram_file
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="ordinaryEarNumber != null">ordinary_ear_number = #{ordinaryEarNumber},</if>
|
|
|
|
|
<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>
|
|
|
|
|
@@ -414,4 +436,5 @@
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|