Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -126,5 +126,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectByParentIdAndGroupName" resultMap="BasSheepGroupResult">
|
||||
SELECT * FROM bas_sheep_group
|
||||
WHERE parent_id = #{parentId} AND group_name = #{groupName}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectDewormVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="sheepNo != null and sheepNo != ''">and 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="technical != null and technical != ''"> and technical = #{technical}</if>
|
||||
</where>
|
||||
|
||||
@@ -34,9 +34,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</sql>
|
||||
|
||||
<select id="selectHealthList" parameterType="Health" resultMap="HealthResult">
|
||||
<include refid="selectHealthVo"/>
|
||||
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
|
||||
|
||||
<where>
|
||||
<if test="datetime != null "> and datetime = #{datetime}</if>
|
||||
<if test="sheepNo != null and sheepNo != ''">and 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="technical != null and technical != ''"> and technical = #{technical}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
|
||||
@@ -32,10 +32,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</sql>
|
||||
|
||||
<select id="selectImmunityList" parameterType="Immunity" resultMap="ImmunityResult">
|
||||
<include refid="selectImmunityVo"/>
|
||||
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
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="sheepType != null "> and sheep_type = #{sheepType}</if>
|
||||
<if test="sheepNo != null and sheepNo != ''">and 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="technical != null and technical != ''"> and technical = #{technical}</if>
|
||||
</where>
|
||||
|
||||
@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="dosage" column="dosage" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="usageId" column="usageId" />
|
||||
<result property="usetime" column="usetime" />
|
||||
<result property="manufacturer" column="manufacturer" />
|
||||
<result property="batchNumber" column="batch_number" />
|
||||
</resultMap>
|
||||
@@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectSwMedicineUsageDetailsList" resultMap="SwMedicineUsageDetailsResult">
|
||||
select smud.id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number,
|
||||
select smud.id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number,
|
||||
sm.name
|
||||
from sw_medicine_usage_details smud
|
||||
join sw_medicine sm on smud.medi_id = sm.id
|
||||
@@ -133,9 +134,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<insert id="batchSwMedicineUsageDetails">
|
||||
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number) values
|
||||
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.manufacturer}, #{item.batchNumber})
|
||||
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.usetime},#{item.manufacturer}, #{item.batchNumber})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="diseasePName" column="disease_pname"/>
|
||||
<result property="veterinary" column="veterinary" />
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="status" column="status"/>
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
@@ -32,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTreatmentVo">
|
||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
||||
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,status, 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
|
||||
@@ -43,11 +44,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</sql>
|
||||
|
||||
<select id="selectTreatmentList" parameterType="Treatment" resultMap="TreatmentResult">
|
||||
<include refid="selectTreatmentVo"/>
|
||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id,status, 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
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="sheepNo != null and sheepNo != ''">and 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="diseaseId != null "> and disease_id = #{diseaseId}</if>
|
||||
<if test="status != null and status !=''"> and status = #{status}</if>
|
||||
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
@@ -57,6 +67,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectTreatmentVo"/>
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
<select id="selectTreatmentStatus" resultMap="TreatmentResult">
|
||||
select * from sw_treatment where sheep_id = #{sheepId} and status in (0, 1)
|
||||
</select>
|
||||
|
||||
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_treatment
|
||||
@@ -76,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">disease_pid,</if>
|
||||
<if test="veterinary != null">veterinary,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@@ -98,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">#{diseasePid},</if>
|
||||
<if test="veterinary != null">#{veterinary},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@@ -110,14 +125,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
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,
|
||||
disease_id, disease_pid, veterinary, usage_id,status ,
|
||||
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.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.status}, #{t.comment},
|
||||
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -140,6 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">disease_pid = #{diseasePid},</if>
|
||||
<if test="veterinary != null">veterinary = #{veterinary},</if>
|
||||
<if test="usageId != null">usage_id = #{usageId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.dairyProducts.mapper.NpSheepMilkAnalysisMapper">
|
||||
|
||||
<!-- 1) 获取 distinct sheep_id(支持按 sheep_file.bs_manage_tags 模糊搜索) -->
|
||||
<!-- 1) 获取distinct sheep_id(支持按sheep_file.bs_manage_tags模糊搜索) -->
|
||||
<select id="selectDistinctSheepIds" resultType="string" parameterType="map">
|
||||
SELECT DISTINCT a.sheep_id
|
||||
FROM np_milk_prod_classes a
|
||||
@@ -30,8 +30,7 @@
|
||||
ORDER BY datetime ASC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 3) 获取该羊在 sheep_file 视图中的基础信息 -->
|
||||
<!-- 3) 获取该羊在sheep_file视图中的基础信息 -->
|
||||
<!-- 假设字段名称:bs_manage_tags、variety、lactation_day、name、birthday、parity、month_age、current_weight、breed、father_manage_tags、mother_manage_tags、dr_ranch、family -->
|
||||
<select id="selectSheepFileBySheepId" resultType="map" parameterType="string">
|
||||
SELECT
|
||||
@@ -53,10 +52,29 @@
|
||||
WHERE id = #{sheepId}
|
||||
</select>
|
||||
|
||||
<!-- 4) 兼容旧 list 查询(返回 domain 对象列表),但在我们的实现中 service 会构造最终的 NpSheepMilkAnalysis 列表 -->
|
||||
<!-- 4) 兼容旧list查询(返回domain对象列表),但在我们的实现中service会构造最终的NpSheepMilkAnalysis列表 -->
|
||||
<select id="selectNpSheepMilkAnalysisList" resultType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
|
||||
<!-- 如果你仍需基于某张表的简单映射,可在此实现;当前我们在 ServiceImpl 中组装对象,所以该查询不做复杂实现 -->
|
||||
<!-- 如果你仍需基于某张表的简单映射,可在此实现;当前我们在ServiceImpl中组装对象,所以该查询不做复杂实现 -->
|
||||
SELECT 1 FROM dual WHERE 1=0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
<!-- 5) 导出奶产量分析记录 -->
|
||||
<select id="selectNpSheepMilkAnalysisForExport" resultType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis" parameterType="com.zhyc.module.dairyProducts.domain.NpSheepMilkAnalysis">
|
||||
<!-- 这里需要根据实际表结构编写SQL查询 -->
|
||||
<!-- 示例SQL,需要根据实际表结构调整 -->
|
||||
SELECT
|
||||
sf.id as sheepId,
|
||||
sf.bs_manage_tags as manageEarTag,
|
||||
sf.variety,
|
||||
<!-- 其他字段 -->
|
||||
FROM sheep_file sf
|
||||
LEFT JOIN np_milk_prod_classes m ON sf.id = m.sheep_id
|
||||
<where>
|
||||
<if test="manageEarTag != null and manageEarTag != ''">
|
||||
AND sf.bs_manage_tags LIKE CONCAT('%', #{manageEarTag}, '%')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY sf.id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -13,17 +13,18 @@
|
||||
<result property="coefficient" column="coefficient"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 修改SQL片段,系数保留两位小数 -->
|
||||
<sql id="selectXzDryMatterCorrectionVo">
|
||||
SELECT
|
||||
id,
|
||||
datetime,
|
||||
factory,
|
||||
content,
|
||||
standard,
|
||||
CASE
|
||||
WHEN standard = 0 OR standard IS NULL THEN NULL
|
||||
ELSE content / standard
|
||||
END AS coefficient
|
||||
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
|
||||
FROM xz_dry_matter_correction
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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.dairyProducts.mapper.XzParityCorrectionMapper">
|
||||
|
||||
|
||||
<resultMap type="XzParityCorrection" id="XzParityCorrectionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="parity" column="parity" />
|
||||
@@ -16,12 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectXzParityCorrectionList" parameterType="XzParityCorrection" resultMap="XzParityCorrectionResult">
|
||||
<include refid="selectXzParityCorrectionVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="parity != null "> and parity = #{parity}</if>
|
||||
<if test="coef != null "> and coef = #{coef}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectXzParityCorrectionById" parameterType="Long" resultMap="XzParityCorrectionResult">
|
||||
<include refid="selectXzParityCorrectionVo"/>
|
||||
where id = #{id}
|
||||
@@ -32,11 +32,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="coef != null">coef,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="coef != null">#{coef},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateXzParityCorrection" parameterType="XzParityCorrection">
|
||||
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteXzParityCorrectionByIds" parameterType="String">
|
||||
delete from xz_parity_correction where id in
|
||||
delete from xz_parity_correction where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
<include refid="selectSgFeedListVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = #{formulaBatchId}</if>
|
||||
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if>
|
||||
<if test="deployDate != null "> and deploy_date = #{deployDate}</if>
|
||||
</where>
|
||||
ORDER BY deploy_date ASC, formula_id ASC, formula_batch_id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedListById" parameterType="Long" resultMap="SgFeedListResult">
|
||||
@@ -67,4 +69,8 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAll">
|
||||
DELETE FROM sg_feed_list;
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -37,9 +37,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectSgFeedPlanVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
|
||||
<if test="sheepHouseId != null "> and sheep_house_id = #{sheepHouseId}</if>
|
||||
<if test="planDate != null "> and plan_date = #{planDate}</if>
|
||||
</where>
|
||||
ORDER BY formula_id ASC, plan_date ASC
|
||||
ORDER BY plan_date ASC, formula_id ASC , batch_id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedPlanByCreateDate" parameterType="Date" resultMap="SgFeedPlanResult">
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?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.feed.mapper.SgFeedStatisticMapper">
|
||||
|
||||
<resultMap type="SgFeedStatistic" id="SgFeedStatisticResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="formulaBatchId" column="formula_batch_id" />
|
||||
<result property="sheepFoldCount" column="sheep_fold_count" />
|
||||
<result property="silageLossRate" column="silage_loss_rate" />
|
||||
<result property="feedTotalSize" column="feed_total_size" />
|
||||
<result property="feedDailySize" column="feed_daily_size" />
|
||||
<!--
|
||||
适配泛型TypeHandler
|
||||
弃用: XML中无法使用"<>"
|
||||
-->
|
||||
<!-- <result property="materialList" column="material_list"-->
|
||||
<!-- typeHandler="com.zhyc.module.feed.mapper.TypeHandler.JsonTypeHandler<java.util.List<com.zhyc.module.feed.domain.SgFormulaList>>" />-->
|
||||
<!-- 分别使用两个TypeHandler完成实体类List<T> 到 数据库 JSON串的映射转换 -->
|
||||
<result property="materialList" column="material_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler"/>
|
||||
<result property="sheepFoldList" column="sheep_fold_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler"/>
|
||||
<result property="feedDate" column="feed_date" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedStatisticVo">
|
||||
select id, formula_id, formula_batch_id, sheep_fold_count, silage_loss_rate, feed_total_size, feed_daily_size, material_list, sheep_fold_list,feed_date from sg_feed_statistic
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedStatisticList" parameterType="SgFeedStatistic" resultMap="SgFeedStatisticResult">
|
||||
<include refid="selectSgFeedStatisticVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = #{formulaBatchId}</if>
|
||||
<if test="silageLossRate != null and silageLossRate != ''"> and silage_loss_rate = #{silageLossRate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedStatisticById" parameterType="String" resultMap="SgFeedStatisticResult">
|
||||
<include refid="selectSgFeedStatisticVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFeedStatistic" parameterType="SgFeedStatistic">
|
||||
insert into sg_feed_statistic
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="formulaId != null and formulaId != ''">formula_id,</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">formula_batch_id,</if>
|
||||
<if test="sheepFoldCount != null">sheep_fold_count,</if>
|
||||
<if test="silageLossRate != null">silage_loss_rate,</if>
|
||||
<if test="feedTotalSize != null">feed_total_size,</if>
|
||||
<if test="feedDailySize != null">feed_daily_size,</if>
|
||||
<if test="materialList != null">material_list,</if>
|
||||
<if test="sheepFoldList != null">sheep_fold_list,</if>
|
||||
<if test="feedDate != null">feed_date,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">#{formulaBatchId},</if>
|
||||
<if test="sheepFoldCount != null">#{sheepFoldCount},</if>
|
||||
<if test="silageLossRate != null">#{silageLossRate},</if>
|
||||
<if test="feedTotalSize != null">#{feedTotalSize},</if>
|
||||
<if test="feedDailySize != null">#{feedDailySize},</if>
|
||||
# 写入操作需要手动指定 TypeHandler 参数
|
||||
<if test="materialList != null">#{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},</if>
|
||||
<if test="sheepFoldList != null">#{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if>
|
||||
<if test="feedDate != null">#{feedDate},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedStatistic" parameterType="SgFeedStatistic">
|
||||
update sg_feed_statistic
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="formulaId != null and formulaId != ''">formula_id = #{formulaId},</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">formula_batch_id = #{formulaBatchId},</if>
|
||||
<if test="sheepFoldCount != null">sheep_fold_count = #{sheepFoldCount},</if>
|
||||
<if test="silageLossRate != null">silage_loss_rate = #{silageLossRate},</if>
|
||||
<if test="feedTotalSize != null">feed_total_size = #{feedTotalSize},</if>
|
||||
<if test="feedDailySize != null">feed_daily_size = #{feedDailySize},</if>
|
||||
<if test="materialList != null">material_list = #{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},</if>
|
||||
<if test="sheepFoldList != null">sheep_fold_list = #{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if>
|
||||
<if test="feedDate != null">feed_date = #{feedDate},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedStatisticById" parameterType="String">
|
||||
delete from sg_feed_statistic where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedStatisticByIds" parameterType="String">
|
||||
delete from sg_feed_statistic where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
207
zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml
Normal file
207
zhyc-module/src/main/resources/mapper/sale/SxSheepSaleMapper.xml
Normal file
@@ -0,0 +1,207 @@
|
||||
<?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.sale.mapper.SxSheepSaleMapper">
|
||||
|
||||
<resultMap type="SxSheepSale" id="SxSheepSaleResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="bsManageTags" column="bs_manage_tags" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="sheepName" column="sheep_name" />
|
||||
<result property="gender" column="gender" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="breed" column="breed" />
|
||||
<result property="postLambingDay" column="post_lambing_day" />
|
||||
<result property="lactationDay" column="lactation_day" />
|
||||
<result property="lambingDay" column="lambing_day" />
|
||||
<result property="eventType" column="event_type" />
|
||||
<result property="saleDate" column="sale_date" />
|
||||
<result property="pricingMethod" column="pricing_method" />
|
||||
<result property="unitPrice" column="unit_price" />
|
||||
<result property="totalPrice" column="total_price" />
|
||||
<result property="totalWeight" column="total_weight" />
|
||||
<result property="avgWeight" column="avg_weight" />
|
||||
<result property="avgPricePerSheep" column="avg_price_per_sheep" />
|
||||
<result property="saleType" column="sale_type" />
|
||||
<result property="diseaseType" column="disease_type" />
|
||||
<result property="secondaryReason" column="secondary_reason" />
|
||||
<result property="groupCode" column="group_code" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="salesPersonId" column="sales_person_id" />
|
||||
<result property="quarantineNo" column="quarantine_no" />
|
||||
<result property="approvalNo" column="approval_no" />
|
||||
<result property="technicianId" column="technician_id" />
|
||||
<result property="handlerId" column="handler_id" />
|
||||
<result property="createdBy" column="created_by" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="remark" column="remark" />
|
||||
</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
|
||||
</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
|
||||
from sheep_file
|
||||
</sql>
|
||||
|
||||
<!-- 【新增】根据耳号查询羊只信息 -->
|
||||
<select id="selectSheepInfoByTag" parameterType="String" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSheepFileVo"/>
|
||||
where bs_manage_tags = #{bsManageTags}
|
||||
</select>
|
||||
|
||||
<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>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSxSheepSaleById" parameterType="Long" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSxSheepSaleVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSxSheepSale" parameterType="SxSheepSale" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sx_sheep_sale
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="bsManageTags != null and bsManageTags != ''">bs_manage_tags,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="variety != null and variety != ''">variety,</if>
|
||||
<if test="sheepName != null and sheepName != ''">sheep_name,</if>
|
||||
<if test="gender != null and gender != ''">gender,</if>
|
||||
<if test="monthAge != null">month_age,</if>
|
||||
<if test="parity != null">parity,</if>
|
||||
<if test="breed != null and breed != ''">breed,</if>
|
||||
<if test="postLambingDay != null">post_lambing_day,</if>
|
||||
<if test="lactationDay != null">lactation_day,</if>
|
||||
<if test="lambingDay != null">lambing_day,</if>
|
||||
<if test="eventType != null and eventType != ''">event_type,</if>
|
||||
<if test="saleDate != null">sale_date,</if>
|
||||
<if test="pricingMethod != null and pricingMethod != ''">pricing_method,</if>
|
||||
<if test="unitPrice != null">unit_price,</if>
|
||||
<if test="totalPrice != null">total_price,</if>
|
||||
<if test="totalWeight != null">total_weight,</if>
|
||||
<if test="avgWeight != null">avg_weight,</if>
|
||||
<if test="avgPricePerSheep != null">avg_price_per_sheep,</if>
|
||||
<if test="saleType != null and saleType != ''">sale_type,</if>
|
||||
<if test="diseaseType != null and diseaseType != ''">disease_type,</if>
|
||||
<if test="secondaryReason != null and secondaryReason != ''">secondary_reason,</if>
|
||||
<if test="groupCode != null and groupCode != ''">group_code,</if>
|
||||
<if test="customerId != null">customer_id,</if>
|
||||
<if test="salesPersonId != null">sales_person_id,</if>
|
||||
<if test="quarantineNo != null and quarantineNo != ''">quarantine_no,</if>
|
||||
<if test="approvalNo != null and approvalNo != ''">approval_no,</if>
|
||||
<if test="technicianId != null">technician_id,</if>
|
||||
<if test="handlerId != null">handler_id,</if>
|
||||
<if test="createdBy != null">created_by,</if>
|
||||
<if test="createdAt != null">created_at,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="bsManageTags != null and bsManageTags != ''">#{bsManageTags},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="variety != null and variety != ''">#{variety},</if>
|
||||
<if test="sheepName != null and sheepName != ''">#{sheepName},</if>
|
||||
<if test="gender != null and gender != ''">#{gender},</if>
|
||||
<if test="monthAge != null">#{monthAge},</if>
|
||||
<if test="parity != null">#{parity},</if>
|
||||
<if test="breed != null and breed != ''">#{breed},</if>
|
||||
<if test="postLambingDay != null">#{postLambingDay},</if>
|
||||
<if test="lactationDay != null">#{lactationDay},</if>
|
||||
<if test="lambingDay != null">#{lambingDay},</if>
|
||||
<if test="eventType != null and eventType != ''">#{eventType},</if>
|
||||
<if test="saleDate != null">#{saleDate},</if>
|
||||
<if test="pricingMethod != null and pricingMethod != ''">#{pricingMethod},</if>
|
||||
<if test="unitPrice != null">#{unitPrice},</if>
|
||||
<if test="totalPrice != null">#{totalPrice},</if>
|
||||
<if test="totalWeight != null">#{totalWeight},</if>
|
||||
<if test="avgWeight != null">#{avgWeight},</if>
|
||||
<if test="avgPricePerSheep != null">#{avgPricePerSheep},</if>
|
||||
<if test="saleType != null and saleType != ''">#{saleType},</if>
|
||||
<if test="diseaseType != null and diseaseType != ''">#{diseaseType},</if>
|
||||
<if test="secondaryReason != null and secondaryReason != ''">#{secondaryReason},</if>
|
||||
<if test="groupCode != null and groupCode != ''">#{groupCode},</if>
|
||||
<if test="customerId != null">#{customerId},</if>
|
||||
<if test="salesPersonId != null">#{salesPersonId},</if>
|
||||
<if test="quarantineNo != null and quarantineNo != ''">#{quarantineNo},</if>
|
||||
<if test="approvalNo != null and approvalNo != ''">#{approvalNo},</if>
|
||||
<if test="technicianId != null">#{technicianId},</if>
|
||||
<if test="handlerId != null">#{handlerId},</if>
|
||||
<if test="createdBy != null">#{createdBy},</if>
|
||||
<if test="createdAt != null">#{createdAt},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSxSheepSale" parameterType="SxSheepSale">
|
||||
update sx_sheep_sale
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="bsManageTags != null and bsManageTags != ''">bs_manage_tags = #{bsManageTags},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="variety != null and variety != ''">variety = #{variety},</if>
|
||||
<if test="sheepName != null and sheepName != ''">sheep_name = #{sheepName},</if>
|
||||
<if test="gender != null and gender != ''">gender = #{gender},</if>
|
||||
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||||
<if test="parity != null">parity = #{parity},</if>
|
||||
<if test="breed != null and breed != ''">breed = #{breed},</if>
|
||||
<if test="postLambingDay != null">post_lambing_day = #{postLambingDay},</if>
|
||||
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
|
||||
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
|
||||
<if test="eventType != null and eventType != ''">event_type = #{eventType},</if>
|
||||
<if test="saleDate != null">sale_date = #{saleDate},</if>
|
||||
<if test="pricingMethod != null and pricingMethod != ''">pricing_method = #{pricingMethod},</if>
|
||||
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
|
||||
<if test="totalPrice != null">total_price = #{totalPrice},</if>
|
||||
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
|
||||
<if test="avgWeight != null">avg_weight = #{avgWeight},</if>
|
||||
<if test="avgPricePerSheep != null">avg_price_per_sheep = #{avgPricePerSheep},</if>
|
||||
<if test="saleType != null and saleType != ''">sale_type = #{saleType},</if>
|
||||
<if test="diseaseType != null and diseaseType != ''">disease_type = #{diseaseType},</if>
|
||||
<if test="secondaryReason != null and secondaryReason != ''">secondary_reason = #{secondaryReason},</if>
|
||||
<if test="groupCode != null and groupCode != ''">group_code = #{groupCode},</if>
|
||||
<if test="customerId != null">customer_id = #{customerId},</if>
|
||||
<if test="salesPersonId != null">sales_person_id = #{salesPersonId},</if>
|
||||
<if test="quarantineNo != null and quarantineNo != ''">quarantine_no = #{quarantineNo},</if>
|
||||
<if test="approvalNo != null and approvalNo != ''">approval_no = #{approvalNo},</if>
|
||||
<if test="technicianId != null">technician_id = #{technicianId},</if>
|
||||
<if test="handlerId != null">handler_id = #{handlerId},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSxSheepSaleById" parameterType="Long">
|
||||
delete from sx_sheep_sale where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSxSheepSaleByIds" parameterType="String">
|
||||
delete from sx_sheep_sale where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -26,7 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectWzMaterialsManagementVo"/>
|
||||
<where>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
<if test="params.beginProductionDate != null and params.beginProductionDate != '' and params.endProductionDate != null and params.endProductionDate != ''"> and production_date between #{params.beginProductionDate} and #{params.endProductionDate}</if>
|
||||
<if test="params.beginProductionDate != null and params.endProductionDate != null"> and production_date between #{params.beginProductionDate} and #{params.endProductionDate}</if>
|
||||
<if test="productionDate != null"> and production_date = #{productionDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if>
|
||||
<if test="repositoryName != null and repositoryName != ''"> and repository_name like concat('%', #{repositoryName}, '%')</if>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
<if test="docDate != null"> and doc_date = #{docDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user