Merge remote-tracking branch 'origin/main'

This commit is contained in:
2025-12-09 19:41:42 +08:00
57 changed files with 5649 additions and 139 deletions

View File

@@ -26,6 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="statusId" column="status_id" />
<result property="weaningWeight" column="weaning_weight" />
<result property="currentWeight" column="current_weight" />
<result property="weaningDayAge" column="weaning_day_age" />
<result property="weaningDailyGain" column="weaning_daily_gain" />
<result property="breedStatusId" column="breed_status_id" />
<result property="breed" column="breed" />
<result property="bsFatherId" column="bs_father_id" />
@@ -72,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSheepFileVo">
select id, bs_manage_tags, ranch_id, dr_ranch, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, family, name, gender, birthday, day_age, month_age, parity, birth_weight, weaning_date, status_id, weaning_weight, current_weight, breed_status_id, breed, bs_father_id, father_manage_tags, bs_mother_id, mother_manage_tags, receptor_id, receptor_manage_tags, father_father_id, grandfather_manage_tags, father_mother_id, grandmother_manage_tags, father_id, maternal_grandfather_manage_tags, mother_id, maternal_grandmother_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, is_delete from sheep_file
select id, bs_manage_tags, ranch_id, dr_ranch, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, family, name, gender, birthday, day_age, month_age, parity, birth_weight, weaning_date, status_id, weaning_weight, current_weight,weaning_day_age,weaning_daily_gain,breed_status_id, breed, bs_father_id, father_manage_tags, bs_mother_id, mother_manage_tags, receptor_id, receptor_manage_tags, father_father_id, grandfather_manage_tags, father_mother_id, grandmother_manage_tags, father_id, maternal_grandfather_manage_tags, mother_id, maternal_grandmother_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, is_delete from sheep_file
</sql>
<select id="selectSheepFileList" parameterType="SheepFile" resultMap="SheepFileResult">
@@ -139,5 +141,134 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY parity
</select>
<!--
获取字段唯一值的SQL映射
说明:这个查询使用 ${fieldName} 直接拼接字段名因为MyBatis的#{}不支持列名作为参数
安全性通过Service层的白名单验证来确保fieldName的安全性
-->
<select id="selectFieldValues" parameterType="String" resultType="String">
SELECT
DISTINCT ${fieldName} as field_value
FROM
sheep_file
WHERE
<!-- 过滤空值和NULL值确保返回的数据质量 -->
${fieldName} IS NOT NULL
AND ${fieldName} != ''
AND ${fieldName} != 'null'
ORDER BY
<!-- 按字母顺序排序,方便前端显示 -->
${fieldName} ASC
</select>
<select id="selectSheepFileListByCondition" parameterType="map" resultMap="SheepFileResult">
<include refid="selectSheepFileVo"/>
FROM sheep_file
<where>
<!-- 逻辑删除过滤 -->
AND is_delete = 0
<!-- 原有的 SheepFile 条件(保持兼容性) -->
<if test="sheepFile != null">
<if test="sheepFile.bsManageTags != null and sheepFile.bsManageTags != ''">
AND bs_manage_tags LIKE CONCAT('%', #{sheepFile.bsManageTags}, '%')
</if>
<if test="sheepFile.electronicTags != null and sheepFile.electronicTags != ''">
AND electronic_tags LIKE CONCAT('%', #{sheepFile.electronicTags}, '%')
</if>
<if test="sheepFile.drRanch != null and sheepFile.drRanch != ''">
AND dr_ranch LIKE CONCAT('%', #{sheepFile.drRanch}, '%')
</if>
<if test="sheepFile.variety != null and sheepFile.variety != ''">
AND variety LIKE CONCAT('%', #{sheepFile.variety}, '%')
</if>
<if test="sheepFile.name != null and sheepFile.name != ''">
AND name LIKE CONCAT('%', #{sheepFile.name}, '%')
</if>
<if test="sheepFile.gender != null">
AND gender = #{sheepFile.gender}
</if>
<if test="sheepFile.statusId != null">
AND status_id = #{sheepFile.statusId}
</if>
<if test="sheepFile.breed != null and sheepFile.breed != ''">
AND breed LIKE CONCAT('%', #{sheepFile.breed}, '%')
</if>
</if>
<!-- 动态条件处理 - 使用多个if标签代替复杂的choose -->
<if test="params != null and !params.isEmpty()">
<!-- 空值条件 -->
<foreach collection="params.entrySet()" item="value" index="key">
<if test="value == 'IS_NULL'">
AND ${key} IS NULL
</if>
<if test="value == 'NOT_NULL'">
AND ${key} IS NOT NULL
</if>
</foreach>
<!-- 范围条件 -->
<foreach collection="params.entrySet()" item="value" index="key">
<if test="value != null and value.toString().startsWith('GT:')">
AND ${key} &gt; #{value.toString().substring(3)}
</if>
<if test="value != null and value.toString().startsWith('LT:')">
AND ${key} &lt; #{value.toString().substring(3)}
</if>
<if test="value != null and value.toString().startsWith('GE:')">
AND ${key} &gt;= #{value.toString().substring(3)}
</if>
<if test="value != null and value.toString().startsWith('LE:')">
AND ${key} &lt;= #{value.toString().substring(3)}
</if>
</foreach>
<!-- 列表条件 -->
<foreach collection="params.entrySet()" item="value" index="key">
<if test="value != null and value.toString().contains(',')">
AND ${key} IN
<foreach collection="value.toString().split(',')" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
<!-- 模糊查询条件(针对文本字段) -->
<foreach collection="params.entrySet()" item="value" index="key">
<if test="value != null and
(key == 'bs_manage_tags' or key == 'electronic_tags' or
key == 'dr_ranch' or key == 'sheepfold_name' or
key == 'variety' or key == 'family' or
key == 'name' or key == 'breed' or
key == 'father_manage_tags' or key == 'mother_manage_tags' or
key == 'receptor_manage_tags') and
value != 'IS_NULL' and value != 'NOT_NULL' and
!value.toString().startsWith('GT:') and !value.toString().startsWith('LT:') and
!value.toString().startsWith('GE:') and !value.toString().startsWith('LE:') and
!value.toString().contains(',')">
AND ${key} LIKE CONCAT('%', #{value}, '%')
</if>
</foreach>
<!-- 普通等于条件 -->
<foreach collection="params.entrySet()" item="value" index="key">
<if test="value != null and
value != 'IS_NULL' and value != 'NOT_NULL' and
!value.toString().startsWith('GT:') and !value.toString().startsWith('LT:') and
!value.toString().startsWith('GE:') and !value.toString().startsWith('LE:') and
!value.toString().contains(',') and
!(key == 'bs_manage_tags' or key == 'electronic_tags' or
key == 'dr_ranch' or key == 'sheepfold_name' or
key == 'variety' or key == 'family' or
key == 'name' or key == 'breed' or
key == 'father_manage_tags' or key == 'mother_manage_tags' or
key == 'receptor_manage_tags')">
AND ${key} = #{value}
</if>
</foreach>
</if>
</where>
ORDER BY id DESC
</select>
</mapper>

View File

@@ -5,14 +5,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.zhyc.module.common.mapper.UserPostMapper">
<resultMap type="UserPost" id="UserPostResult">
<result property="userId" column="user_id" />
<result property="nickName" column="nick_name" />
<result property="postName" column="post_name"/>
<result property="postCode" column="post_code" />
</resultMap>
<select id="getUserPostListByCode" resultMap="UserPostResult">
SELECT u.user_id, nick_name , post_name , post_code
FROM sys_role r
JOIN sys_user_role ur ON r.role_id = ur.role_id
JOIN sys_user u ON ur.user_id = u.user_id
JOIN sys_user_post up ON u.user_id = up.user_id
JOIN sys_post p ON up.post_id = p.post_id
WHERE p.post_code LIKE CONCAT('%', #{postCode}, '%')
AND r.status = 0 and r.del_flag = 0;
</select>
</mapper>

View File

@@ -34,26 +34,26 @@
FROM np_fresh_milk_insp
</sql>
<!-- 查询列表(已修改为只按来源和日期查询) -->
<select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/>
<where>
<if test="source != null and source != ''">
AND source LIKE CONCAT('%', #{source}, '%')
</if>
<if test="datetime != null">
AND datetime = #{datetime}
<if test="params.beginTime != null and params.beginTime != ''">
AND datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
AND datetime &lt;= #{params.endTime}
</if>
</where>
</select>
<!-- 根据ID查询 -->
<select id="selectNpFreshMilkInspById" parameterType="Long" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/>
WHERE id = #{id}
</select>
<!-- 新增 -->
<insert id="insertNpFreshMilkInsp" parameterType="NpFreshMilkInsp" useGeneratedKeys="true" keyProperty="id">
INSERT INTO np_fresh_milk_insp
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -96,7 +96,6 @@
</trim>
</insert>
<!-- 修改 -->
<update id="updateNpFreshMilkInsp" parameterType="NpFreshMilkInsp">
UPDATE np_fresh_milk_insp
<trim prefix="SET" suffixOverrides=",">
@@ -119,12 +118,10 @@
WHERE id = #{id}
</update>
<!-- 单个删除 -->
<delete id="deleteNpFreshMilkInspById" parameterType="Long">
DELETE FROM np_fresh_milk_insp WHERE id = #{id}
</delete>
<!-- 批量删除 -->
<delete id="deleteNpFreshMilkInspByIds" parameterType="String">
DELETE FROM np_fresh_milk_insp WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">

View File

@@ -40,7 +40,12 @@
<select id="selectNpRawMilkInspeList" parameterType="NpRawMilkInspe" resultMap="NpRawMilkInspeResult">
<include refid="selectNpRawMilkInspeVo"/>
<where>
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="params.beginTime != null and params.beginTime != ''">
and datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and datetime &lt;= #{params.endTime}
</if>
<if test="source != null and source != ''"> and source like concat('%', #{source}, '%')</if>
</where>
</select>

View File

@@ -39,8 +39,11 @@
<if test="source != null and source != ''">
and source like concat('%', #{source}, '%')
</if>
<if test="datetime != null ">
and datetime = #{datetime}
<if test="params.beginTime != null and params.beginTime != ''">
and datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and datetime &lt;= #{params.endTime}
</if>
</where>
</select>
@@ -70,7 +73,7 @@
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="source != null">#{source},</if>
<if test="datetime != null">#{datetime},</if>
@@ -89,7 +92,7 @@
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</trim>
</insert>
<update id="updateNpYogurtInsp" parameterType="NpYogurtInsp">

View File

@@ -13,26 +13,28 @@
<result property="coefficient" column="coefficient"/>
</resultMap>
<!-- 修改SQL片段系数保留两位小数 -->
<sql id="selectXzDryMatterCorrectionVo">
SELECT
id,
datetime,
factory,
content,
COALESCE(standard, 18) as standard, <!-- 设置默认值为18 -->
CASE
WHEN standard = 0 OR standard IS NULL THEN NULL
ELSE ROUND(content / standard, 2) <!-- 系数保留两位小数 -->
END AS coefficient
id,
datetime,
factory,
content,
COALESCE(standard, 18) as standard,
CASE
WHEN standard = 0 OR standard IS NULL THEN NULL
ELSE ROUND(content / standard, 2)
END AS coefficient
FROM xz_dry_matter_correction
</sql>
<select id="selectXzDryMatterCorrectionList" parameterType="XzDryMatterCorrection" resultMap="XzDryMatterCorrectionResult">
<include refid="selectXzDryMatterCorrectionVo"/>
<where>
<if test="datetime != null">
AND DATE_FORMAT(datetime, '%Y-%m') = DATE_FORMAT(#{datetime}, '%Y-%m')
<if test="params.beginTime != null and params.beginTime != ''">
AND DATE_FORMAT(datetime, '%Y-%m') &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
AND DATE_FORMAT(datetime, '%Y-%m') &lt;= #{params.endTime}
</if>
<if test="factory != null and factory != ''">
AND factory = #{factory}

View File

@@ -30,7 +30,12 @@
<select id="selectXzWegihCorrectionList" parameterType="XzWegihCorrection" resultMap="XzWegihCorrectionResult">
<include refid="selectXzWegihCorrectionVo"/>
<where>
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="params.beginTime != null and params.beginTime != ''">
and datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and datetime &lt;= #{params.endTime}
</if>
<if test="factory != null and factory != ''"> and factory = #{factory}</if>
</where>
</select>

View File

@@ -0,0 +1,191 @@
<?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.frozen.mapper.DdFeMapper">
<resultMap type="com.zhyc.module.frozen.domain.DdFe" id="DdFeResult">
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="freezeDate" column="freeze_date"/>
<result property="drId" column="dr_id"/>
<result property="drBreed" column="dr_breed"/>
<result property="deId" column="de_id"/>
<result property="deBreed" column="de_breed"/>
<result property="embBreed" column="emb_breed"/>
<result property="grade" column="grade"/>
<result property="qty" column="qty"/>
<result property="sexCtl" column="sex_ctl"/>
<result property="status" column="status"/>
<result property="tech" column="tech"/>
<result property="tankId" column="tank_id"/>
<result property="bucketId" column="bucket_id"/>
<result property="rackId" column="rack_id"/>
<result property="outDate" column="out_date"/>
<result property="discardTxt" column="discard_txt"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectDdFeVo">
select id,
code,
freeze_date,
dr_id,
dr_breed,
de_id,
de_breed,
emb_breed,
grade,
qty,
sex_ctl,
status,
tech,
tank_id,
bucket_id,
rack_id,
out_date,
discard_txt,
remark,
create_by,
create_time
from dd_fe
</sql>
<select id="selectDdFeList" parameterType="DdFe" resultMap="DdFeResult">
<include refid="selectDdFeVo"/>
<where>
<if test="code != null and code != ''">and code like concat('%', #{code}, '%')</if>
<if test="grade != null and grade != ''">and grade = #{grade}</if>
<if test="status != null and status != ''">and status = #{status}</if>
<if test="tech != null and tech != ''">
AND tech LIKE CONCAT('%', #{tech}, '%')
</if>
<if test="outDate != null ">and out_date = #{outDate}</if>
<if test="params.beginFreezeDate != null and params.endFreezeDate != null">
and freeze_date between #{params.beginFreezeDate} and #{params.endFreezeDate}
</if>
<if test="params.beginOutDate != null and params.endOutDate != null">
and out_date between #{params.beginOutDate} and #{params.endOutDate}
</if>
</where>
</select>
<select id="selectDdFeById" parameterType="Long" resultMap="DdFeResult">
<include refid="selectDdFeVo"/>
where id = #{id}
</select>
<insert id="insertDdFe" parameterType="DdFe" useGeneratedKeys="true" keyProperty="id">
insert into dd_fe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="freezeDate != null">freeze_date,</if>
<if test="drId != null">dr_id,</if>
<if test="drBreed != null">dr_breed,</if>
<if test="deId != null">de_id,</if>
<if test="deBreed != null">de_breed,</if>
<if test="embBreed != null">emb_breed,</if>
<if test="grade != null">grade,</if>
<if test="qty != null">qty,</if>
<if test="sexCtl != null">sex_ctl,</if>
<if test="status != null">status,</if>
<if test="tech != null">tech,</if>
<if test="tankId != null">tank_id,</if>
<if test="bucketId != null">bucket_id,</if>
<if test="rackId != null">rack_id,</if>
<if test="outDate != null">out_date,</if>
<if test="discardTxt != null">discard_txt,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="freezeDate != null">#{freezeDate},</if>
<if test="drId != null">#{drId},</if>
<if test="drBreed != null">#{drBreed},</if>
<if test="deId != null">#{deId},</if>
<if test="deBreed != null">#{deBreed},</if>
<if test="embBreed != null">#{embBreed},</if>
<if test="grade != null">#{grade},</if>
<if test="qty != null">#{qty},</if>
<if test="sexCtl != null">#{sexCtl},</if>
<if test="status != null">#{status},</if>
<if test="tech != null">#{tech},</if>
<if test="tankId != null">#{tankId},</if>
<if test="bucketId != null">#{bucketId},</if>
<if test="rackId != null">#{rackId},</if>
<if test="outDate != null">#{outDate},</if>
<if test="discardTxt != null">#{discardTxt},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDdFe" parameterType="DdFe">
update dd_fe
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="freezeDate != null">freeze_date = #{freezeDate},</if>
<if test="drId != null">dr_id = #{drId},</if>
<if test="drBreed != null">dr_breed = #{drBreed},</if>
<if test="deId != null">de_id = #{deId},</if>
<if test="deBreed != null">de_breed = #{deBreed},</if>
<if test="embBreed != null">emb_breed = #{embBreed},</if>
<if test="grade != null">grade = #{grade},</if>
<if test="qty != null">qty = #{qty},</if>
<if test="sexCtl != null">sex_ctl = #{sexCtl},</if>
<if test="status != null">status = #{status},</if>
<if test="tech != null">tech = #{tech},</if>
<if test="tankId != null">tank_id = #{tankId},</if>
<if test="bucketId != null">bucket_id = #{bucketId},</if>
<if test="rackId != null">rack_id = #{rackId},</if>
<if test="outDate != null">out_date = #{outDate},</if>
<if test="discardTxt != null">discard_txt = #{discardTxt},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDdFeById" parameterType="Long">
delete
from dd_fe
where id = #{id}
</delete>
<delete id="deleteDdFeByIds" parameterType="String">
delete from dd_fe where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectFlushByEwe" resultType="map">
SELECT grade_a gradeA,
grade_b gradeB,
grade_c gradeC,
grade_d gradeD,
cell_2_4 cell24,
cell_8 cell8,
donor_male_no ramId
FROM sc_embryo_flush
WHERE donor_female_no = #{eweNo}
ORDER BY flush_time DESC LIMIT 1
</select>
<update id="updateDiscard" parameterType="DdFe">
UPDATE dd_fe
SET status = #{status},
discard_txt = #{discardTxt}
WHERE id = #{id}
</update>
<select id="existsByCode" resultType="int">
SELECT COUNT(*) FROM dd_fe WHERE code = #{code}
</select>
</mapper>

View File

@@ -0,0 +1,127 @@
<?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.frozen.mapper.DdFsMapper">
<resultMap type="com.zhyc.module.frozen.domain.DdFs" id="DdFsResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="freezeDt" column="freeze_dt" />
<result property="breed" column="breed" />
<result property="batch" column="batch" />
<result property="spec" column="spec" />
<result property="qty" column="qty" />
<result property="sexCtl" column="sex_ctl" />
<result property="stat" column="stat" />
<result property="tech" column="tech" />
<result property="tankId" column="tank_id" />
<result property="bucketId" column="bucket_id" />
<result property="rackId" column="rack_id" />
<result property="outDt" column="out_dt" />
<result property="discardTxt" column="discard_txt" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectDdFsVo">
select id, code, freeze_dt, breed, batch, spec, qty, sex_ctl, stat, tech, tank_id, bucket_id, rack_id, out_dt, discard_txt, remark, create_by, create_time from dd_fs
</sql>
<select id="selectDdFsList" parameterType="DdFs" resultMap="DdFsResult">
<include refid="selectDdFsVo"/>
<where>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="tech != null and tech != ''"> and tech like concat('%', #{tech}, '%')</if>
<if test="params.beginFreezeDt != null and params.endFreezeDt != null">
and freeze_dt between #{params.beginFreezeDt} and #{params.endFreezeDt}
</if>
<if test="params.beginOutDt != null and params.endOutDt != null">
and out_dt between #{params.beginOutDt} and #{params.endOutDt}
</if>
</where>
</select>
<select id="selectDdFsById" parameterType="Long" resultMap="DdFsResult">
<include refid="selectDdFsVo"/>
where id = #{id}
</select>
<insert id="insertDdFs" parameterType="DdFs" useGeneratedKeys="true" keyProperty="id">
insert into dd_fs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="freezeDt != null">freeze_dt,</if>
<if test="breed != null">breed,</if>
<if test="batch != null">batch,</if>
<if test="spec != null">spec,</if>
<if test="qty != null">qty,</if>
<if test="sexCtl != null">sex_ctl,</if>
<if test="stat != null">stat,</if>
<if test="tech != null">tech,</if>
<if test="tankId != null">tank_id,</if>
<if test="bucketId != null">bucket_id,</if>
<if test="rackId != null">rack_id,</if>
<if test="outDt != null">out_dt,</if>
<if test="discardTxt != null">discard_txt,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="freezeDt != null">#{freezeDt},</if>
<if test="breed != null">#{breed},</if>
<if test="batch != null">#{batch},</if>
<if test="spec != null">#{spec},</if>
<if test="qty != null">#{qty},</if>
<if test="sexCtl != null">#{sexCtl},</if>
<if test="stat != null">#{stat},</if>
<if test="tech != null">#{tech},</if>
<if test="tankId != null">#{tankId},</if>
<if test="bucketId != null">#{bucketId},</if>
<if test="rackId != null">#{rackId},</if>
<if test="outDt != null">#{outDt},</if>
<if test="discardTxt != null">#{discardTxt},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDdFs" parameterType="DdFs">
update dd_fs
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="freezeDt != null">freeze_dt = #{freezeDt},</if>
<if test="breed != null">breed = #{breed},</if>
<if test="batch != null">batch = #{batch},</if>
<if test="spec != null">spec = #{spec},</if>
<if test="qty != null">qty = #{qty},</if>
<if test="sexCtl != null">sex_ctl = #{sexCtl},</if>
<if test="stat != null">stat = #{stat},</if>
<if test="tech != null">tech = #{tech},</if>
<if test="tankId != null">tank_id = #{tankId},</if>
<if test="bucketId != null">bucket_id = #{bucketId},</if>
<if test="rackId != null">rack_id = #{rackId},</if>
<if test="outDt != null">out_dt = #{outDt},</if>
<if test="discardTxt != null">discard_txt = #{discardTxt},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDdFsById" parameterType="Long">
delete from dd_fs where id = #{id}
</delete>
<delete id="deleteDdFsByIds" parameterType="String">
delete from dd_fs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,150 @@
<?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.frozen.mapper.DdSaleMapper">
<resultMap type="DdSale" id="DdSaleResult">
<result property="id" column="id" />
<result property="saleDate" column="sale_date" />
<result property="custName" column="cust_name" />
<result property="custPhone" column="cust_phone" />
<result property="custAddr" column="cust_addr" />
<result property="salesper" column="salesper" />
<result property="quaranNo" column="quaran_no" />
<result property="apprNo" column="appr_no" />
<result property="price" column="price" />
<result property="tech" column="tech" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<resultMap id="DdSaleDdSaleItemResult" type="DdSale" extends="DdSaleResult">
<collection property="ddSaleItemList" ofType="DdSaleItem" column="id" select="selectDdSaleItemList" />
</resultMap>
<resultMap type="DdSaleItem" id="DdSaleItemResult">
<result property="id" column="id" />
<result property="saleId" column="sale_id" />
<result property="itemType" column="item_type" />
<result property="itemCode" column="item_code" />
<result property="qty" column="qty" />
<result property="unitPrice" column="unit_price" />
<result property="tankId" column="tank_id" />
<result property="bucketId" column="bucket_id" />
<result property="rackId" column="rack_id" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectDdSaleVo">
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time from dd_sl
</sql>
<select id="selectDdSaleList" parameterType="DdSale" resultMap="DdSaleResult">
<include refid="selectDdSaleVo"/>
<where>
<if test="saleDate != null "> and sale_date = #{saleDate}</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="custAddr != null and custAddr != ''"> and cust_addr = #{custAddr}</if>
<if test="salesper != null and salesper != ''"> and salesper = #{salesper}</if>
<if test="quaranNo != null and quaranNo != ''"> and quaran_no = #{quaranNo}</if>
<if test="apprNo != null and apprNo != ''"> and appr_no = #{apprNo}</if>
<if test="price != null "> and price = #{price}</if>
<if test="tech != null and tech != ''"> and tech = #{tech}</if>
</where>
</select>
<select id="selectDdSaleById" parameterType="Long" resultMap="DdSaleDdSaleItemResult">
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time
from dd_sl
where id = #{id}
</select>
<select id="selectDdSaleItemList" resultMap="DdSaleItemResult">
select id, sale_id, item_type, item_code, qty, unit_price, tank_id, bucket_id, rack_id, create_time
from dd_sl_item
where sale_id = #{sale_id}
</select>
<insert id="insertDdSale" parameterType="DdSale" useGeneratedKeys="true" keyProperty="id">
insert into dd_sl
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="saleDate != null">sale_date,</if>
<if test="custName != null and custName != ''">cust_name,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="custAddr != null">cust_addr,</if>
<if test="salesper != null">salesper,</if>
<if test="quaranNo != null">quaran_no,</if>
<if test="apprNo != null">appr_no,</if>
<if test="price != null">price,</if>
<if test="tech != null and tech != ''">tech,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="saleDate != null">#{saleDate},</if>
<if test="custName != null and custName != ''">#{custName},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="custAddr != null">#{custAddr},</if>
<if test="salesper != null">#{salesper},</if>
<if test="quaranNo != null">#{quaranNo},</if>
<if test="apprNo != null">#{apprNo},</if>
<if test="price != null">#{price},</if>
<if test="tech != null and tech != ''">#{tech},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDdSale" parameterType="DdSale">
update dd_sl
<trim prefix="SET" suffixOverrides=",">
<if test="saleDate != null">sale_date = #{saleDate},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="custAddr != null">cust_addr = #{custAddr},</if>
<if test="salesper != null">salesper = #{salesper},</if>
<if test="quaranNo != null">quaran_no = #{quaranNo},</if>
<if test="apprNo != null">appr_no = #{apprNo},</if>
<if test="price != null">price = #{price},</if>
<if test="tech != null and tech != ''">tech = #{tech},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDdSaleById" parameterType="Long">
delete from dd_sl where id = #{id}
</delete>
<delete id="deleteDdSaleByIds" parameterType="String">
delete from dd_sl where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteDdSaleItemBySaleIds" parameterType="String">
delete from dd_sl_item where sale_id in
<foreach item="saleId" collection="array" open="(" separator="," close=")">
#{saleId}
</foreach>
</delete>
<delete id="deleteDdSaleItemBySaleId" parameterType="Long">
delete from dd_sl_item where sale_id = #{saleId}
</delete>
<insert id="batchDdSaleItem">
insert into dd_sl_item( id, sale_id, item_type, item_code, qty, unit_price, tank_id, bucket_id, rack_id, create_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.saleId}, #{item.itemType}, #{item.itemCode}, #{item.qty}, #{item.unitPrice}, #{item.tankId}, #{item.bucketId}, #{item.rackId}, #{item.createTime})
</foreach>
</insert>
</mapper>

View File

@@ -102,30 +102,7 @@
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
ORDER BY
<choose>
<when test="orderBy == 'weaningWeight'">bs.weaning_weight</when>
<when test="orderBy == 'bodyLength'">sm.body_length</when>
<when test="orderBy == 'birthWeight'">bs.birth_weight</when>
<when test="orderBy == 'currentWeight'">bs.current_weight</when>
<when test="orderBy == 'lactationDay'">bs.lactation_day</when>
<when test="orderBy == 'gestationDay'">bs.gestation_day</when>
<when test="orderBy == 'postMatingDay'">post_mating_day</when>
<when test="orderBy == 'parity'">bs.parity</when>
<when test="orderBy == 'height'">sm.height</when>
<when test="orderBy == 'bust'">sm.bust</when>
<when test="orderBy == 'pipeLength'">sm.pipe_length</when>
<when test="orderBy == 'chestDepth'">sm.chest_depth</when>
<when test="orderBy == 'hipHeight'">sm.hip_height</when>
<when test="orderBy == 'rumpWidth'">sm.rump_width</when>
<when test="orderBy == 'rumpHeignt'">sm.rump_heignt</when>
<when test="orderBy == 'hipWidth'">sm.hip_width</when>
<when test="orderBy == 'hipCrossHeight'">sm.hip_cross_height</when>
<otherwise>${orderBy}</otherwise>
</choose>
${sortDirection}
</if>
<if test="true">ORDER BY sm.create_time DESC</if>
</select>
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">

View File

@@ -58,12 +58,7 @@
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
ORDER BY sbs.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbs.create_time DESC
</if>
<if test="true">ORDER BY sbs.create_time DESC</if>
</select>
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">

View File

@@ -56,13 +56,7 @@
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
ORDER BY sbr.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbr.create_time DESC
</if>
<if test="true">ORDER BY sbr.create_time DESC</if>
</select>
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">

View File

@@ -53,7 +53,7 @@
br.breed_type,
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,
@@ -65,16 +65,18 @@
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,
-- 配种方式显示
-- 配种方式显示(修改:增加3-冲胚、4-自然发情人工授精)
CASE br.breed_type
WHEN 1 THEN '同期发情'
WHEN 2 THEN '本交'
WHEN 3 THEN '冲胚'
WHEN 4 THEN '自然发情人工授精'
ELSE '未知'
END as mating_type,
-- 发情后配种时间小时数
-- 发情后配种时间(小时数)
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning,
-- 孕检相关信息
pr.datetime as pregnancy_check_date,
@@ -225,6 +227,8 @@
CASE bp.breed_type
WHEN 1 THEN '同期发情'
WHEN 2 THEN '本交'
WHEN 3 THEN '冲胚'
WHEN 4 THEN '自然发情人工授精'
ELSE '未知'
END as breed_type_name,
TIMESTAMPDIFF(HOUR, NOW(), NOW()) as hours_since_plan
@@ -236,7 +240,7 @@
limit 1
</select>
<!-- 根据母羊耳号获取最新的配种计划信息从配种计划生成表 -->
<!-- 根据母羊耳号获取最新的配种计划信息(从配种计划生成表) -->
<select id="getLatestBreedPlanByEweTags" parameterType="String" resultType="map">
select
bpg.id as plan_generate_id,
@@ -248,6 +252,8 @@
CASE bpt.breed_type
WHEN 1 THEN '同期发情'
WHEN 2 THEN '本交'
WHEN 3 THEN '冲胚'
WHEN 4 THEN '自然发情人工授精'
ELSE '未知'
END as breed_type_name,
bpg.create_time as plan_create_time

View File

@@ -0,0 +1,229 @@
<?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.ScEmbryoFlushMapper">
<resultMap type="ScEmbryoFlush" id="ScEmbryoFlushResult">
<result property="id" column="id" />
<result property="flushTime" column="flush_time" />
<result property="donorFemaleNo" column="donor_female_no" />
<result property="donorFemaleVariety" column="donor_female_variety" />
<result property="donorMaleNo" column="donor_male_no" />
<result property="donorMaleVariety" column="donor_male_variety" />
<result property="embryoVariety" column="embryo_variety" />
<result property="embryoAge" column="embryo_age" />
<result property="gradeAPlus" column="grade_a_plus" />
<result property="gradeA" column="grade_a" />
<result property="gradeB" column="grade_b" />
<result property="gradeC" column="grade_c" />
<result property="gradeD" column="grade_d" />
<result property="cell24" column="cell_2_4" />
<result property="cell8" column="cell_8" />
<result property="cell16" column="cell_16" />
<result property="unfertilized" column="unfertilized" />
<result property="degenerated" column="degenerated" />
<result property="totalEmbryo" column="total_embryo" />
<result property="validEmbryo" column="valid_embryo" />
<result property="transferred" column="transferred" />
<result property="recipientCnt" column="recipient_cnt" />
<result property="embryoType" column="embryo_type" />
<result property="embryoSource" column="embryo_source" />
<result property="destination" column="destination" />
<result property="storageMethod" column="storage_method" />
<result property="flushOperator" column="flush_operator" />
<result property="collectOperator" column="collect_operator" />
<result property="ranchId" column="ranch_id" />
<result property="ranchName" column="ranch_name" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectScEmbryoFlushVo">
select id, flush_time, donor_female_no, donor_female_variety, donor_male_no, donor_male_variety,
embryo_variety, embryo_age, grade_a_plus, grade_a, grade_b, grade_c, grade_d,
cell_2_4, cell_8, cell_16, unfertilized, degenerated, total_embryo, valid_embryo,
transferred, recipient_cnt, embryo_type, embryo_source, destination, storage_method,
flush_operator, collect_operator, ranch_id, ranch_name, remark
from sc_embryo_flush
</sql>
<select id="selectScEmbryoFlushList" parameterType="ScEmbryoFlush" resultMap="ScEmbryoFlushResult">
<include refid="selectScEmbryoFlushVo"/>
<where>
<if test="params.beginFlushTime != null and params.beginFlushTime != '' and params.endFlushTime != null and params.endFlushTime != ''">
and flush_time between #{params.beginFlushTime} and #{params.endFlushTime}
</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''"> and donor_female_no like concat('%', #{donorFemaleNo}, '%')</if>
<if test="donorMaleNo != null and donorMaleNo != ''"> and donor_male_no like concat('%', #{donorMaleNo}, '%')</if>
<if test="embryoVariety != null and embryoVariety != ''"> and embryo_variety = #{embryoVariety}</if>
<if test="embryoType != null and embryoType != ''"> and embryo_type = #{embryoType}</if>
<if test="embryoSource != null and embryoSource != ''"> and embryo_source = #{embryoSource}</if>
<if test="flushOperator != null and flushOperator != ''"> and flush_operator like concat('%', #{flushOperator}, '%')</if>
<if test="collectOperator != null and collectOperator != ''"> and collect_operator like concat('%', #{collectOperator}, '%')</if>
<if test="ranchId != null"> and ranch_id = #{ranchId}</if>
</where>
order by flush_time desc
</select>
<select id="selectScEmbryoFlushById" parameterType="Long" resultMap="ScEmbryoFlushResult">
<include refid="selectScEmbryoFlushVo"/>
where id = #{id}
</select>
<insert id="insertScEmbryoFlush" parameterType="ScEmbryoFlush" useGeneratedKeys="true" keyProperty="id">
insert into sc_embryo_flush
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="flushTime != null">flush_time,</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">donor_female_no,</if>
<if test="donorFemaleVariety != null and donorFemaleVariety != ''">donor_female_variety,</if>
<if test="donorMaleNo != null and donorMaleNo != ''">donor_male_no,</if>
<if test="donorMaleVariety != null and donorMaleVariety != ''">donor_male_variety,</if>
<if test="embryoVariety != null and embryoVariety != ''">embryo_variety,</if>
<if test="embryoAge != null">embryo_age,</if>
<if test="gradeAPlus != null">grade_a_plus,</if>
<if test="gradeA != null">grade_a,</if>
<if test="gradeB != null">grade_b,</if>
<if test="gradeC != null">grade_c,</if>
<if test="gradeD != null">grade_d,</if>
<if test="cell24 != null">cell_2_4,</if>
<if test="cell8 != null">cell_8,</if>
<if test="cell16 != null">cell_16,</if>
<if test="unfertilized != null">unfertilized,</if>
<if test="degenerated != null">degenerated,</if>
<if test="totalEmbryo != null">total_embryo,</if>
<if test="validEmbryo != null">valid_embryo,</if>
<if test="transferred != null">transferred,</if>
<if test="recipientCnt != null">recipient_cnt,</if>
<if test="embryoType != null and embryoType != ''">embryo_type,</if>
<if test="embryoSource != null and embryoSource != ''">embryo_source,</if>
<if test="destination != null and destination != ''">destination,</if>
<if test="storageMethod != null and storageMethod != ''">storage_method,</if>
<if test="flushOperator != null and flushOperator != ''">flush_operator,</if>
<if test="collectOperator != null and collectOperator != ''">collect_operator,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="ranchName != null and ranchName != ''">ranch_name,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="flushTime != null">#{flushTime},</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">#{donorFemaleNo},</if>
<if test="donorFemaleVariety != null and donorFemaleVariety != ''">#{donorFemaleVariety},</if>
<if test="donorMaleNo != null and donorMaleNo != ''">#{donorMaleNo},</if>
<if test="donorMaleVariety != null and donorMaleVariety != ''">#{donorMaleVariety},</if>
<if test="embryoVariety != null and embryoVariety != ''">#{embryoVariety},</if>
<if test="embryoAge != null">#{embryoAge},</if>
<if test="gradeAPlus != null">#{gradeAPlus},</if>
<if test="gradeA != null">#{gradeA},</if>
<if test="gradeB != null">#{gradeB},</if>
<if test="gradeC != null">#{gradeC},</if>
<if test="gradeD != null">#{gradeD},</if>
<if test="cell24 != null">#{cell24},</if>
<if test="cell8 != null">#{cell8},</if>
<if test="cell16 != null">#{cell16},</if>
<if test="unfertilized != null">#{unfertilized},</if>
<if test="degenerated != null">#{degenerated},</if>
<if test="totalEmbryo != null">#{totalEmbryo},</if>
<if test="validEmbryo != null">#{validEmbryo},</if>
<if test="transferred != null">#{transferred},</if>
<if test="recipientCnt != null">#{recipientCnt},</if>
<if test="embryoType != null and embryoType != ''">#{embryoType},</if>
<if test="embryoSource != null and embryoSource != ''">#{embryoSource},</if>
<if test="destination != null and destination != ''">#{destination},</if>
<if test="storageMethod != null and storageMethod != ''">#{storageMethod},</if>
<if test="flushOperator != null and flushOperator != ''">#{flushOperator},</if>
<if test="collectOperator != null and collectOperator != ''">#{collectOperator},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="ranchName != null and ranchName != ''">#{ranchName},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateScEmbryoFlush" parameterType="ScEmbryoFlush">
update sc_embryo_flush
<trim prefix="SET" suffixOverrides=",">
<if test="flushTime != null">flush_time = #{flushTime},</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">donor_female_no = #{donorFemaleNo},</if>
<if test="donorFemaleVariety != null and donorFemaleVariety != ''">donor_female_variety = #{donorFemaleVariety},</if>
<if test="donorMaleNo != null and donorMaleNo != ''">donor_male_no = #{donorMaleNo},</if>
<if test="donorMaleVariety != null and donorMaleVariety != ''">donor_male_variety = #{donorMaleVariety},</if>
<if test="embryoVariety != null and embryoVariety != ''">embryo_variety = #{embryoVariety},</if>
<if test="embryoAge != null">embryo_age = #{embryoAge},</if>
<if test="gradeAPlus != null">grade_a_plus = #{gradeAPlus},</if>
<if test="gradeA != null">grade_a = #{gradeA},</if>
<if test="gradeB != null">grade_b = #{gradeB},</if>
<if test="gradeC != null">grade_c = #{gradeC},</if>
<if test="gradeD != null">grade_d = #{gradeD},</if>
<if test="cell24 != null">cell_2_4 = #{cell24},</if>
<if test="cell8 != null">cell_8 = #{cell8},</if>
<if test="cell16 != null">cell_16 = #{cell16},</if>
<if test="unfertilized != null">unfertilized = #{unfertilized},</if>
<if test="degenerated != null">degenerated = #{degenerated},</if>
<if test="totalEmbryo != null">total_embryo = #{totalEmbryo},</if>
<if test="validEmbryo != null">valid_embryo = #{validEmbryo},</if>
<if test="transferred != null">transferred = #{transferred},</if>
<if test="recipientCnt != null">recipient_cnt = #{recipientCnt},</if>
<if test="embryoType != null and embryoType != ''">embryo_type = #{embryoType},</if>
<if test="embryoSource != null and embryoSource != ''">embryo_source = #{embryoSource},</if>
<if test="destination != null and destination != ''">destination = #{destination},</if>
<if test="storageMethod != null and storageMethod != ''">storage_method = #{storageMethod},</if>
<if test="flushOperator != null and flushOperator != ''">flush_operator = #{flushOperator},</if>
<if test="collectOperator != null and collectOperator != ''">collect_operator = #{collectOperator},</if>
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="ranchName != null and ranchName != ''">ranch_name = #{ranchName},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScEmbryoFlushById" parameterType="Long">
delete from sc_embryo_flush where id = #{id}
</delete>
<delete id="deleteScEmbryoFlushByIds" parameterType="String">
delete from sc_embryo_flush where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 根据耳号查询羊只信息(从sheep_file视图) -->
<select id="selectSheepInfoByManageTag" parameterType="String" resultType="java.util.Map">
SELECT
bs_manage_tags AS manageTag,
variety_id AS varietyId,
variety,
ranch_id AS ranchId,
dr_ranch AS ranchName
FROM sheep_file
WHERE bs_manage_tags = #{manageTag}
LIMIT 1
</select>
<!-- 根据母羊耳号查询最近一条配种记录,获取公羊耳号和配种日期 -->
<!-- ewe_id存的是数字ID需要先根据耳号找到母羊ID再查配种记录再根据公羊ID找到公羊耳号 -->
<select id="selectBreedRecordByEwe" resultType="java.util.Map">
SELECT
ram_sf.bs_manage_tags AS ramId,
br.create_time AS matingDate
FROM sc_breed_record br
INNER JOIN sheep_file ewe_sf ON ewe_sf.id = br.ewe_id
INNER JOIN sheep_file ram_sf ON ram_sf.id = br.ram_id
WHERE ewe_sf.bs_manage_tags = #{eweManageTag}
ORDER BY br.create_time DESC
LIMIT 1
</select>
<!-- 查询所有母羊列表(用于下拉选择) -->
<select id="selectDonorFemaleList" resultType="java.util.Map">
SELECT DISTINCT
sf.bs_manage_tags AS manageTag,
sf.variety,
sf.variety_id AS varietyId,
sf.ranch_id AS ranchId,
sf.dr_ranch AS ranchName
FROM sheep_file sf
WHERE sf.gender = 1
AND (sf.is_delete = 0 OR sf.is_delete IS NULL)
ORDER BY sf.bs_manage_tags
</select>
</mapper>

View File

@@ -36,30 +36,36 @@
<result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" />
<result property="remark" column="remark" />
<result property="customerName" column="customer_name" />
<result property="salesPersonName" column="sales_person_name" />
<result property="customerPhone" column="customer_phone" />
<result property="customerAddress" column="customer_address" />
</resultMap>
<sql id="selectSxSheepSaleVo">
select id, bs_manage_tags, sheepfold_id, variety, sheep_name, gender, month_age, parity, breed, post_lambing_day, lactation_day, lambing_day, event_type, sale_date, pricing_method, unit_price, total_price, total_weight, avg_weight, avg_price_per_sheep, sale_type, disease_type, secondary_reason, group_code, customer_id, sales_person_id, quarantine_no, approval_no, technician_id, handler_id, created_by, created_at, remark from sx_sheep_sale
SELECT
s.id, s.bs_manage_tags, s.sheepfold_id, s.variety, s.sheep_name, s.gender, s.month_age, s.parity, s.breed,
s.post_lambing_day, s.lactation_day, s.lambing_day, s.event_type, s.sale_date, s.pricing_method,
s.unit_price, s.total_price, s.total_weight, s.avg_weight, s.avg_price_per_sheep, s.sale_type,
s.disease_type, s.secondary_reason, s.group_code, s.customer_id, s.sales_person_id,
s.quarantine_no, s.approval_no, s.technician_id, s.handler_id, s.created_by, s.created_at, s.remark,
c.name AS customer_name,
c.phone AS customer_phone,
CONCAT(IFNULL(c.province,''), IFNULL(c.city,''), IFNULL(c.district,''), IFNULL(c.address,'')) AS customer_address,
u.nick_name AS sales_person_name
FROM sx_sheep_sale s
LEFT JOIN sx_customer c ON s.customer_id = c.id
LEFT JOIN sys_user u ON s.sales_person_id = u.user_id
</sql>
<!-- 【新增】根据耳号查询羊只信息的SQL片段 -->
<sql id="selectSheepFileVo">
select
bs_manage_tags,
variety,
name as sheep_name,
gender,
month_age,
parity,
breed,
post_lambing_day,
lactation_day,
lambing_day,
sheepfold_id
bs_manage_tags, variety, name as sheep_name, gender, month_age, parity, breed,
post_lambing_day, lactation_day, lambing_day, sheepfold_id
from sheep_file
</sql>
<!-- 【新增】根据耳号查询羊只信息 -->
<select id="selectSheepInfoByTag" parameterType="String" resultMap="SxSheepSaleResult">
<include refid="selectSheepFileVo"/>
where bs_manage_tags = #{bsManageTags}
@@ -68,18 +74,26 @@
<select id="selectSxSheepSaleList" parameterType="SxSheepSale" resultMap="SxSheepSaleResult">
<include refid="selectSxSheepSaleVo"/>
<where>
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
<if test="sheepName != null and sheepName != ''"> and sheep_name = #{sheepName}</if>
<if test="saleDate != null"> and sale_date = #{saleDate}</if>
<if test="saleType != null and saleType != ''"> and sale_type = #{saleType}</if>
<if test="customerName != null and customerName != ''">
AND c.name LIKE CONCAT('%', #{customerName}, '%')
</if>
<if test="salesPersonName != null and salesPersonName != ''">
AND u.nick_name LIKE CONCAT('%', #{salesPersonName}, '%')
</if>
<if test="params.beginSaleDate != null and params.beginSaleDate != ''">
AND date_format(s.sale_date,'%y%m%d') &gt;= date_format(#{params.beginSaleDate},'%y%m%d')
</if>
<if test="params.endSaleDate != null and params.endSaleDate != ''">
AND date_format(s.sale_date,'%y%m%d') &lt;= date_format(#{params.endSaleDate},'%y%m%d')
</if>
</where>
</select>
<select id="selectSxSheepSaleById" parameterType="Long" resultMap="SxSheepSaleResult">
<include refid="selectSxSheepSaleVo"/>
where id = #{id}
where s.id = #{id}
</select>
<insert id="insertSxSheepSale" parameterType="SxSheepSale" useGeneratedKeys="true" keyProperty="id">

View File

@@ -0,0 +1,172 @@
<?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.work.mapper.WorkOrderMapper">
<resultMap type="WorkOrder" id="WorkOrderResult">
<result property="id" column="id" />
<result property="orderNo" column="order_no" />
<result property="planId" column="plan_id" />
<result property="bizType" column="biz_type" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="department" column="department" />
<result property="executorIds" column="executor_ids" />
<result property="executeDate" column="execute_date" />
<result property="executeTime" column="execute_time" />
<result property="sheepScope" column="sheep_scope" />
<result property="location" column="location" />
<result property="materialList" column="material_list" />
<result property="toolList" column="tool_list" />
<result property="status" column="status" />
<result property="priority" column="priority" />
<result property="issuerId" column="issuer_id" />
<result property="issueTime" column="issue_time" />
<result property="receiverId" column="receiver_id" />
<result property="receiveTime" column="receive_time" />
<result property="finishTime" column="finish_time" />
<result property="result" column="result" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="deleted" column="deleted" />
</resultMap>
<sql id="selectWorkOrderVo">
select id, order_no, plan_id, biz_type, title, content, department, executor_ids, execute_date, execute_time, sheep_scope, location, material_list, tool_list, status, priority, issuer_id, issue_time, receiver_id, receive_time, finish_time, result, remark, create_time, update_time, deleted from work_order
</sql>
<select id="selectWorkOrderList" parameterType="WorkOrder" resultMap="WorkOrderResult">
<include refid="selectWorkOrderVo"/>
<where>
<if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
<if test="planId != null "> and plan_id = #{planId}</if>
<if test="bizType != null "> and biz_type = #{bizType}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="department != null and department != ''"> and department = #{department}</if>
<if test="executorIds != null and executorIds != ''"> and executor_ids = #{executorIds}</if>
<if test="executeDate != null "> and execute_date = #{executeDate}</if>
<if test="executeTime != null and executeTime != ''"> and execute_time = #{executeTime}</if>
<if test="sheepScope != null and sheepScope != ''"> and sheep_scope = #{sheepScope}</if>
<if test="location != null and location != ''"> and location = #{location}</if>
<if test="materialList != null and materialList != ''"> and material_list = #{materialList}</if>
<if test="toolList != null and toolList != ''"> and tool_list = #{toolList}</if>
<if test="status != null "> and status = #{status}</if>
<if test="priority != null "> and priority = #{priority}</if>
<if test="issuerId != null "> and issuer_id = #{issuerId}</if>
<if test="issueTime != null "> and issue_time = #{issueTime}</if>
<if test="receiverId != null "> and receiver_id = #{receiverId}</if>
<if test="receiveTime != null "> and receive_time = #{receiveTime}</if>
<if test="finishTime != null "> and finish_time = #{finishTime}</if>
<if test="result != null and result != ''"> and result = #{result}</if>
</where>
</select>
<select id="selectWorkOrderById" parameterType="Long" resultMap="WorkOrderResult">
<include refid="selectWorkOrderVo"/>
where id = #{id}
</select>
<insert id="insertWorkOrder" parameterType="WorkOrder" useGeneratedKeys="true" keyProperty="id">
insert into work_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">order_no,</if>
<if test="planId != null">plan_id,</if>
<if test="bizType != null">biz_type,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null">content,</if>
<if test="department != null and department != ''">department,</if>
<if test="executorIds != null and executorIds != ''">executor_ids,</if>
<if test="executeDate != null">execute_date,</if>
<if test="executeTime != null">execute_time,</if>
<if test="sheepScope != null and sheepScope != ''">sheep_scope,</if>
<if test="location != null">location,</if>
<if test="materialList != null">material_list,</if>
<if test="toolList != null">tool_list,</if>
<if test="status != null">status,</if>
<if test="priority != null">priority,</if>
<if test="issuerId != null">issuer_id,</if>
<if test="issueTime != null">issue_time,</if>
<if test="receiverId != null">receiver_id,</if>
<if test="receiveTime != null">receive_time,</if>
<if test="finishTime != null">finish_time,</if>
<if test="result != null">result,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleted != null">deleted,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
<if test="planId != null">#{planId},</if>
<if test="bizType != null">#{bizType},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null">#{content},</if>
<if test="department != null and department != ''">#{department},</if>
<if test="executorIds != null and executorIds != ''">#{executorIds},</if>
<if test="executeDate != null">#{executeDate},</if>
<if test="executeTime != null">#{executeTime},</if>
<if test="sheepScope != null and sheepScope != ''">#{sheepScope},</if>
<if test="location != null">#{location},</if>
<if test="materialList != null">#{materialList},</if>
<if test="toolList != null">#{toolList},</if>
<if test="status != null">#{status},</if>
<if test="priority != null">#{priority},</if>
<if test="issuerId != null">#{issuerId},</if>
<if test="issueTime != null">#{issueTime},</if>
<if test="receiverId != null">#{receiverId},</if>
<if test="receiveTime != null">#{receiveTime},</if>
<if test="finishTime != null">#{finishTime},</if>
<if test="result != null">#{result},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleted != null">#{deleted},</if>
</trim>
</insert>
<update id="updateWorkOrder" parameterType="WorkOrder">
update work_order
<trim prefix="SET" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="planId != null">plan_id = #{planId},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="department != null and department != ''">department = #{department},</if>
<if test="executorIds != null and executorIds != ''">executor_ids = #{executorIds},</if>
<if test="executeDate != null">execute_date = #{executeDate},</if>
<if test="executeTime != null">execute_time = #{executeTime},</if>
<if test="sheepScope != null and sheepScope != ''">sheep_scope = #{sheepScope},</if>
<if test="location != null">location = #{location},</if>
<if test="materialList != null">material_list = #{materialList},</if>
<if test="toolList != null">tool_list = #{toolList},</if>
<if test="status != null">status = #{status},</if>
<if test="priority != null">priority = #{priority},</if>
<if test="issuerId != null">issuer_id = #{issuerId},</if>
<if test="issueTime != null">issue_time = #{issueTime},</if>
<if test="receiverId != null">receiver_id = #{receiverId},</if>
<if test="receiveTime != null">receive_time = #{receiveTime},</if>
<if test="finishTime != null">finish_time = #{finishTime},</if>
<if test="result != null">result = #{result},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleted != null">deleted = #{deleted},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWorkOrderById" parameterType="Long">
delete from work_order where id = #{id}
</delete>
<delete id="deleteWorkOrderByIds" parameterType="String">
delete from work_order where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>