新增羊只,转场,转群,改耳号,改品种,改备注,体尺测量,体况评分,乳况评分,修蹄,去势初版
This commit is contained in:
@@ -5,36 +5,34 @@
|
||||
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper">
|
||||
|
||||
<!-- 1. 结果映射:包含羊舍名称、品种名称 -->
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScAddSheep" id="ScAddSheepResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="earNumber" column="ear_number"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="father" column="father"/>
|
||||
<result property="mother" column="mother"/>
|
||||
<result property="bornWeight" column="born_weight"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="joinDate" column="join_date"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="id" column="id"/>
|
||||
<result property="earNumber" column="ear_number"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="father" column="father"/>
|
||||
<result property="mother" column="mother"/>
|
||||
<result property="bornWeight" column="born_weight"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="joinDate" column="join_date"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 2. 查询列表:支持按品种筛选 -->
|
||||
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
|
||||
SELECT
|
||||
sas.*,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
bv.variety AS varietyName
|
||||
bv.variety AS varietyName
|
||||
FROM sc_add_sheep sas
|
||||
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
|
||||
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
|
||||
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
|
||||
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
|
||||
<where>
|
||||
<if test="earNumber != null and earNumber != ''">
|
||||
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
|
||||
@@ -48,46 +46,43 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 3. 根据耳号精确查询 -->
|
||||
<select id="selectByEarNumber" parameterType="string" resultMap="ScAddSheepResult">
|
||||
SELECT * FROM sc_add_sheep WHERE ear_number = #{earNumber}
|
||||
SELECT *
|
||||
FROM sc_add_sheep
|
||||
WHERE ear_number = #{earNumber}
|
||||
</select>
|
||||
|
||||
<!-- 4. 插入 -->
|
||||
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO sc_add_sheep
|
||||
(ear_number, sheepfold, father, mother, born_weight, birthday,
|
||||
gender, parity, variety_id, join_date, comment, technician,
|
||||
create_by, create_time)
|
||||
VALUES
|
||||
(#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight},
|
||||
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate},
|
||||
#{comment}, #{technician}, #{createBy}, #{createTime})
|
||||
VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight},
|
||||
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate},
|
||||
#{comment}, #{technician}, #{createBy}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<!-- 5. 更新 -->
|
||||
<update id="updateScAddSheep" parameterType="ScAddSheep">
|
||||
UPDATE sc_add_sheep
|
||||
<set>
|
||||
ear_number = #{earNumber},
|
||||
sheepfold = #{sheepfold},
|
||||
father = #{father},
|
||||
mother = #{mother},
|
||||
born_weight = #{bornWeight},
|
||||
birthday = #{birthday},
|
||||
gender = #{gender},
|
||||
parity = #{parity},
|
||||
variety_id = #{varietyId},
|
||||
join_date = #{joinDate},
|
||||
comment = #{comment},
|
||||
technician = #{technician},
|
||||
update_by = #{updateBy},
|
||||
update_time = NOW()
|
||||
ear_number = #{earNumber},
|
||||
sheepfold = #{sheepfold},
|
||||
father = #{father},
|
||||
mother = #{mother},
|
||||
born_weight = #{bornWeight},
|
||||
birthday = #{birthday},
|
||||
gender = #{gender},
|
||||
parity = #{parity},
|
||||
variety_id = #{varietyId},
|
||||
join_date = #{joinDate},
|
||||
comment = #{comment},
|
||||
technician = #{technician},
|
||||
update_by = #{updateBy},
|
||||
update_time = NOW()
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 6. 批量删除 -->
|
||||
<delete id="deleteScAddSheepByIds">
|
||||
DELETE FROM sc_add_sheep WHERE id IN
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScChangeCommentMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeComment" id="ScChangeCommentResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="newComment" column="new_comment"/>
|
||||
<result property="oldComment" column="old_comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScChangeCommentVo">
|
||||
select scc.id,
|
||||
scc.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
scc.new_comment,
|
||||
scc.old_comment,
|
||||
scc.create_by,
|
||||
scc.create_time
|
||||
from sc_change_comment scc
|
||||
left join bas_sheep bs on scc.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult">
|
||||
<include refid="selectScChangeCommentVo"/>
|
||||
<where>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="newComment != null and newComment != ''">
|
||||
and scc.new_comment like concat('%', #{newComment}, '%')
|
||||
</if>
|
||||
<if test="oldComment != null and oldComment != ''">
|
||||
and scc.old_comment like concat('%', #{oldComment}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
|
||||
and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeCommentById" parameterType="Long" resultMap="ScChangeCommentResult">
|
||||
<include refid="selectScChangeCommentVo"/>
|
||||
where scc.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScChangeComment" parameterType="ScChangeComment" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_change_comment
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null and sheepId != ''">sheep_id,</if>
|
||||
<if test="newComment != null and newComment != ''">new_comment,</if>
|
||||
<if test="oldComment != null and oldComment != ''">old_comment,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null and sheepId != ''">#{sheepId},</if>
|
||||
<if test="newComment != null and newComment != ''">#{newComment},</if>
|
||||
<if test="oldComment != null and oldComment != ''">#{oldComment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScChangeComment" parameterType="ScChangeComment">
|
||||
update sc_change_comment
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null and sheepId != ''">sheep_id = #{sheepId},</if>
|
||||
<if test="newComment != null and newComment != ''">new_comment = #{newComment},</if>
|
||||
<if test="oldComment != null and oldComment != ''">old_comment = #{oldComment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScChangeCommentById" parameterType="Long">
|
||||
delete
|
||||
from sc_change_comment
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScChangeCommentByIds" parameterType="String">
|
||||
delete from sc_change_comment where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScChangeEarMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeEar" id="ScChangeEarResult">
|
||||
<result property="id" column="sce_id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="earType" column="ear_type"/>
|
||||
<result property="newTag" column="newTag"/>
|
||||
<result property="oldTag" column="oldTag"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScChangeEarVo">
|
||||
select sce.id as sce_id,
|
||||
sce.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
sce.ear_type,
|
||||
sce.newTag,
|
||||
sce.oldTag as oldTag,
|
||||
sce.comment,
|
||||
sce.create_by,
|
||||
sce.create_time
|
||||
from sc_change_ear sce
|
||||
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeEarList" parameterType="ScChangeEar" resultMap="ScChangeEarResult">
|
||||
<include refid="selectScChangeEarVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and sce.sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="earType != null ">and sce.ear_type = #{earType}</if>
|
||||
<if test="newTag != null and newTag != ''">
|
||||
and sce.newTag LIKE CONCAT('%', #{newTag}, '%')
|
||||
</if>
|
||||
<if test="oldTag != null and oldTag != ''">
|
||||
and sce.oldTag LIKE CONCAT('%', #{oldTag}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and sce.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeEarById" parameterType="Integer" resultMap="ScChangeEarResult">
|
||||
<include refid="selectScChangeEarVo"/>
|
||||
where sce.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScChangeEar" parameterType="ScChangeEar" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_change_ear
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="earType != null">ear_type,</if>
|
||||
<if test="newTag != null and newTag != ''">newTag,</if>
|
||||
<if test="oldTag != null and oldTag != ''">oldTag,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="earType != null">#{earType},</if>
|
||||
<if test="newTag != null and newTag != ''">#{newTag},</if>
|
||||
<if test="oldTag != null and oldTag != ''">#{oldTag},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScChangeEar" parameterType="ScChangeEar">
|
||||
update sc_change_ear
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="earType != null">ear_type = #{earType},</if>
|
||||
<if test="newTag != null and newTag != ''">newTag = #{newTag},</if>
|
||||
<if test="oldTag != null and oldTag != ''">oldTag = #{oldTag},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScChangeEarById" parameterType="Integer">
|
||||
delete
|
||||
from sc_change_ear
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScChangeEarByIds" parameterType="String">
|
||||
delete from sc_change_ear where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScChangeVarietyMapper">
|
||||
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeVariety" id="ScChangeVarietyResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="varietyOld" column="variety_old"/>
|
||||
<result property="varietyNew" column="variety_new"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScChangeVarietyVo">
|
||||
select scv.id,
|
||||
scv.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
scv.variety_old,
|
||||
scv.variety_new,
|
||||
scv.comment,
|
||||
scv.create_by,
|
||||
scv.create_time
|
||||
from sc_change_variety scv
|
||||
left join bas_sheep bs on scv.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeVarietyList" parameterType="ScChangeVariety" resultMap="ScChangeVarietyResult">
|
||||
<include refid="selectScChangeVarietyVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and scv.sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">
|
||||
and scv.variety_old like concat('%', #{varietyOld}, '%')
|
||||
</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">
|
||||
and scv.variety_new like concat('%', #{varietyNew}, '%')
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
|
||||
and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and scv.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeVarietyById" parameterType="Integer" resultMap="ScChangeVarietyResult">
|
||||
<include refid="selectScChangeVarietyVo"/>
|
||||
where scv.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScChangeVariety" parameterType="ScChangeVariety" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_change_variety
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">variety_old,</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">variety_new,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">#{varietyOld},</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">#{varietyNew},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScChangeVariety" parameterType="ScChangeVariety">
|
||||
update sc_change_variety
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="varietyOld != null and varietyOld != ''">variety_old = #{varietyOld},</if>
|
||||
<if test="varietyNew != null and varietyNew != ''">variety_new = #{varietyNew},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScChangeVarietyById" parameterType="Integer">
|
||||
delete
|
||||
from sc_change_variety
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScChangeVarietyByIds" parameterType="String">
|
||||
delete from sc_change_variety where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -4,10 +4,11 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransGroupMapper">
|
||||
|
||||
<resultMap type="ScTransGroup" id="ScTransGroupResult">
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransGroup" id="ScTransGroupResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="sheepTypeId" column="type_id"/>
|
||||
<result property="foldTo" column="fold_to"/>
|
||||
<result property="foldFrom" column="fold_from"/>
|
||||
<result property="reason" column="reason"/>
|
||||
@@ -23,7 +24,7 @@
|
||||
<sql id="selectScTransGroupVo">
|
||||
SELECT tg.id,
|
||||
tg.sheep_id,
|
||||
s.manage_tags AS manageTags,
|
||||
s.manage_tags AS manageTags,
|
||||
tg.fold_to,
|
||||
tg.fold_from,
|
||||
tg.reason,
|
||||
@@ -35,9 +36,12 @@
|
||||
tg.create_by,
|
||||
tg.create_time,
|
||||
sf_from.sheepfold_name AS foldFromName,
|
||||
sf_to.sheepfold_name AS foldToName
|
||||
sf_to.sheepfold_name AS foldToName,
|
||||
st.id AS sheepTypeId,
|
||||
st.name AS sheepTypeName
|
||||
FROM sc_trans_group tg
|
||||
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
|
||||
LEFT JOIN bas_sheep_type st ON s.type_id = st.id
|
||||
LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id
|
||||
LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id
|
||||
LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id
|
||||
@@ -55,7 +59,7 @@
|
||||
<if test="status != null">and status = #{status}</if>
|
||||
<if test="varietyId != null">and tg.variety_id = #{varietyId}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransitionInfoMapper">
|
||||
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
|
||||
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo" id="ScTransitionInfoResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
@@ -11,7 +11,7 @@
|
||||
<result property="transTo" column="trans_to"/>
|
||||
<result property="transFrom" column="trans_from"/>
|
||||
<result property="transType" column="trans_type"/>
|
||||
<result property="transTypeText" column="trans_type_text"/>
|
||||
<result property="transTypeText" column="transTypeText"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="comment" column="comment"/>
|
||||
@@ -20,27 +20,39 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScTransitionInfoVo">
|
||||
SELECT t.*, bv.variety AS varietyName,
|
||||
SELECT t.*,
|
||||
bv.variety AS varietyName,
|
||||
bs.manage_tags AS manageTags,
|
||||
CASE t.trans_type
|
||||
WHEN 0 THEN '内部转场'
|
||||
WHEN 1 THEN '跨场转场'
|
||||
WHEN 2 THEN '销售转场'
|
||||
WHEN 0 THEN '内部调拨'
|
||||
WHEN 1 THEN '内部销售'
|
||||
WHEN 2 THEN '育肥调拨'
|
||||
ELSE '未知'
|
||||
END AS trans_type_text
|
||||
END AS transTypeText,
|
||||
CASE t.status
|
||||
WHEN 0 THEN '待审批'
|
||||
WHEN 1 THEN '已通过'
|
||||
WHEN 2 THEN '已驳回'
|
||||
ELSE '未知状态'
|
||||
END AS statusText
|
||||
FROM sc_transition_info t
|
||||
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
|
||||
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
|
||||
<include refid="selectScTransitionInfoVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="varietyId != null">and t.variety_id = #{varietyId}</if>
|
||||
<if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
|
||||
<if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
|
||||
<if test="status != null ">and status = #{status}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
and t.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -78,6 +90,21 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertScTransitionInfoBatch">
|
||||
INSERT INTO sc_transition_info (
|
||||
sheep_id, variety_id, trans_to, trans_from,
|
||||
trans_type, technician, status, comment,
|
||||
create_by, create_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom},
|
||||
#{item.transType}, #{item.technician}, #{item.status}, #{item.comment},
|
||||
#{item.createBy}, now()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateScTransitionInfo" parameterType="ScTransitionInfo">
|
||||
update sc_transition_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
Reference in New Issue
Block a user