Merge remote-tracking branch 'origin/main'
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>
|
||||
@@ -52,19 +52,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="groupId != null"> AND m.group_id = #{groupId}</if>
|
||||
<if test="bsManageTags != null and bsManageTags.size > 0">
|
||||
AND s.bs_manage_tags IN
|
||||
<foreach collection="bsManageTags" item="bsManageTag " open="(" separator="," close=")">
|
||||
#{bsManageTag}
|
||||
<foreach collection="bsManageTags" item="tag" open="(" separator="," close=")">
|
||||
#{tag}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY m.id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
|
||||
<include refid="selectBasSheepGroupMappingVo"/>
|
||||
@@ -102,4 +97,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<!-- 根据耳号查询羊只ID -->
|
||||
<select id="selectSheepIdsByEarTags" parameterType="list" resultType="map">
|
||||
SELECT id, manage_tags
|
||||
FROM bas_sheep
|
||||
WHERE manage_tags IN
|
||||
<foreach collection="earTags" item="tag" open="(" separator="," close=")">
|
||||
#{tag}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO bas_sheep_group_mapping (sheep_id, group_id)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.sheepId}, #{item.groupId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectListByGroupId"
|
||||
resultMap="BasSheepGroupMappingResult">
|
||||
SELECT id, sheep_id, group_id
|
||||
FROM bas_sheep_group_mapping
|
||||
WHERE group_id = #{groupId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,122 +1,177 @@
|
||||
<?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.base.mapper.BasSheepMapper">
|
||||
|
||||
<resultMap type="BasSheep" id="BasSheepResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="manageTags" column="manage_tags" />
|
||||
<result property="ranchId" column="ranch_id" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="electronicTags" column="electronic_tags" />
|
||||
<result property="varietyId" column="variety_id" />
|
||||
<result property="family" column="family" />
|
||||
<result property="typeId" column="type_id" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="birthday" column="birthday" />
|
||||
<result property="birthWeight" column="birth_weight" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="statusId" column="status_id" />
|
||||
<result property="weaningDate" column="weaning_date" />
|
||||
<result property="weaningWeight" column="weaning_weight" />
|
||||
<result property="breedStatusId" column="breed_status_id" />
|
||||
<result property="fatherId" column="father_id" />
|
||||
<result property="motherId" column="mother_id" />
|
||||
<result property="receptorId" column="receptor_id" />
|
||||
<result property="matingDate" column="mating_date" />
|
||||
<result property="matingTypeId" column="mating_type_id" />
|
||||
<result property="pregDate" column="preg_date" />
|
||||
<result property="lambingDate" column="lambing_date" />
|
||||
<result property="lambingDay" column="lambing_day" />
|
||||
<result property="expectedDate" column="expected_date" />
|
||||
<result property="controlled" column="controlled" />
|
||||
<result property="matingCounts" column="mating_counts" />
|
||||
<result property="matingTotal" column="mating_total" />
|
||||
<result property="miscarriageCounts" column="miscarriage_counts" />
|
||||
<result property="body" column="body" />
|
||||
<result property="breast" column="breast" />
|
||||
<result property="source" column="source" />
|
||||
<result property="sourceDate" column="source_date" />
|
||||
<result property="sourceRanchId" column="source_ranch_id" />
|
||||
<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" />
|
||||
<result property="isDelete" column="is_delete" />
|
||||
<resultMap type="com.zhyc.module.base.domain.BasSheep" id="BasSheepResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="ranchId" column="ranch_id"/>
|
||||
<result property="sheepfoldId" column="sheepfold_id"/>
|
||||
<result property="electronicTags" column="electronic_tags"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="family" column="family"/>
|
||||
<result property="typeId" column="type_id"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="birthWeight" column="birth_weight"/>
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="statusId" column="status_id"/>
|
||||
<result property="weaningDate" column="weaning_date"/>
|
||||
<result property="weaningWeight" column="weaning_weight"/>
|
||||
<result property="breedStatusId" column="breed_status_id"/>
|
||||
<result property="fatherId" column="father_id"/>
|
||||
<result property="motherId" column="mother_id"/>
|
||||
<result property="receptorId" column="receptor_id"/>
|
||||
<result property="matingDate" column="mating_date"/>
|
||||
<result property="matingTypeId" column="mating_type_id"/>
|
||||
<result property="pregDate" column="preg_date"/>
|
||||
<result property="lambingDate" column="lambing_date"/>
|
||||
<result property="lambingDay" column="lambing_day"/>
|
||||
<result property="expectedDate" column="expected_date"/>
|
||||
<result property="controlled" column="controlled"/>
|
||||
<result property="matingCounts" column="mating_counts"/>
|
||||
<result property="matingTotal" column="mating_total"/>
|
||||
<result property="miscarriageCounts" column="miscarriage_counts"/>
|
||||
<result property="body" column="body"/>
|
||||
<result property="breast" column="breast"/>
|
||||
<result property="source" column="source"/>
|
||||
<result property="sourceDate" column="source_date"/>
|
||||
<result property="sourceRanchId" column="source_ranch_id"/>
|
||||
<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"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasSheepVo">
|
||||
select id, manage_tags, ranch_id, sheepfold_id, electronic_tags, variety_id, family, type_id, gender, birthday, birth_weight, parity, status_id, weaning_date, weaning_weight, breed_status_id, father_id, mother_id, receptor_id, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, expected_date, controlled, mating_counts, mating_total, miscarriage_counts, body, breast, source, source_date, source_ranch_id, comment, update_by, update_time, create_by, create_time, is_delete from bas_sheep
|
||||
select id,
|
||||
manage_tags,
|
||||
ranch_id,
|
||||
sheepfold_id,
|
||||
electronic_tags,
|
||||
variety_id,
|
||||
family,
|
||||
type_id,
|
||||
gender,
|
||||
birthday,
|
||||
birth_weight,
|
||||
parity,
|
||||
status_id,
|
||||
weaning_date,
|
||||
weaning_weight,
|
||||
breed_status_id,
|
||||
father_id,
|
||||
mother_id,
|
||||
receptor_id,
|
||||
mating_date,
|
||||
mating_type_id,
|
||||
preg_date,
|
||||
lambing_date,
|
||||
lambing_day,
|
||||
expected_date,
|
||||
controlled,
|
||||
mating_counts,
|
||||
mating_total,
|
||||
miscarriage_counts,
|
||||
body,
|
||||
breast,
|
||||
source,
|
||||
source_date,
|
||||
source_ranch_id,
|
||||
comment,
|
||||
update_by,
|
||||
update_time,
|
||||
create_by,
|
||||
create_time,
|
||||
is_delete
|
||||
from bas_sheep
|
||||
</sql>
|
||||
|
||||
<select id="selectBasSheepList" parameterType="BasSheep" resultMap="BasSheepResult">
|
||||
<include refid="selectBasSheepVo"/>
|
||||
<where>
|
||||
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
|
||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
|
||||
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
|
||||
<if test="family != null and family != ''"> and family = #{family}</if>
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
<if test="gender != null "> and gender = #{gender}</if>
|
||||
<if test="birthday != null "> and birthday = #{birthday}</if>
|
||||
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
|
||||
<if test="parity != null "> and parity = #{parity}</if>
|
||||
<if test="statusId != null "> and status_id = #{statusId}</if>
|
||||
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
|
||||
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
|
||||
<if test="breedStatusId != null "> and breed_status_id = #{breedStatusId}</if>
|
||||
<if test="fatherId != null "> and father_id = #{fatherId}</if>
|
||||
<if test="motherId != null "> and mother_id = #{motherId}</if>
|
||||
<if test="receptorId != null "> and receptor_id = #{receptorId}</if>
|
||||
<if test="matingDate != null "> and mating_date = #{matingDate}</if>
|
||||
<if test="matingTypeId != null "> and mating_type_id = #{matingTypeId}</if>
|
||||
<if test="pregDate != null "> and preg_date = #{pregDate}</if>
|
||||
<if test="lambingDate != null "> and lambing_date = #{lambingDate}</if>
|
||||
<if test="lambingDay != null "> and lambing_day = #{lambingDay}</if>
|
||||
<if test="expectedDate != null "> and expected_date = #{expectedDate}</if>
|
||||
<if test="controlled != null "> and controlled = #{controlled}</if>
|
||||
<if test="matingCounts != null "> and mating_counts = #{matingCounts}</if>
|
||||
<if test="matingTotal != null "> and mating_total = #{matingTotal}</if>
|
||||
<if test="miscarriageCounts != null "> and miscarriage_counts = #{miscarriageCounts}</if>
|
||||
<if test="body != null "> and body = #{body}</if>
|
||||
<if test="breast != null "> and breast = #{breast}</if>
|
||||
<if test="source != null and source != ''"> and source = #{source}</if>
|
||||
<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="manageTags != null and manageTags != ''">and manage_tags = #{manageTags}</if>
|
||||
<if test="ranchId != null ">and ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldId != null ">and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="electronicTags != null and electronicTags != ''">and electronic_tags = #{electronicTags}</if>
|
||||
<if test="varietyId != null ">and variety_id = #{varietyId}</if>
|
||||
<if test="family != null and family != ''">and family = #{family}</if>
|
||||
<if test="typeId != null ">and type_id = #{typeId}</if>
|
||||
<if test="gender != null ">and gender = #{gender}</if>
|
||||
<if test="birthday != null ">and birthday = #{birthday}</if>
|
||||
<if test="birthWeight != null ">and birth_weight = #{birthWeight}</if>
|
||||
<if test="parity != null ">and parity = #{parity}</if>
|
||||
<if test="statusId != null ">and status_id = #{statusId}</if>
|
||||
<if test="weaningDate != null ">and weaning_date = #{weaningDate}</if>
|
||||
<if test="weaningWeight != null ">and weaning_weight = #{weaningWeight}</if>
|
||||
<if test="breedStatusId != null ">and breed_status_id = #{breedStatusId}</if>
|
||||
<if test="fatherId != null ">and father_id = #{fatherId}</if>
|
||||
<if test="motherId != null ">and mother_id = #{motherId}</if>
|
||||
<if test="receptorId != null ">and receptor_id = #{receptorId}</if>
|
||||
<if test="matingDate != null ">and mating_date = #{matingDate}</if>
|
||||
<if test="matingTypeId != null ">and mating_type_id = #{matingTypeId}</if>
|
||||
<if test="pregDate != null ">and preg_date = #{pregDate}</if>
|
||||
<if test="lambingDate != null ">and lambing_date = #{lambingDate}</if>
|
||||
<if test="lambingDay != null ">and lambing_day = #{lambingDay}</if>
|
||||
<if test="expectedDate != null ">and expected_date = #{expectedDate}</if>
|
||||
<if test="controlled != null ">and controlled = #{controlled}</if>
|
||||
<if test="matingCounts != null ">and mating_counts = #{matingCounts}</if>
|
||||
<if test="matingTotal != null ">and mating_total = #{matingTotal}</if>
|
||||
<if test="miscarriageCounts != null ">and miscarriage_counts = #{miscarriageCounts}</if>
|
||||
<if test="body != null ">and body = #{body}</if>
|
||||
<if test="breast != null ">and breast = #{breast}</if>
|
||||
<if test="source != null and source != ''">and source = #{source}</if>
|
||||
<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>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
|
||||
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="com.zhyc.module.base.domain.BasSheep">
|
||||
SELECT s.id,
|
||||
s.sheepfold_id AS sheepfoldId,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
s.variety_id AS varietyId,
|
||||
bv.variety AS varietyName
|
||||
s.manage_tags AS manageTags,
|
||||
s.electronic_tags AS electronicTags,
|
||||
s.sheepfold_id AS sheepfoldId,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
s.variety_id AS varietyId,
|
||||
bv.variety AS varietyName
|
||||
FROM bas_sheep s
|
||||
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
|
||||
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
|
||||
WHERE s.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepByManageTags" parameterType="BasSheep" resultMap="BasSheepResult">
|
||||
<include refid="selectBasSheepVo"/>
|
||||
<where>
|
||||
manage_tags = #{manageTags}
|
||||
</where>
|
||||
|
||||
<select id="selectBasSheepByManageTags" parameterType="String" resultMap="BasSheepResult">
|
||||
SELECT s.*,
|
||||
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
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepBySheepfold" parameterType="BasSheep" resultMap="BasSheepResult">
|
||||
<include refid="selectBasSheepVo"/>
|
||||
<where>
|
||||
sheepfold_id = #{id}
|
||||
</where>
|
||||
<where>
|
||||
sheepfold_id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getSheepByRanchId" resultMap="BasSheepResult">
|
||||
SELECT *
|
||||
FROM bas_sheep
|
||||
WHERE ranch_id = #{ranchId}
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepListByIds" parameterType="list" resultMap="BasSheepResult">
|
||||
SELECT * FROM bas_sheep WHERE id IN
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -161,7 +216,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="manageTags != null">#{manageTags},</if>
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
@@ -202,7 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasSheep" parameterType="BasSheep">
|
||||
@@ -252,7 +307,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasSheepById" parameterType="Long">
|
||||
delete from bas_sheep where id = #{id}
|
||||
delete
|
||||
from bas_sheep
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasSheepByIds" parameterType="String">
|
||||
@@ -262,5 +319,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="existsByManageTag" resultType="int">
|
||||
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>
|
||||
</mapper>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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.BasSheepTypeMapper">
|
||||
|
||||
<resultMap type="BasSheepType" id="BasSheepTypeResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasSheepTypeVo">
|
||||
select id, name from bas_sheep_type
|
||||
</sql>
|
||||
|
||||
<select id="selectBasSheepTypeList" parameterType="BasSheepType" resultMap="BasSheepTypeResult">
|
||||
<include refid="selectBasSheepTypeVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepTypeById" parameterType="Integer" resultMap="BasSheepTypeResult">
|
||||
<include refid="selectBasSheepTypeVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBasSheepType" parameterType="BasSheepType" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bas_sheep_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasSheepType" parameterType="BasSheepType">
|
||||
update bas_sheep_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasSheepTypeById" parameterType="Integer">
|
||||
delete from bas_sheep_type where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasSheepTypeByIds" parameterType="String">
|
||||
delete from bas_sheep_type where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,25 +1,26 @@
|
||||
<?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.base.mapper.BasSheepVarietyMapper">
|
||||
|
||||
|
||||
<resultMap type="BasSheepVariety" id="BasSheepVarietyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="variety" column="variety"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasSheepVarietyVo">
|
||||
select id, variety from bas_sheep_variety
|
||||
select id, variety
|
||||
from bas_sheep_variety
|
||||
</sql>
|
||||
|
||||
<select id="selectBasSheepVarietyList" parameterType="BasSheepVariety" resultMap="BasSheepVarietyResult">
|
||||
<include refid="selectBasSheepVarietyVo"/>
|
||||
<where>
|
||||
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
|
||||
<where>
|
||||
<if test="variety != null and variety != ''">and variety = #{variety}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectBasSheepVarietyById" parameterType="Long" resultMap="BasSheepVarietyResult">
|
||||
<include refid="selectBasSheepVarietyVo"/>
|
||||
where id = #{id}
|
||||
@@ -29,10 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into bas_sheep_variety
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="variety != null">variety,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="variety != null">#{variety},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasSheepVariety" parameterType="BasSheepVariety">
|
||||
@@ -44,13 +45,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasSheepVarietyById" parameterType="Long">
|
||||
delete from bas_sheep_variety where id = #{id}
|
||||
delete
|
||||
from bas_sheep_variety
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasSheepVarietyByIds" parameterType="String">
|
||||
delete from bas_sheep_variety where id in
|
||||
delete from bas_sheep_variety where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectIdByName" parameterType="string" resultType="java.lang.Long">
|
||||
SELECT id
|
||||
FROM bas_sheep_variety
|
||||
WHERE variety = #{varietyName} LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectByVarietyName" parameterType="String" resultMap="BasSheepVarietyResult">
|
||||
SELECT id, variety
|
||||
FROM bas_sheep_variety
|
||||
WHERE variety = #{varietyName} LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
59
zhyc-module/src/main/resources/mapper/base/DaRanchMapper.xml
Normal file
59
zhyc-module/src/main/resources/mapper/base/DaRanchMapper.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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.DaRanchMapper">
|
||||
|
||||
<resultMap type="DaRanch" id="DaRanchResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="ranch" column="ranch"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDaRanchVo">
|
||||
select id, ranch
|
||||
from da_ranch
|
||||
</sql>
|
||||
|
||||
<select id="selectDaRanchList" parameterType="DaRanch" resultMap="DaRanchResult">
|
||||
<include refid="selectDaRanchVo"/>
|
||||
<where>
|
||||
<if test="ranch != null and ranch != ''">and ranch = #{ranch}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDaRanchById" parameterType="Long" resultMap="DaRanchResult">
|
||||
<include refid="selectDaRanchVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDaRanch" parameterType="DaRanch" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into da_ranch
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ranch != null">ranch,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ranch != null">#{ranch},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDaRanch" parameterType="DaRanch">
|
||||
update da_ranch
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ranch != null">ranch = #{ranch},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDaRanchById" parameterType="Long">
|
||||
delete
|
||||
from da_ranch
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDaRanchByIds" parameterType="String">
|
||||
delete from da_ranch where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,32 +1,40 @@
|
||||
<?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.base.mapper.DaSheepfoldMapper">
|
||||
|
||||
<resultMap type="DaSheepfold" id="DaSheepfoldResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ranchId" column="ranch_id" />
|
||||
<result property="sheepfoldName" column="sheepfold_name" />
|
||||
<result property="sheepfoldTypeId" column="sheepfold_type_id" />
|
||||
<result property="sheepfoldNo" column="sheepfold_no" />
|
||||
<result property="rowNo" column="row_no" />
|
||||
<result property="columns" column="columns" />
|
||||
<result property="comment" column="comment" />
|
||||
|
||||
<resultMap type="com.zhyc.module.base.domain.DaSheepfold" id="DaSheepfoldResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="ranchId" column="ranch_id"/>
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="sheepfoldTypeId" column="sheepfold_type_id"/>
|
||||
<result property="sheepfoldNo" column="sheepfold_no"/>
|
||||
<result property="rowNo" column="row_no"/>
|
||||
<result property="columns" column="columns"/>
|
||||
<result property="comment" column="comment"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDaSheepfoldVo">
|
||||
select id, ranch_id, sheepfold_name, sheepfold_type_id, sheepfold_no, row_no, columns, comment from da_sheepfold
|
||||
select id,
|
||||
ranch_id,
|
||||
sheepfold_name,
|
||||
sheepfold_type_id,
|
||||
sheepfold_no,
|
||||
row_no,
|
||||
columns,
|
||||
comment
|
||||
from da_sheepfold
|
||||
</sql>
|
||||
|
||||
<select id="selectDaSheepfoldList" parameterType="DaSheepfold" resultMap="DaSheepfoldResult">
|
||||
<include refid="selectDaSheepfoldVo"/>
|
||||
<where>
|
||||
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldTypeId != null "> and sheepfold_type_id = #{sheepfoldTypeId}</if>
|
||||
<where>
|
||||
<if test="ranchId != null ">and ranch_id = #{ranchId}</if>
|
||||
<if test="sheepfoldTypeId != null ">and sheepfold_type_id = #{sheepfoldTypeId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectDaSheepfoldById" parameterType="Long" resultMap="DaSheepfoldResult">
|
||||
<include refid="selectDaSheepfoldVo"/>
|
||||
where id = #{id}
|
||||
@@ -42,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="rowNo != null">row_no,</if>
|
||||
<if test="columns != null">columns,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
<if test="sheepfoldName != null">#{sheepfoldName},</if>
|
||||
@@ -51,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="rowNo != null">#{rowNo},</if>
|
||||
<if test="columns != null">#{columns},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDaSheepfold" parameterType="DaSheepfold">
|
||||
@@ -69,11 +77,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteDaSheepfoldById" parameterType="Long">
|
||||
delete from da_sheepfold where id = #{id}
|
||||
delete
|
||||
from da_sheepfold
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDaSheepfoldByIds" parameterType="String">
|
||||
delete from da_sheepfold where id in
|
||||
delete from da_sheepfold where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
@@ -94,223 +94,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectSheepFileVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectSheepByManageTags" parameterType="String" resultMap="SheepFileResult">
|
||||
<include refid="selectSheepFileVo"/>
|
||||
where bs_manage_tags = #{tags}
|
||||
</select>
|
||||
|
||||
<insert id="insertSheepFile" parameterType="SheepFile">
|
||||
insert into sheep_file
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="bsManageTags != null">bs_manage_tags,</if>
|
||||
<if test="ranchId != null">ranch_id,</if>
|
||||
<if test="drRanch != null">dr_ranch,</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="family != null">family,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="gender != null">gender,</if>
|
||||
<if test="birthday != null">birthday,</if>
|
||||
<if test="dayAge != null">day_age,</if>
|
||||
<if test="monthAge != null">month_age,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="birthWeight != null">birth_weight,</if>
|
||||
<if test="weaningDate != null">weaning_date,</if>
|
||||
<if test="statusId != null">status_id,</if>
|
||||
<if test="weaningWeight != null">weaning_weight,</if>
|
||||
<if test="currentWeight != null">current_weight,</if>
|
||||
<if test="breedStatusId != null">breed_status_id,</if>
|
||||
<if test="breed != null">breed,</if>
|
||||
<if test="bsFatherId != null">bs_father_id,</if>
|
||||
<if test="fatherManageTags != null">father_manage_tags,</if>
|
||||
<if test="bsMotherId != null">bs_mother_id,</if>
|
||||
<if test="motherManageTags != null">mother_manage_tags,</if>
|
||||
<if test="receptorId != null">receptor_id,</if>
|
||||
<if test="receptorManageTags != null">receptor_manage_tags,</if>
|
||||
<if test="fatherFatherId != null">father_father_id,</if>
|
||||
<if test="grandfatherManageTags != null">grandfather_manage_tags,</if>
|
||||
<if test="fatherMotherId != null">father_mother_id,</if>
|
||||
<if test="grandmotherManageTags != null">grandmother_manage_tags,</if>
|
||||
<if test="fatherId != null">father_id,</if>
|
||||
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags,</if>
|
||||
<if test="motherId != null">mother_id,</if>
|
||||
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags,</if>
|
||||
<if test="matingDate != null">mating_date,</if>
|
||||
<if test="matingTypeId != null">mating_type_id,</if>
|
||||
<if test="pregDate != null">preg_date,</if>
|
||||
<if test="lambingDate != null">lambing_date,</if>
|
||||
<if test="lambingDay != null">lambing_day,</if>
|
||||
<if test="matingDay != null">mating_day,</if>
|
||||
<if test="gestationDay != null">gestation_day,</if>
|
||||
<if test="expectedDate != null">expected_date,</if>
|
||||
<if test="postLambingDay != null">post_lambing_day,</if>
|
||||
<if test="lactationDay != null">lactation_day,</if>
|
||||
<if test="anestrousDay != null">anestrous_day,</if>
|
||||
<if test="matingCounts != null">mating_counts,</if>
|
||||
<if test="matingTotal != null">mating_total,</if>
|
||||
<if test="miscarriageCounts != null">miscarriage_counts,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="controlled != null">controlled,</if>
|
||||
<if test="body != null">body,</if>
|
||||
<if test="breast != null">breast,</if>
|
||||
<if test="source != null">source,</if>
|
||||
<if test="sourceDate != null">source_date,</if>
|
||||
<if test="sourceRanchId != null">source_ranch_id,</if>
|
||||
<if test="sourceRanch != null">source_ranch,</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>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="bsManageTags != null">#{bsManageTags},</if>
|
||||
<if test="ranchId != null">#{ranchId},</if>
|
||||
<if test="drRanch != null">#{drRanch},</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="family != null">#{family},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="gender != null">#{gender},</if>
|
||||
<if test="birthday != null">#{birthday},</if>
|
||||
<if test="dayAge != null">#{dayAge},</if>
|
||||
<if test="monthAge != null">#{monthAge},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="birthWeight != null">#{birthWeight},</if>
|
||||
<if test="weaningDate != null">#{weaningDate},</if>
|
||||
<if test="statusId != null">#{statusId},</if>
|
||||
<if test="weaningWeight != null">#{weaningWeight},</if>
|
||||
<if test="currentWeight != null">#{currentWeight},</if>
|
||||
<if test="breedStatusId != null">#{breedStatusId},</if>
|
||||
<if test="breed != null">#{breed},</if>
|
||||
<if test="bsFatherId != null">#{bsFatherId},</if>
|
||||
<if test="fatherManageTags != null">#{fatherManageTags},</if>
|
||||
<if test="bsMotherId != null">#{bsMotherId},</if>
|
||||
<if test="motherManageTags != null">#{motherManageTags},</if>
|
||||
<if test="receptorId != null">#{receptorId},</if>
|
||||
<if test="receptorManageTags != null">#{receptorManageTags},</if>
|
||||
<if test="fatherFatherId != null">#{fatherFatherId},</if>
|
||||
<if test="grandfatherManageTags != null">#{grandfatherManageTags},</if>
|
||||
<if test="fatherMotherId != null">#{fatherMotherId},</if>
|
||||
<if test="grandmotherManageTags != null">#{grandmotherManageTags},</if>
|
||||
<if test="fatherId != null">#{fatherId},</if>
|
||||
<if test="maternalGrandfatherManageTags != null">#{maternalGrandfatherManageTags},</if>
|
||||
<if test="motherId != null">#{motherId},</if>
|
||||
<if test="maternalGrandmotherManageTags != null">#{maternalGrandmotherManageTags},</if>
|
||||
<if test="matingDate != null">#{matingDate},</if>
|
||||
<if test="matingTypeId != null">#{matingTypeId},</if>
|
||||
<if test="pregDate != null">#{pregDate},</if>
|
||||
<if test="lambingDate != null">#{lambingDate},</if>
|
||||
<if test="lambingDay != null">#{lambingDay},</if>
|
||||
<if test="matingDay != null">#{matingDay},</if>
|
||||
<if test="gestationDay != null">#{gestationDay},</if>
|
||||
<if test="expectedDate != null">#{expectedDate},</if>
|
||||
<if test="postLambingDay != null">#{postLambingDay},</if>
|
||||
<if test="lactationDay != null">#{lactationDay},</if>
|
||||
<if test="anestrousDay != null">#{anestrousDay},</if>
|
||||
<if test="matingCounts != null">#{matingCounts},</if>
|
||||
<if test="matingTotal != null">#{matingTotal},</if>
|
||||
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="controlled != null">#{controlled},</if>
|
||||
<if test="body != null">#{body},</if>
|
||||
<if test="breast != null">#{breast},</if>
|
||||
<if test="source != null">#{source},</if>
|
||||
<if test="sourceDate != null">#{sourceDate},</if>
|
||||
<if test="sourceRanchId != null">#{sourceRanchId},</if>
|
||||
<if test="sourceRanch != null">#{sourceRanch},</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>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSheepFile" parameterType="SheepFile">
|
||||
update sheep_file
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="bsManageTags != null">bs_manage_tags = #{bsManageTags},</if>
|
||||
<if test="ranchId != null">ranch_id = #{ranchId},</if>
|
||||
<if test="drRanch != null">dr_ranch = #{drRanch},</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="family != null">family = #{family},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="gender != null">gender = #{gender},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="dayAge != null">day_age = #{dayAge},</if>
|
||||
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
|
||||
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
|
||||
<if test="statusId != null">status_id = #{statusId},</if>
|
||||
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
|
||||
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
|
||||
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
|
||||
<if test="breed != null">breed = #{breed},</if>
|
||||
<if test="bsFatherId != null">bs_father_id = #{bsFatherId},</if>
|
||||
<if test="fatherManageTags != null">father_manage_tags = #{fatherManageTags},</if>
|
||||
<if test="bsMotherId != null">bs_mother_id = #{bsMotherId},</if>
|
||||
<if test="motherManageTags != null">mother_manage_tags = #{motherManageTags},</if>
|
||||
<if test="receptorId != null">receptor_id = #{receptorId},</if>
|
||||
<if test="receptorManageTags != null">receptor_manage_tags = #{receptorManageTags},</if>
|
||||
<if test="fatherFatherId != null">father_father_id = #{fatherFatherId},</if>
|
||||
<if test="grandfatherManageTags != null">grandfather_manage_tags = #{grandfatherManageTags},</if>
|
||||
<if test="fatherMotherId != null">father_mother_id = #{fatherMotherId},</if>
|
||||
<if test="grandmotherManageTags != null">grandmother_manage_tags = #{grandmotherManageTags},</if>
|
||||
<if test="fatherId != null">father_id = #{fatherId},</if>
|
||||
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags},</if>
|
||||
<if test="motherId != null">mother_id = #{motherId},</if>
|
||||
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags},</if>
|
||||
<if test="matingDate != null">mating_date = #{matingDate},</if>
|
||||
<if test="matingTypeId != null">mating_type_id = #{matingTypeId},</if>
|
||||
<if test="pregDate != null">preg_date = #{pregDate},</if>
|
||||
<if test="lambingDate != null">lambing_date = #{lambingDate},</if>
|
||||
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
|
||||
<if test="matingDay != null">mating_day = #{matingDay},</if>
|
||||
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
|
||||
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
|
||||
<if test="postLambingDay != null">post_lambing_day = #{postLambingDay},</if>
|
||||
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
|
||||
<if test="anestrousDay != null">anestrous_day = #{anestrousDay},</if>
|
||||
<if test="matingCounts != null">mating_counts = #{matingCounts},</if>
|
||||
<if test="matingTotal != null">mating_total = #{matingTotal},</if>
|
||||
<if test="miscarriageCounts != null">miscarriage_counts = #{miscarriageCounts},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="controlled != null">controlled = #{controlled},</if>
|
||||
<if test="body != null">body = #{body},</if>
|
||||
<if test="breast != null">breast = #{breast},</if>
|
||||
<if test="source != null">source = #{source},</if>
|
||||
<if test="sourceDate != null">source_date = #{sourceDate},</if>
|
||||
<if test="sourceRanchId != null">source_ranch_id = #{sourceRanchId},</if>
|
||||
<if test="sourceRanch != null">source_ranch = #{sourceRanch},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSheepFileById" parameterType="Long">
|
||||
delete from sheep_file where id = #{id}
|
||||
</delete>
|
||||
<!-- 在群羊只总数 -->
|
||||
<select id="countInGroup" resultType="java.lang.Long">
|
||||
SELECT COUNT(*) FROM sheep_file WHERE status_id = 1
|
||||
</select>
|
||||
|
||||
<delete id="deleteSheepFileByIds" parameterType="String">
|
||||
delete from sheep_file where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<!-- 羊只类别分布 -->
|
||||
<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>
|
||||
|
||||
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSwMedicineUsageById" parameterType="Long" resultMap="SwMedicineUsageSwMedicineUsageDetailsResult">
|
||||
<select id="selectSwMedicineUsageById" parameterType="Integer" resultMap="SwMedicineUsageSwMedicineUsageDetailsResult">
|
||||
select id, name, use_type, update_by, update_time, create_by, create_time
|
||||
from sw_medicine_usage
|
||||
where id = #{id}
|
||||
@@ -108,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSwMedicineUsageDetailsByMediUsage" parameterType="Long">
|
||||
<delete id="deleteSwMedicineUsageDetailsByMediUsage" parameterType="Integer">
|
||||
delete from sw_medicine_usage_details where medi_usage = #{mediUsage}
|
||||
</delete>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="id" column="id" />
|
||||
<result property="diagId" column="diag_id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="sheepNo" column="manage_tags"/>
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
@@ -18,7 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="gestDay" column="gest_day" />
|
||||
<result property="datetime" column="datetime" />
|
||||
<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" />
|
||||
@@ -29,7 +32,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTreatmentVo">
|
||||
select id, diag_id, sheep_id, variety, sheep_type, month_age, gender, parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, comment, update_by, update_time, create_by, create_time from sw_treatment
|
||||
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,
|
||||
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">
|
||||
@@ -44,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectTreatmentById" parameterType="Long" resultMap="TreatmentResult">
|
||||
<include refid="selectTreatmentVo"/>
|
||||
where id = #{id}
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -95,6 +105,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertTreatmentList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_treatment
|
||||
(diag_id, sheep_id, variety, sheep_type, month_age, gender,
|
||||
parity, breed, lact_day, gest_day, datetime,
|
||||
disease_id, disease_pid, veterinary, usage_id,
|
||||
comment, update_by, update_time, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="t" separator=",">
|
||||
(#{t.diagId}, #{t.sheepId}, #{t.variety}, #{t.sheepType},
|
||||
#{t.monthAge}, #{t.gender}, #{t.parity}, #{t.breed},
|
||||
#{t.lactDay}, #{t.gestDay}, #{t.datetime}, #{t.diseaseId},
|
||||
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.comment},
|
||||
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateTreatment" parameterType="Treatment">
|
||||
update sw_treatment
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
<?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.bodyManage.mapper.ScBodyMeasureMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure" id="ScBodyMeasureResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="height" column="height"/>
|
||||
<result property="bust" column="bust"/>
|
||||
<result property="bodyLength" column="body_length"/>
|
||||
<result property="pipeLength" column="pipe_length"/>
|
||||
<result property="chestDepth" column="chest_depth"/>
|
||||
<result property="hipHeight" column="hip_height"/>
|
||||
<result property="rumpWidth" column="rump_width"/>
|
||||
<result property="rumpHeignt" column="rump_heignt"/>
|
||||
<result property="hipWidth" column="hip_width"/>
|
||||
<result property="hipCrossHeight" column="hip_cross_height"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBodyMeasureVo">
|
||||
select sm.id,
|
||||
sm.sheep_id,
|
||||
bs.manage_tags,
|
||||
sm.height,
|
||||
sm.bust,
|
||||
sm.body_length,
|
||||
sm.pipe_length,
|
||||
sm.chest_depth,
|
||||
sm.hip_height,
|
||||
sm.rump_width,
|
||||
sm.rump_heignt,
|
||||
sm.hip_width,
|
||||
sm.hip_cross_height,
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectScBodyMeasureList" parameterType="ScBodyMeasure" resultMap="ScBodyMeasureResult">
|
||||
<include refid="selectScBodyMeasureVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null ">and sm.sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">
|
||||
<include refid="selectScBodyMeasureVo"/>
|
||||
where sm.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScBodyMeasure" parameterType="ScBodyMeasure" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_body_measure
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="height != null">height,</if>
|
||||
<if test="bust != null">bust,</if>
|
||||
<if test="bodyLength != null">body_length,</if>
|
||||
<if test="pipeLength != null">pipe_length,</if>
|
||||
<if test="chestDepth != null">chest_depth,</if>
|
||||
<if test="hipHeight != null">hip_height,</if>
|
||||
<if test="rumpWidth != null">rump_width,</if>
|
||||
<if test="rumpHeignt != null">rump_heignt,</if>
|
||||
<if test="hipWidth != null">hip_width,</if>
|
||||
<if test="hipCrossHeight != null">hip_cross_height,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="height != null">#{height},</if>
|
||||
<if test="bust != null">#{bust},</if>
|
||||
<if test="bodyLength != null">#{bodyLength},</if>
|
||||
<if test="pipeLength != null">#{pipeLength},</if>
|
||||
<if test="chestDepth != null">#{chestDepth},</if>
|
||||
<if test="hipHeight != null">#{hipHeight},</if>
|
||||
<if test="rumpWidth != null">#{rumpWidth},</if>
|
||||
<if test="rumpHeignt != null">#{rumpHeignt},</if>
|
||||
<if test="hipWidth != null">#{hipWidth},</if>
|
||||
<if test="hipCrossHeight != null">#{hipCrossHeight},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScBodyMeasure" parameterType="ScBodyMeasure">
|
||||
update sc_body_measure
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="height != null">height = #{height},</if>
|
||||
<if test="bust != null">bust = #{bust},</if>
|
||||
<if test="bodyLength != null">body_length = #{bodyLength},</if>
|
||||
<if test="pipeLength != null">pipe_length = #{pipeLength},</if>
|
||||
<if test="chestDepth != null">chest_depth = #{chestDepth},</if>
|
||||
<if test="hipHeight != null">hip_height = #{hipHeight},</if>
|
||||
<if test="rumpWidth != null">rump_width = #{rumpWidth},</if>
|
||||
<if test="rumpHeignt != null">rump_heignt = #{rumpHeignt},</if>
|
||||
<if test="hipWidth != null">hip_width = #{hipWidth},</if>
|
||||
<if test="hipCrossHeight != null">hip_cross_height = #{hipCrossHeight},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScBodyMeasureById" parameterType="Long">
|
||||
delete
|
||||
from sc_body_measure
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScBodyMeasureByIds" parameterType="String">
|
||||
delete from sc_body_measure where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?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.bodyManage.mapper.ScBodyScoreMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBodyScore" id="ScBodyScoreResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="datetime" column="datetime"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBodyScoreVo">
|
||||
select sbs.id,
|
||||
sbs.sheep_id,
|
||||
bs.manage_tags,
|
||||
sbs.datetime,
|
||||
sbs.score,
|
||||
sbs.sheepfold,
|
||||
ds.sheepfold_name as sheepfoldName,
|
||||
sbs.comment,
|
||||
sbs.technician,
|
||||
sbs.create_by,
|
||||
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
|
||||
</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="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>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">
|
||||
<include refid="selectScBodyScoreVo"/>
|
||||
where sbs.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScBodyScore" parameterType="ScBodyScore" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_body_score
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="score != null">score,</if>
|
||||
<if test="sheepfold != null">sheepfold,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="score != null">#{score},</if>
|
||||
<if test="sheepfold != null">#{sheepfold},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScBodyScore" parameterType="ScBodyScore">
|
||||
update sc_body_score
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="datetime != null">datetime = #{datetime},</if>
|
||||
<if test="score != null">score = #{score},</if>
|
||||
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScBodyScoreById" parameterType="Long">
|
||||
delete
|
||||
from sc_body_score
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScBodyScoreByIds" parameterType="String">
|
||||
delete from sc_body_score where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?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.bodyManage.mapper.ScBreastRatingMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBreastRating" id="ScBreastRatingResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="depth" column="depth"/>
|
||||
<result property="length" column="length"/>
|
||||
<result property="position" column="position"/>
|
||||
<result property="adbere" column="adbere"/>
|
||||
<result property="spacing" column="spacing"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBreastRatingVo">
|
||||
select sbr.*,
|
||||
bs.manage_tags as manageTags
|
||||
from sc_breast_rating sbr
|
||||
left join bas_sheep bs on sbr.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreastRatingList" parameterType="ScBreastRating" resultMap="ScBreastRatingResult">
|
||||
<include refid="selectScBreastRatingVo"/>
|
||||
<where>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">
|
||||
<include refid="selectScBreastRatingVo"/>
|
||||
where sbr.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScBreastRating" parameterType="ScBreastRating" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_breast_rating
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="depth != null">depth,</if>
|
||||
<if test="length != null">length,</if>
|
||||
<if test="position != null">position,</if>
|
||||
<if test="adbere != null">adbere,</if>
|
||||
<if test="spacing != null">spacing,</if>
|
||||
<if test="score != null">score,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="depth != null">#{depth},</if>
|
||||
<if test="length != null">#{length},</if>
|
||||
<if test="position != null">#{position},</if>
|
||||
<if test="adbere != null">#{adbere},</if>
|
||||
<if test="spacing != null">#{spacing},</if>
|
||||
<if test="score != null">#{score},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScBreastRating" parameterType="ScBreastRating">
|
||||
update sc_breast_rating
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="depth != null">depth = #{depth},</if>
|
||||
<if test="length != null">length = #{length},</if>
|
||||
<if test="position != null">position = #{position},</if>
|
||||
<if test="adbere != null">adbere = #{adbere},</if>
|
||||
<if test="spacing != null">spacing = #{spacing},</if>
|
||||
<if test="score != null">score = #{score},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScBreastRatingById" parameterType="Long">
|
||||
delete
|
||||
from sc_breast_rating
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScBreastRatingByIds" parameterType="String">
|
||||
delete from sc_breast_rating where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -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>
|
||||
@@ -5,36 +5,34 @@
|
||||
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper">
|
||||
|
||||
<!-- 1. 结果映射:包含羊舍名称、品种名称 -->
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScAddSheep" id="ScAddSheepResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="earNumber" column="ear_number"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="father" column="father"/>
|
||||
<result property="mother" column="mother"/>
|
||||
<result property="bornWeight" column="born_weight"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="joinDate" column="join_date"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="id" column="id"/>
|
||||
<result property="earNumber" column="ear_number"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="father" column="father"/>
|
||||
<result property="mother" column="mother"/>
|
||||
<result property="bornWeight" column="born_weight"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="joinDate" column="join_date"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 2. 查询列表:支持按品种筛选 -->
|
||||
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
|
||||
SELECT
|
||||
sas.*,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
bv.variety AS varietyName
|
||||
bv.variety AS varietyName
|
||||
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 da_sheepfold sf ON sas.sheepfold = sf.id
|
||||
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
|
||||
<where>
|
||||
<if test="earNumber != null and earNumber != ''">
|
||||
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
|
||||
@@ -48,46 +46,43 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 3. 根据耳号精确查询 -->
|
||||
<select id="selectByEarNumber" parameterType="string" resultMap="ScAddSheepResult">
|
||||
SELECT * FROM sc_add_sheep WHERE ear_number = #{earNumber}
|
||||
SELECT *
|
||||
FROM sc_add_sheep
|
||||
WHERE ear_number = #{earNumber}
|
||||
</select>
|
||||
|
||||
<!-- 4. 插入 -->
|
||||
<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})
|
||||
VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight},
|
||||
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate},
|
||||
#{comment}, #{technician}, #{createBy}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<!-- 5. 更新 -->
|
||||
<update id="updateScAddSheep" parameterType="ScAddSheep">
|
||||
UPDATE sc_add_sheep
|
||||
<set>
|
||||
ear_number = #{earNumber},
|
||||
sheepfold = #{sheepfold},
|
||||
father = #{father},
|
||||
mother = #{mother},
|
||||
born_weight = #{bornWeight},
|
||||
birthday = #{birthday},
|
||||
gender = #{gender},
|
||||
parity = #{parity},
|
||||
variety_id = #{varietyId},
|
||||
join_date = #{joinDate},
|
||||
comment = #{comment},
|
||||
technician = #{technician},
|
||||
update_by = #{updateBy},
|
||||
update_time = NOW()
|
||||
ear_number = #{earNumber},
|
||||
sheepfold = #{sheepfold},
|
||||
father = #{father},
|
||||
mother = #{mother},
|
||||
born_weight = #{bornWeight},
|
||||
birthday = #{birthday},
|
||||
gender = #{gender},
|
||||
parity = #{parity},
|
||||
variety_id = #{varietyId},
|
||||
join_date = #{joinDate},
|
||||
comment = #{comment},
|
||||
technician = #{technician},
|
||||
update_by = #{updateBy},
|
||||
update_time = NOW()
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 6. 批量删除 -->
|
||||
<delete id="deleteScAddSheepByIds">
|
||||
DELETE FROM sc_add_sheep WHERE id IN
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?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.manage_sheep.mapper.ScChangeCommentMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeComment" id="ScChangeCommentResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="newComment" column="new_comment"/>
|
||||
<result property="oldComment" column="old_comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScChangeCommentVo">
|
||||
select scc.id,
|
||||
scc.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult">
|
||||
<include refid="selectScChangeCommentVo"/>
|
||||
<where>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="newComment != null and newComment != ''">
|
||||
and scc.new_comment like concat('%', #{newComment}, '%')
|
||||
</if>
|
||||
<if test="oldComment != null and oldComment != ''">
|
||||
and scc.old_comment like concat('%', #{oldComment}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
|
||||
and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeCommentById" parameterType="Long" resultMap="ScChangeCommentResult">
|
||||
<include refid="selectScChangeCommentVo"/>
|
||||
where scc.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScChangeComment" parameterType="ScChangeComment" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_change_comment
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null and sheepId != ''">sheep_id,</if>
|
||||
<if test="newComment != null and newComment != ''">new_comment,</if>
|
||||
<if test="oldComment != null and oldComment != ''">old_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 and sheepId != ''">#{sheepId},</if>
|
||||
<if test="newComment != null and newComment != ''">#{newComment},</if>
|
||||
<if test="oldComment != null and oldComment != ''">#{oldComment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScChangeComment" parameterType="ScChangeComment">
|
||||
update sc_change_comment
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null and sheepId != ''">sheep_id = #{sheepId},</if>
|
||||
<if test="newComment != null and newComment != ''">new_comment = #{newComment},</if>
|
||||
<if test="oldComment != null and oldComment != ''">old_comment = #{oldComment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScChangeCommentById" parameterType="Long">
|
||||
delete
|
||||
from sc_change_comment
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScChangeCommentByIds" parameterType="String">
|
||||
delete from sc_change_comment where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,106 @@
|
||||
<?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.manage_sheep.mapper.ScChangeEarMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeEar" id="ScChangeEarResult">
|
||||
<result property="id" column="sce_id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="earType" column="ear_type"/>
|
||||
<result property="newTag" column="newTag"/>
|
||||
<result property="oldTag" column="oldTag"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScChangeEarVo">
|
||||
select sce.id as sce_id,
|
||||
sce.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
sce.ear_type,
|
||||
sce.newTag,
|
||||
sce.oldTag as oldTag,
|
||||
sce.comment,
|
||||
sce.create_by,
|
||||
sce.create_time
|
||||
from sc_change_ear sce
|
||||
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeEarList" parameterType="ScChangeEar" resultMap="ScChangeEarResult">
|
||||
<include refid="selectScChangeEarVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and sce.sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="earType != null ">and sce.ear_type = #{earType}</if>
|
||||
<if test="newTag != null and newTag != ''">
|
||||
and sce.newTag LIKE CONCAT('%', #{newTag}, '%')
|
||||
</if>
|
||||
<if test="oldTag != null and oldTag != ''">
|
||||
and sce.oldTag LIKE CONCAT('%', #{oldTag}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and sce.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeEarById" parameterType="Integer" resultMap="ScChangeEarResult">
|
||||
<include refid="selectScChangeEarVo"/>
|
||||
where sce.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScChangeEar" parameterType="ScChangeEar" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_change_ear
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="earType != null">ear_type,</if>
|
||||
<if test="newTag != null and newTag != ''">newTag,</if>
|
||||
<if test="oldTag != null and oldTag != ''">oldTag,</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="earType != null">#{earType},</if>
|
||||
<if test="newTag != null and newTag != ''">#{newTag},</if>
|
||||
<if test="oldTag != null and oldTag != ''">#{oldTag},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScChangeEar" parameterType="ScChangeEar">
|
||||
update sc_change_ear
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="earType != null">ear_type = #{earType},</if>
|
||||
<if test="newTag != null and newTag != ''">newTag = #{newTag},</if>
|
||||
<if test="oldTag != null and oldTag != ''">oldTag = #{oldTag},</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="deleteScChangeEarById" parameterType="Integer">
|
||||
delete
|
||||
from sc_change_ear
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScChangeEarByIds" parameterType="String">
|
||||
delete from sc_change_ear where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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.manage_sheep.mapper.ScChangeVarietyMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeVariety" id="ScChangeVarietyResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="varietyOld" column="variety_old"/>
|
||||
<result property="varietyNew" column="variety_new"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScChangeVarietyVo">
|
||||
select scv.id,
|
||||
scv.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
scv.variety_old,
|
||||
scv.variety_new,
|
||||
scv.comment,
|
||||
scv.create_by,
|
||||
scv.create_time
|
||||
from sc_change_variety scv
|
||||
left join bas_sheep bs on scv.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeVarietyList" parameterType="ScChangeVariety" resultMap="ScChangeVarietyResult">
|
||||
<include refid="selectScChangeVarietyVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and scv.sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">
|
||||
and scv.variety_old like concat('%', #{varietyOld}, '%')
|
||||
</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">
|
||||
and scv.variety_new like concat('%', #{varietyNew}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
|
||||
and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and scv.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeVarietyById" parameterType="Integer" resultMap="ScChangeVarietyResult">
|
||||
<include refid="selectScChangeVarietyVo"/>
|
||||
where scv.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScChangeVariety" parameterType="ScChangeVariety" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_change_variety
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">variety_old,</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">variety_new,</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="varietyOld != null and varietyOld != ''">#{varietyOld},</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">#{varietyNew},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScChangeVariety" parameterType="ScChangeVariety">
|
||||
update sc_change_variety
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">variety_old = #{varietyOld},</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">variety_new = #{varietyNew},</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="deleteScChangeVarietyById" parameterType="Integer">
|
||||
delete
|
||||
from sc_change_variety
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScChangeVarietyByIds" parameterType="String">
|
||||
delete from sc_change_variety where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -4,9 +4,11 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransGroupMapper">
|
||||
|
||||
<resultMap type="ScTransGroup" id="ScTransGroupResult">
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransGroup" id="ScTransGroupResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="sheepTypeId" column="type_id"/>
|
||||
<result property="foldTo" column="fold_to"/>
|
||||
<result property="foldFrom" column="fold_from"/>
|
||||
<result property="reason" column="reason"/>
|
||||
@@ -22,6 +24,7 @@
|
||||
<sql id="selectScTransGroupVo">
|
||||
SELECT tg.id,
|
||||
tg.sheep_id,
|
||||
s.manage_tags AS manageTags,
|
||||
tg.fold_to,
|
||||
tg.fold_from,
|
||||
tg.reason,
|
||||
@@ -33,8 +36,12 @@
|
||||
tg.create_by,
|
||||
tg.create_time,
|
||||
sf_from.sheepfold_name AS foldFromName,
|
||||
sf_to.sheepfold_name AS foldToName
|
||||
sf_to.sheepfold_name AS foldToName,
|
||||
st.id AS sheepTypeId,
|
||||
st.name AS sheepTypeName
|
||||
FROM sc_trans_group tg
|
||||
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
|
||||
LEFT JOIN bas_sheep_type st ON s.type_id = st.id
|
||||
LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id
|
||||
LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id
|
||||
LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id
|
||||
@@ -44,12 +51,15 @@
|
||||
<include refid="selectScTransGroupVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and s.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</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="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransitionInfoMapper">
|
||||
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
|
||||
<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="varietyId" column="variety_id"/>
|
||||
@@ -11,7 +11,7 @@
|
||||
<result property="transTo" column="trans_to"/>
|
||||
<result property="transFrom" column="trans_from"/>
|
||||
<result property="transType" column="trans_type"/>
|
||||
<result property="transTypeText" column="trans_type_text"/>
|
||||
<result property="transTypeText" column="transTypeText"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="comment" column="comment"/>
|
||||
@@ -20,27 +20,39 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScTransitionInfoVo">
|
||||
SELECT t.*, bv.variety AS varietyName,
|
||||
SELECT t.*,
|
||||
bv.variety AS varietyName,
|
||||
bs.manage_tags AS manageTags,
|
||||
CASE t.trans_type
|
||||
WHEN 0 THEN '内部转场'
|
||||
WHEN 1 THEN '跨场转场'
|
||||
WHEN 2 THEN '销售转场'
|
||||
WHEN 0 THEN '内部调拨'
|
||||
WHEN 1 THEN '内部销售'
|
||||
WHEN 2 THEN '育肥调拨'
|
||||
ELSE '未知'
|
||||
END AS trans_type_text
|
||||
END AS transTypeText,
|
||||
CASE t.status
|
||||
WHEN 0 THEN '待审批'
|
||||
WHEN 1 THEN '已通过'
|
||||
WHEN 2 THEN '已驳回'
|
||||
ELSE '未知状态'
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
|
||||
<include refid="selectScTransitionInfoVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
|
||||
<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="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
|
||||
<if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
|
||||
<if test="status != null ">and status = #{status}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
and t.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -78,6 +90,21 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertScTransitionInfoBatch">
|
||||
INSERT INTO sc_transition_info (
|
||||
sheep_id, variety_id, trans_to, trans_from,
|
||||
trans_type, 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.createBy}, now()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateScTransitionInfo" parameterType="ScTransitionInfo">
|
||||
update sc_transition_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
<resultMap type="ScCastrate" id="ScCastrateResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
@@ -18,15 +21,17 @@
|
||||
<sql id="selectScCastrateVo">
|
||||
select sc.id,
|
||||
sc.sheep_id,
|
||||
bs.manage_tags as manageTags,
|
||||
sc.sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sc.variety_id,
|
||||
bv.variety as varietyName,
|
||||
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
|
||||
</sql>
|
||||
@@ -34,16 +39,16 @@
|
||||
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
|
||||
<include refid="selectScCastrateVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null and sheepId != ''">and sheep_id like concat('%', #{sheepId}, '%')</if>
|
||||
<if test="sheepfold != null ">and sheepfold like concat('%', #{sheepfold}, '%')</if>
|
||||
<if test="varietyId != null">
|
||||
and sc.variety_id = #{varietyId}
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="technician != null and technician != ''">and technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
<if test="sheepfold != null ">and sc.sheepfold = #{sheepfold}</if>
|
||||
<if test="varietyId != null">and sc.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">
|
||||
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
|
||||
<resultMap type="ScFixHoof" id="ScFixHoofResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
@@ -17,15 +18,19 @@
|
||||
|
||||
<sql id="selectScFixHoofVo">
|
||||
select fh.id,
|
||||
fh.sheep_id,
|
||||
bs.manage_tags AS manageTags,
|
||||
fh.sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
fh.variety_id,
|
||||
bv.variety AS varietyName,
|
||||
fh.comment,
|
||||
fh.technician,
|
||||
fh.create_by,
|
||||
fh.create_time
|
||||
from sc_fix_hoof fh
|
||||
left join bas_sheep bs on fh.sheep_id = bs.id
|
||||
left join da_sheepfold sf on fh.sheepfold = sf.id
|
||||
left join bas_sheep_variety bv on fh.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
|
||||
@@ -33,8 +38,14 @@
|
||||
<where>
|
||||
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
|
||||
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
|
||||
<if test="varietyId != null">
|
||||
and fh.variety_id = #{varietyId}
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
and fh.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -44,24 +55,24 @@
|
||||
where fh.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_fix_hoof
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
|
||||
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null and technician != ''">technician,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="sheepfold != null">#{sheepfold},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null and technician != ''">#{technician},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
<insert id="insertScFixHoof" parameterType="ScFixHoof"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO sc_fix_hoof
|
||||
(sheep_id,
|
||||
sheepfold,
|
||||
variety_id,
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null and technician != ''">technician,</if>
|
||||
create_by,
|
||||
create_time)
|
||||
VALUES
|
||||
(#{sheepId},
|
||||
#{sheepfold},
|
||||
<if test="varietyId != null">#{varietyId},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null and technician != ''">#{technician},</if>
|
||||
#{createBy},
|
||||
#{createTime})
|
||||
</insert>
|
||||
|
||||
<update id="updateScFixHoof" parameterType="ScFixHoof">
|
||||
@@ -69,6 +80,7 @@
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
|
||||
<if test="varietyId != null">variety_id=#{varietyId},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="technician != null and technician != ''">technician = #{technician},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
@@ -89,4 +101,6 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user