修蹄,去势,转群的新增功能的完善
This commit is contained in:
@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
|
||||
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="com.zhyc.module.base.domain.BasSheep">
|
||||
SELECT s.id,
|
||||
s.sheepfold_id AS sheepfoldId,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
@@ -119,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bas_sheep
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.base.mapper.BasSheepTypeMapper">
|
||||
|
||||
<resultMap type="BasSheepType" id="BasSheepTypeResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasSheepTypeVo">
|
||||
select id, name from bas_sheep_type
|
||||
</sql>
|
||||
|
||||
<select id="selectBasSheepTypeList" parameterType="BasSheepType" resultMap="BasSheepTypeResult">
|
||||
<include refid="selectBasSheepTypeVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepTypeById" parameterType="Integer" resultMap="BasSheepTypeResult">
|
||||
<include refid="selectBasSheepTypeVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBasSheepType" parameterType="BasSheepType" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bas_sheep_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasSheepType" parameterType="BasSheepType">
|
||||
update bas_sheep_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasSheepTypeById" parameterType="Integer">
|
||||
delete from bas_sheep_type where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasSheepTypeByIds" parameterType="String">
|
||||
delete from bas_sheep_type where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -53,4 +53,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectIdByName" parameterType="string" resultType="java.lang.Long">
|
||||
SELECT id
|
||||
FROM bas_sheep_variety
|
||||
WHERE variety = #{varietyName}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -7,6 +7,7 @@
|
||||
<resultMap type="ScTransGroup" id="ScTransGroupResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="foldTo" column="fold_to"/>
|
||||
<result property="foldFrom" column="fold_from"/>
|
||||
<result property="reason" column="reason"/>
|
||||
@@ -22,6 +23,7 @@
|
||||
<sql id="selectScTransGroupVo">
|
||||
SELECT tg.id,
|
||||
tg.sheep_id,
|
||||
s.manage_tags AS manageTags,
|
||||
tg.fold_to,
|
||||
tg.fold_from,
|
||||
tg.reason,
|
||||
@@ -35,6 +37,7 @@
|
||||
sf_from.sheepfold_name AS foldFromName,
|
||||
sf_to.sheepfold_name AS foldToName
|
||||
FROM sc_trans_group tg
|
||||
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
|
||||
LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id
|
||||
LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id
|
||||
LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id
|
||||
@@ -44,6 +47,9 @@
|
||||
<include refid="selectScTransGroupVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and sheep_id = #{sheepId}</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and s.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="foldTo != null and foldTo != ''">and fold_to = #{foldTo}</if>
|
||||
<if test="foldFrom != null and foldFrom != ''">and fold_from = #{foldFrom}</if>
|
||||
<if test="status != null">and status = #{status}</if>
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
<resultMap type="ScCastrate" id="ScCastrateResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/> <!-- 新增耳号映射 -->
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
@@ -18,15 +21,17 @@
|
||||
<sql id="selectScCastrateVo">
|
||||
select sc.id,
|
||||
sc.sheep_id,
|
||||
bs.manage_tags as manageTags, -- 关联羊只表的耳号
|
||||
sc.sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sc.variety_id,
|
||||
bv.variety as varietyName,
|
||||
bv.variety as varietyName,
|
||||
sc.comment,
|
||||
sc.technician,
|
||||
sc.create_by,
|
||||
sc.create_time
|
||||
from sc_castrate sc
|
||||
left join bas_sheep bs on sc.sheep_id = bs.id -- 关联羊只表获取耳号
|
||||
left join da_sheepfold sf on sc.sheepfold = sf.id
|
||||
left join bas_sheep_variety bv on sc.variety_id = bv.id
|
||||
</sql>
|
||||
@@ -34,16 +39,16 @@
|
||||
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
|
||||
<include refid="selectScCastrateVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null and sheepId != ''">and sheep_id like concat('%', #{sheepId}, '%')</if>
|
||||
<if test="sheepfold != null ">and sheepfold like concat('%', #{sheepfold}, '%')</if>
|
||||
<if test="varietyId != null">
|
||||
and sc.variety_id = #{varietyId}
|
||||
<!-- 替换原sheepId条件为耳号条件 -->
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="technician != null and technician != ''">and technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
<if test="sheepfold != null ">and sc.sheepfold = #{sheepfold}</if>
|
||||
<if test="varietyId != null">and sc.variety_id = #{varietyId}</if>
|
||||
<if test="technician != null and technician != ''">and sc.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
|
||||
<resultMap type="ScFixHoof" id="ScFixHoofResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
@@ -17,15 +18,19 @@
|
||||
|
||||
<sql id="selectScFixHoofVo">
|
||||
select fh.id,
|
||||
fh.sheep_id,
|
||||
bs.manage_tags AS manageTags,
|
||||
fh.sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
fh.variety_id,
|
||||
bv.variety AS varietyName,
|
||||
fh.comment,
|
||||
fh.technician,
|
||||
fh.create_by,
|
||||
fh.create_time
|
||||
from sc_fix_hoof fh
|
||||
left join bas_sheep bs on fh.sheep_id = bs.id
|
||||
left join da_sheepfold sf on fh.sheepfold = sf.id
|
||||
left join bas_sheep_variety bv on fh.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
|
||||
@@ -33,9 +38,15 @@
|
||||
<where>
|
||||
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
|
||||
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
|
||||
<if test="varietyId != null">
|
||||
and fh.variety_id = #{varietyId}
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -44,24 +55,24 @@
|
||||
where fh.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_fix_hoof
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
|
||||
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null and technician != ''">technician,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="sheepfold != null">#{sheepfold},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null and technician != ''">#{technician},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
<insert id="insertScFixHoof" parameterType="ScFixHoof"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO sc_fix_hoof
|
||||
(sheep_id,
|
||||
sheepfold,
|
||||
variety_id,
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null and technician != ''">technician,</if>
|
||||
create_by,
|
||||
create_time)
|
||||
VALUES
|
||||
(#{sheepId},
|
||||
#{sheepfold},
|
||||
<if test="varietyId != null">#{varietyId},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null and technician != ''">#{technician},</if>
|
||||
#{createBy},
|
||||
#{createTime})
|
||||
</insert>
|
||||
|
||||
<update id="updateScFixHoof" parameterType="ScFixHoof">
|
||||
@@ -69,6 +80,7 @@
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
|
||||
<if test="varietyId != null">variety_id=#{varietyId},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="technician != null and technician != ''">technician = #{technician},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
@@ -89,4 +101,6 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user