Merge remote-tracking branch 'origin/main'
# Conflicts: # zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java # zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
<?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.ScBreedRecordMapper">
|
||||
|
||||
<resultMap type="ScBreedRecord" id="ScBreedRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="ramId" column="ram_id" />
|
||||
<result property="eweId" column="ewe_id" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="breedDrugs" column="breed_drugs" />
|
||||
<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" />
|
||||
<result property="ramVariety" column="ram_variety" />
|
||||
<result property="eweParity" column="ewe_parity" />
|
||||
<result property="eweMonthAge" column="ewe_month_age" />
|
||||
<result property="eweSheepfoldName" column="ewe_sheepfold_name" />
|
||||
<result property="eweBreedStatus" column="ewe_breed_status" />
|
||||
<result property="eweControlled" column="ewe_controlled" />
|
||||
<result property="eweComment" column="ewe_comment" />
|
||||
<result property="ranchName" column="ranch_name" />
|
||||
<result property="matingType" column="mating_type" />
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="matingCount" column="mating_count" />
|
||||
<result property="timeSincePlanning" column="time_since_planning" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBreedRecordVo">
|
||||
select
|
||||
br.id,
|
||||
br.sheep_id,
|
||||
br.ram_id,
|
||||
br.ewe_id,
|
||||
br.technician,
|
||||
br.breed_drugs,
|
||||
br.create_by,
|
||||
br.create_time,
|
||||
-- 母羊信息(从视图获取)
|
||||
ewe_view.bs_manage_tags as ewe_manage_tags,
|
||||
ewe_view.variety as ewe_variety,
|
||||
ewe_view.parity as ewe_parity,
|
||||
ewe_view.month_age as ewe_month_age,
|
||||
ewe_view.sheepfold_name as ewe_sheepfold_name,
|
||||
ewe_view.breed as ewe_breed_status,
|
||||
ewe_view.controlled as ewe_controlled,
|
||||
ewe_view.comment as ewe_comment,
|
||||
ewe_view.dr_ranch as ranch_name,
|
||||
ewe_view.name as sheep_type,
|
||||
ewe_view.mating_total as mating_count,
|
||||
-- 公羊信息(从视图获取)
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
ram_view.variety as ram_variety,
|
||||
-- 配种方式(如果视图中没有,设为空或从其他地方获取)
|
||||
'' as mating_type,
|
||||
-- 发情后配种时间(小时数)
|
||||
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">
|
||||
<include refid="selectScBreedRecordVo"/>
|
||||
<where>
|
||||
<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="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>
|
||||
<if test="createTime != null "> and date_format(br.create_time,'%y-%m-%d') = date_format(#{createTime},'%y-%m-%d')</if>
|
||||
<!-- 新增耳号查询条件 -->
|
||||
<if test="eweManageTags != null and eweManageTags != ''"> and ewe_view.bs_manage_tags like concat('%', #{eweManageTags}, '%')</if>
|
||||
<if test="ramManageTags != null and ramManageTags != ''"> and ram_view.bs_manage_tags like concat('%', #{ramManageTags}, '%')</if>
|
||||
<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>
|
||||
</where>
|
||||
order by br.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectScBreedRecordById" parameterType="Long" resultMap="ScBreedRecordResult">
|
||||
<include refid="selectScBreedRecordVo"/>
|
||||
where br.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据母羊耳号查询羊只ID -->
|
||||
<select id="getSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||
select id from sheep_file where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据公羊耳号查询羊只ID -->
|
||||
<select id="getRamIdByManageTags" parameterType="String" resultType="Long">
|
||||
select id from sheep_file where bs_manage_tags = #{manageTags} and gender = 2 and is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据耳号查询羊只详细信息 -->
|
||||
<select id="getSheepInfoByTags" parameterType="String" resultType="map">
|
||||
select
|
||||
id,
|
||||
bs_manage_tags as manage_tags,
|
||||
ranch_id,
|
||||
dr_ranch as ranch_name,
|
||||
sheepfold_id,
|
||||
sheepfold_name,
|
||||
electronic_tags,
|
||||
variety_id,
|
||||
variety,
|
||||
family,
|
||||
name as type_name,
|
||||
gender,
|
||||
birthday,
|
||||
day_age,
|
||||
month_age,
|
||||
parity,
|
||||
birth_weight,
|
||||
weaning_date,
|
||||
status_id,
|
||||
weaning_weight,
|
||||
current_weight,
|
||||
breed_status_id,
|
||||
breed as breed_status,
|
||||
bs_father_id as father_id,
|
||||
father_manage_tags,
|
||||
bs_mother_id as mother_id,
|
||||
mother_manage_tags,
|
||||
receptor_id,
|
||||
receptor_manage_tags,
|
||||
mating_date,
|
||||
mating_type_id,
|
||||
preg_date,
|
||||
lambing_date,
|
||||
lambing_day,
|
||||
mating_day,
|
||||
gestation_day,
|
||||
expected_date,
|
||||
post_lambing_day,
|
||||
lactation_day,
|
||||
anestrous_day,
|
||||
mating_counts,
|
||||
mating_total,
|
||||
miscarriage_counts,
|
||||
comment,
|
||||
controlled,
|
||||
body,
|
||||
breast,
|
||||
source,
|
||||
source_date,
|
||||
source_ranch_id,
|
||||
source_ranch,
|
||||
update_by,
|
||||
update_time,
|
||||
create_by,
|
||||
create_time
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据母羊耳号获取配种计划信息 -->
|
||||
<select id="getBreedPlanByEweTags" parameterType="String" resultType="map">
|
||||
select
|
||||
bp.id as plan_id,
|
||||
bp.ewe_id,
|
||||
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
|
||||
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
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_breed_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="ramId != null">ram_id,</if>
|
||||
<if test="eweId != null">ewe_id,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="breedDrugs != null">breed_drugs,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="ramId != null">#{ramId},</if>
|
||||
<if test="eweId != null">#{eweId},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="breedDrugs != null">#{breedDrugs},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScBreedRecord" parameterType="ScBreedRecord">
|
||||
update sc_breed_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="ramId != null">ram_id = #{ramId},</if>
|
||||
<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="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScBreedRecordById" parameterType="Long">
|
||||
delete from sc_breed_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScBreedRecordByIds" parameterType="String">
|
||||
delete from sc_breed_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?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.RawSpermRecordMapper">
|
||||
|
||||
<resultMap type="RawSpermRecord" id="RawSpermRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="manageTags" column="bs_manage_tags" />
|
||||
<result property="electronicTags" column="electronic_tags" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="pickDate" column="pick_date" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="density" column="density" />
|
||||
<result property="vitallity" column="vitallity" />
|
||||
<result property="controlled" column="controlled" />
|
||||
<result property="sexualStatus" column="sexual_status" />
|
||||
<result property="info" column="info" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRawSpermRecordVo">
|
||||
select
|
||||
rsr.id,
|
||||
rsr.sheep_id,
|
||||
sf.bs_manage_tags,
|
||||
sf.electronic_tags,
|
||||
sf.month_age,
|
||||
rsr.pick_date,
|
||||
rsr.amount,
|
||||
rsr.density,
|
||||
rsr.vitallity,
|
||||
rsr.controlled,
|
||||
rsr.sexual_status,
|
||||
rsr.info,
|
||||
rsr.technician,
|
||||
rsr.comment,
|
||||
rsr.create_by,
|
||||
rsr.create_time
|
||||
from raw_sperm_record rsr
|
||||
left join sheep_file sf on rsr.sheep_id = sf.id
|
||||
</sql>
|
||||
|
||||
<select id="selectRawSpermRecordList" parameterType="RawSpermRecord" resultMap="RawSpermRecordResult">
|
||||
<include refid="selectRawSpermRecordVo"/>
|
||||
<where>
|
||||
<if test="manageTags != null and manageTags != ''"> and sf.bs_manage_tags like concat('%', #{manageTags}, '%')</if>
|
||||
<if test="pickDate != null "> and rsr.pick_date = #{pickDate}</if>
|
||||
<if test="amount != null "> and rsr.amount = #{amount}</if>
|
||||
<if test="density != null and density != ''"> and rsr.density = #{density}</if>
|
||||
<if test="vitallity != null and vitallity != ''"> and rsr.vitallity = #{vitallity}</if>
|
||||
<if test="controlled != null "> and rsr.controlled = #{controlled}</if>
|
||||
<if test="sexualStatus != null and sexualStatus != ''"> and rsr.sexual_status = #{sexualStatus}</if>
|
||||
<if test="info != null and info != ''"> and rsr.info = #{info}</if>
|
||||
<if test="technician != null and technician != ''"> and rsr.technician = #{technician}</if>
|
||||
<if test="comment != null and comment != ''"> and rsr.comment = #{comment}</if>
|
||||
</where>
|
||||
order by rsr.pick_date desc
|
||||
</select>
|
||||
|
||||
<select id="selectRawSpermRecordById" parameterType="Long" resultMap="RawSpermRecordResult">
|
||||
<include refid="selectRawSpermRecordVo"/>
|
||||
where rsr.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据耳号查询羊只ID -->
|
||||
<select id="selectSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||
select id from sheep_file where bs_manage_tags = #{manageTags}
|
||||
</select>
|
||||
|
||||
<insert id="insertRawSpermRecord" parameterType="RawSpermRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into raw_sperm_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="pickDate != null">pick_date,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="density != null">density,</if>
|
||||
<if test="vitallity != null">vitallity,</if>
|
||||
<if test="controlled != null">controlled,</if>
|
||||
<if test="sexualStatus != null">sexual_status,</if>
|
||||
<if test="info != null">info,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="pickDate != null">#{pickDate},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="density != null">#{density},</if>
|
||||
<if test="vitallity != null">#{vitallity},</if>
|
||||
<if test="controlled != null">#{controlled},</if>
|
||||
<if test="sexualStatus != null">#{sexualStatus},</if>
|
||||
<if test="info != null">#{info},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRawSpermRecord" parameterType="RawSpermRecord">
|
||||
update raw_sperm_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="pickDate != null">pick_date = #{pickDate},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="density != null">density = #{density},</if>
|
||||
<if test="vitallity != null">vitallity = #{vitallity},</if>
|
||||
<if test="controlled != null">controlled = #{controlled},</if>
|
||||
<if test="sexualStatus != null">sexual_status = #{sexualStatus},</if>
|
||||
<if test="info != null">info = #{info},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRawSpermRecordById" parameterType="Long">
|
||||
delete from raw_sperm_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRawSpermRecordByIds" parameterType="String">
|
||||
delete from raw_sperm_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -100,4 +100,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 在群羊只总数 -->
|
||||
<select id="countInGroup" resultType="java.lang.Long">
|
||||
SELECT COUNT(*) FROM sheep_file WHERE status_id = 1
|
||||
</select>
|
||||
|
||||
<!-- 羊只类别分布 -->
|
||||
<select id="countBySheepType" resultType="java.util.Map">
|
||||
SELECT name AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1
|
||||
GROUP BY name
|
||||
</select>
|
||||
|
||||
<!-- 繁育状态分布 -->
|
||||
<select id="countByBreedStatus" resultType="java.util.Map">
|
||||
SELECT breed AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1
|
||||
GROUP BY breed
|
||||
</select>
|
||||
|
||||
<!-- 品种分布 -->
|
||||
<select id="countByVariety" resultType="java.util.Map">
|
||||
SELECT variety AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1
|
||||
GROUP BY variety
|
||||
</select>
|
||||
|
||||
<!-- 泌乳羊胎次分布 -->
|
||||
<select id="countParityOfLactation" resultType="java.util.Map">
|
||||
SELECT parity AS name, COUNT(*) AS value
|
||||
FROM sheep_file
|
||||
WHERE status_id = 1 AND name = '泌乳羊'
|
||||
GROUP BY parity
|
||||
ORDER BY parity
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -7,12 +7,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="Deworm" id="DewormResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="sheepNo" column="sheep_no"/>
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="breed" column="breed"/>
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="technical" column="technical" />
|
||||
<result property="comment" column="comment" />
|
||||
@@ -23,7 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDewormVo">
|
||||
select id, sheep_id, usage_id, variety, sheep_type, gender, month_age, parity, datetime, technical, comment, update_by, update_time, create_by, create_time from sw_deworm
|
||||
select s.id, sheep_id, usage_id, variety, sheep_type, s.gender, month_age, s.parity,breed, datetime, technical, s.comment, s.update_by, s.update_time, s.create_by, s.create_time,
|
||||
bs.manage_tags sheep_no
|
||||
from sw_deworm s
|
||||
left join bas_sheep bs on s.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectDewormList" parameterType="Deworm" resultMap="DewormResult">
|
||||
@@ -37,43 +42,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectDewormById" parameterType="Long" resultMap="DewormResult">
|
||||
<include refid="selectDewormVo"/>
|
||||
where id = #{id}
|
||||
where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeworm" parameterType="Deworm" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="insertDeworm" parameterType="java.util.List">
|
||||
insert into sw_deworm
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="variety != null">variety,</if>
|
||||
<if test="sheepType != null">sheep_type,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="monthAge != null">month_age,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="technical != null">technical,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="variety != null">#{variety},</if>
|
||||
<if test="sheepType != null">#{sheepType},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
<if test="monthAge != null">#{monthAge},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="technical != null">#{technical},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
(sheep_id, usage_id, variety, sheep_type, gender, month_age,
|
||||
parity, breed,datetime, technical, comment,
|
||||
update_by, update_time, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType},
|
||||
#{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime},
|
||||
#{d.technical}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateDeworm" parameterType="Deworm">
|
||||
|
||||
@@ -8,10 +8,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="id" column="id" />
|
||||
<result property="treatId" column="treat_id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="sheepNo" column="sheep_no"/>
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="monthAge" column="month_age"/>
|
||||
<result property="parity" column="parity" />
|
||||
<result property="diseasePName" column="disease_pname"/>
|
||||
<result property="diseaseName" column="disease_name"/>
|
||||
<result property="diseasePid" column="disease_pid" />
|
||||
<result property="diseaseId" column="disease_id" />
|
||||
<result property="result" column="result" />
|
||||
@@ -19,30 +23,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="enddate" column="enddate" />
|
||||
<result property="treatDay" column="treat_day" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="sheepfold" column="sheepfold_name"/>
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDiagnosisVo">
|
||||
select id, treat_id, sheep_id, datetime, sheep_type, gender, parity, disease_pid, disease_id, result, begindate, enddate, treat_day, sheepfold_id, create_by, create_time from sw_diagnosis
|
||||
select sd.id, treat_id, sheep_id, sd.datetime, sheep_type, sd.gender,sd.month_age,sd.parity, disease_pid, disease_id,
|
||||
result, begindate, enddate, treat_day, sd.sheepfold_id, sd.create_by, sd.create_time,
|
||||
sf.bs_manage_tags sheep_no,sf.sheepfold_name ,
|
||||
s2.name disease_pname,s1.name disease_name
|
||||
from sw_diagnosis sd
|
||||
left join sheep_file sf on sf.id = sd.sheep_id
|
||||
left join sw_disease s1 on sd.disease_id = s1.id
|
||||
left join sw_disease s2 on sd.disease_pid = s2.id
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="selectDiagnosisList" parameterType="Diagnosis" resultMap="DiagnosisResult">
|
||||
<include refid="selectDiagnosisVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="sheepId != null "> and sd.sheep_id = #{sheepId}</if>
|
||||
<if test="sheepNo != null"> and sf.bs_manage_tags like concat('%', #{sheepNo}, '%')</if>
|
||||
<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="diseasePid != null "> and disease_pid = #{diseasePid}</if>
|
||||
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>
|
||||
<if test="result != null "> and result = #{result}</if>
|
||||
<if test="treatDay != null "> and treat_day = #{treatDay}</if>
|
||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="sheepfoldId != null "> and sd.sheepfold_id = #{sheepfoldId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDiagnosisById" parameterType="Long" resultMap="DiagnosisResult">
|
||||
<include refid="selectDiagnosisVo"/>
|
||||
where id = #{id}
|
||||
where sd.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDiagnosis" parameterType="Diagnosis" useGeneratedKeys="true" keyProperty="id">
|
||||
|
||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="Disinfect" id="DisinfectResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="way" column="way" />
|
||||
@@ -20,7 +21,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDisinfectVo">
|
||||
select id, sheepfold_id, datetime, technician, way, usage_id, ratio, comment, update_by, update_time, create_by, create_time from sw_disinfect
|
||||
select sd.id, sheepfold_id, datetime, technician, way, usage_id, ratio, sd.comment, update_by, update_time, create_by, create_time,
|
||||
ds.sheepfold_name
|
||||
from sw_disinfect sd
|
||||
left join da_sheepfold ds on sd.sheepfold_id = ds.id
|
||||
</sql>
|
||||
|
||||
<select id="selectDisinfectList" parameterType="Disinfect" resultMap="DisinfectResult">
|
||||
@@ -38,37 +42,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectDisinfectById" parameterType="Long" resultMap="DisinfectResult">
|
||||
<include refid="selectDisinfectVo"/>
|
||||
where id = #{id}
|
||||
where sd.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDisinfect" parameterType="Disinfect" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_disinfect
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="way != null">way,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="ratio != null">ratio,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="way != null">#{way},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="ratio != null">#{ratio},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
(sheepfold_id, datetime, technician, way, usage_id, ratio, comment, update_by, update_time, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepfoldId}, #{d.datetime}, #{d.technician}, #{d.way},
|
||||
#{d.usageId}, #{d.ratio}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateDisinfect" parameterType="Disinfect">
|
||||
@@ -86,7 +71,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 id = #{id}
|
||||
where sd.id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDisinfectById" parameterType="Long">
|
||||
|
||||
@@ -8,13 +8,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="id" column="id" />
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="sheepNo" column="sheep_no"/>
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="breed" column="breed" />
|
||||
<result property="technical" column="technical" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
@@ -24,7 +25,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHealthVo">
|
||||
select id, datetime, sheep_id, usage_id, variety, sheep_type, gender, month_age, parity, sheepfold_id, technical, comment, update_by, update_time, create_by, create_time from sw_health
|
||||
select s.id, datetime, sheep_id, usage_id, variety, sheep_type, s.gender, month_age, s.parity, breed, technical,
|
||||
s.comment, s.update_by, s.update_time, s.create_by, s.create_time,
|
||||
bs.manage_tags sheep_no
|
||||
from sw_health s
|
||||
left join bas_sheep bs on s.sheep_id = bs.id
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="selectHealthList" parameterType="Health" resultMap="HealthResult">
|
||||
@@ -37,45 +43,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectHealthById" parameterType="Long" resultMap="HealthResult">
|
||||
<include refid="selectHealthVo"/>
|
||||
where id = #{id}
|
||||
where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertHealth" parameterType="Health" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_health
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="variety != null">variety,</if>
|
||||
<if test="sheepType != null">sheep_type,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="monthAge != null">month_age,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="technical != null">technical,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="variety != null">#{variety},</if>
|
||||
<if test="sheepType != null">#{sheepType},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
<if test="monthAge != null">#{monthAge},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="technical != null">#{technical},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
(sheep_id, usage_id, variety, sheep_type, gender, month_age,
|
||||
parity, breed,datetime, technical, comment,
|
||||
update_by, update_time, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType},
|
||||
#{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime},
|
||||
#{d.technical}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateHealth" parameterType="Health">
|
||||
@@ -89,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="gender != null">gender = #{gender},</if>
|
||||
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="breed != null">breed = #{breed},</if>
|
||||
<if test="technical != null">technical = #{technical},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
|
||||
@@ -7,24 +7,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="Immunity" id="ImmunityResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="sheepNo" column="sheep_no"/>
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="breed" column="breed"/>
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="technical" column="technical" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectImmunityVo">
|
||||
select id, sheep_id, usage_id, variety, sheep_type, gender, month_age, parity, sheepfold_id, datetime, technical, comment, update_by, update_time, create_by, create_time from sw_immunity
|
||||
select s.id, datetime, sheep_id, usage_id, variety, sheep_type, s.gender, month_age, s.parity, breed, technical,
|
||||
s.comment, s.update_by, s.update_time, s.create_by, s.create_time,
|
||||
bs.manage_tags sheep_no
|
||||
from sw_immunity s
|
||||
left join bas_sheep bs on s.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectImmunityList" parameterType="Immunity" resultMap="ImmunityResult">
|
||||
@@ -39,45 +43,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectImmunityById" parameterType="Long" resultMap="ImmunityResult">
|
||||
<include refid="selectImmunityVo"/>
|
||||
where id = #{id}
|
||||
where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertImmunity" parameterType="Immunity" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_immunity
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="variety != null">variety,</if>
|
||||
<if test="sheepType != null">sheep_type,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="monthAge != null">month_age,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="technical != null">technical,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="variety != null">#{variety},</if>
|
||||
<if test="sheepType != null">#{sheepType},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
<if test="monthAge != null">#{monthAge},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="technical != null">#{technical},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
(sheep_id, usage_id, variety, sheep_type, gender, month_age,
|
||||
parity, breed,datetime, technical, comment,
|
||||
update_by, update_time, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="d" separator=",">
|
||||
(#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType},
|
||||
#{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime},
|
||||
#{d.technical}, #{d.comment},
|
||||
#{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateImmunity" parameterType="Immunity">
|
||||
@@ -90,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="gender != null">gender = #{gender},</if>
|
||||
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="breed != null">breed = #{breed},</if>
|
||||
<if test="datetime != null">datetime = #{datetime},</if>
|
||||
<if test="technical != null">technical = #{technical},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
|
||||
@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="diseaseId" column="disease_id" />
|
||||
<result property="diseaseName" column="disease_name"/>
|
||||
<result property="diseasePid" column="disease_pid" />
|
||||
<result property="diseasePName" column="disease_pname"/>
|
||||
<result property="veterinary" column="veterinary" />
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="comment" column="comment" />
|
||||
@@ -33,10 +34,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<sql id="selectTreatmentVo">
|
||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
||||
bs.manage_tags,
|
||||
sd.name disease_name
|
||||
sd.name disease_name,
|
||||
sd2.name disease_pname
|
||||
from sw_treatment t
|
||||
left join bas_sheep bs on t.sheep_id = bs.id
|
||||
left join sw_disease sd on t.disease_id = sd.id
|
||||
left join sw_disease sd2 on t.disease_pid = sd2.id
|
||||
</sql>
|
||||
|
||||
<select id="selectTreatmentList" parameterType="Treatment" resultMap="TreatmentResult">
|
||||
|
||||
@@ -1,60 +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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.breed.mapper.ScPregnancyRecordMapper">
|
||||
|
||||
|
||||
<resultMap type="ScPregnancyRecord" id="ScPregnancyRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="manageTags" column="manage_tags" />
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="result" column="result" />
|
||||
<result property="number" column="number" />
|
||||
<result property="fetusCount" column="fetus_count" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="way" column="way" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="create_by" />
|
||||
<result property="updateTime" column="create_time" />
|
||||
<!-- 关联羊只信息字段 -->
|
||||
<result property="variety" column="variety" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="matingCounts" column="mating_counts" />
|
||||
<result property="sheepfoldName" column="sheepfold_name" />
|
||||
<result property="breedStatus" column="breed" />
|
||||
<result property="fatherManageTags" column="father_manage_tags" />
|
||||
<result property="fatherVariety" column="father_variety" />
|
||||
<result property="matingTypeName" column="mating_type_name" />
|
||||
<result property="matingDate" column="mating_date" />
|
||||
<result property="expectedDate" column="expected_date" />
|
||||
<result property="lastEventDate" column="last_event_date" />
|
||||
<result property="ranchName" column="ranch" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScPregnancyRecordVo">
|
||||
select id, datetime, result, number, technician, way, create_by, create_time from sc_pregnancy_record
|
||||
select
|
||||
pr.id,
|
||||
pr.sheep_id,
|
||||
pr.datetime,
|
||||
pr.result,
|
||||
pr.fetus_count,
|
||||
pr.technician,
|
||||
pr.way,
|
||||
pr.remark,
|
||||
pr.create_by,
|
||||
pr.create_time,
|
||||
pr.create_by,
|
||||
pr.create_time,
|
||||
sf.bs_manage_tags as manage_tags,
|
||||
sf.variety,
|
||||
sf.month_age,
|
||||
sf.parity,
|
||||
sf.mating_counts,
|
||||
sf.sheepfold_name,
|
||||
sf.breed,
|
||||
sf.father_manage_tags,
|
||||
father_sf.variety as father_variety,
|
||||
mating_type.dict_label as mating_type_name,
|
||||
sf.mating_date,
|
||||
sf.expected_date,
|
||||
sf.lambing_date as last_event_date,
|
||||
r.ranch as ranch
|
||||
from sc_pregnancy_record pr
|
||||
left join sheep_file sf on pr.sheep_id = sf.id
|
||||
left join sys_dict_data mating_type on sf.mating_type_id = mating_type.dict_value and mating_type.dict_type = 'breed_type' and mating_type.status = '0'
|
||||
left join da_ranch r on sf.ranch_id = r.id
|
||||
left join sheep_file father_sf on sf.bs_father_id = father_sf.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScPregnancyRecordList" parameterType="ScPregnancyRecord" resultMap="ScPregnancyRecordResult">
|
||||
<include refid="selectScPregnancyRecordVo"/>
|
||||
<where>
|
||||
<if test="datetime != null "> and datetime = #{datetime}</if>
|
||||
<if test="result != null and result != ''"> and result = #{result}</if>
|
||||
<if test="number != null "> and number = #{number}</if>
|
||||
<if test="technician != null and technician != ''"> and technician = #{technician}</if>
|
||||
<if test="way != null "> and way = #{way}</if>
|
||||
<where>
|
||||
pr.is_delete = 0
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
<choose>
|
||||
<when test="manageTags.contains(',')">
|
||||
and sf.bs_manage_tags in
|
||||
<foreach item="tag" collection="manageTags.split(',')" open="(" separator="," close=")">
|
||||
#{tag}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
and sf.bs_manage_tags like concat('%', #{manageTags}, '%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="datetime != null "> and pr.datetime = #{datetime}</if>
|
||||
<if test="result != null and result != ''"> and pr.result = #{result}</if>
|
||||
<if test="technician != null and technician != ''"> and pr.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="way != null and way != ''"> and pr.way = #{way}</if>
|
||||
</where>
|
||||
order by pr.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectScPregnancyRecordById" parameterType="Long" resultMap="ScPregnancyRecordResult">
|
||||
<include refid="selectScPregnancyRecordVo"/>
|
||||
where id = #{id}
|
||||
where pr.id = #{id} and pr.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据耳号查询羊只信息 -->
|
||||
<select id="selectSheepByManageTags" parameterType="String" resultType="map">
|
||||
select
|
||||
id,
|
||||
bs_manage_tags as manageTags,
|
||||
variety,
|
||||
month_age as monthAge,
|
||||
parity,
|
||||
mating_counts as matingCounts,
|
||||
sheepfold_name as sheepfoldName,
|
||||
breed as breedStatus
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags}
|
||||
and is_delete = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertScPregnancyRecord" parameterType="ScPregnancyRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_pregnancy_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="result != null">result,</if>
|
||||
<if test="number != null">number,</if>
|
||||
<if test="fetusCount != null">fetus_count,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="way != null">way,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
is_delete
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="result != null">#{result},</if>
|
||||
<if test="number != null">#{number},</if>
|
||||
<if test="fetusCount != null">#{fetusCount},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="way != null">#{way},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScPregnancyRecord" parameterType="ScPregnancyRecord">
|
||||
@@ -62,23 +149,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="datetime != null">datetime = #{datetime},</if>
|
||||
<if test="result != null">result = #{result},</if>
|
||||
<if test="number != null">number = #{number},</if>
|
||||
<if test="fetusCount != null">fetus_count = #{fetusCount},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="way != null">way = #{way},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null">create_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">create_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScPregnancyRecordById" parameterType="Long">
|
||||
delete from sc_pregnancy_record where id = #{id}
|
||||
</delete>
|
||||
<update id="deleteScPregnancyRecordById" parameterType="Long">
|
||||
update sc_pregnancy_record set is_delete = 1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScPregnancyRecordByIds" parameterType="String">
|
||||
delete from sc_pregnancy_record where id in
|
||||
<update id="deleteScPregnancyRecordByIds" parameterType="String">
|
||||
update sc_pregnancy_record set is_delete = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<!-- 更新羊只基础表中的孕检相关字段 -->
|
||||
<update id="updateSheepPregnancyInfo" parameterType="map">
|
||||
update bas_sheep
|
||||
<set>
|
||||
<if test="pregDate != null">preg_date = #{pregDate},</if>
|
||||
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
|
||||
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
|
||||
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
|
||||
create_time = now()
|
||||
</set>
|
||||
where id = #{sheepId}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user