142 lines
6.7 KiB
XML
142 lines
6.7 KiB
XML
<?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.other.mapper.ScFixHoofMapper">
|
|
|
|
<resultMap type="com.zhyc.module.produce.other.domain.ScFixHoof" id="ScFixHoofResult">
|
|
<result property="id" column="id"/>
|
|
<result property="manageTags" column="manageTags"/>
|
|
<result property="eventType" column="event_type"/>
|
|
<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"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="eventDate" column="eventDate"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectScFixHoofVo">
|
|
select fh.id,
|
|
bs.manage_tags as manageTags,
|
|
'修蹄' as event_type,
|
|
bs.sheepfold_id as sheepfold,
|
|
sf.sheepfold_name as sheepfoldName,
|
|
bs.variety_id as varietyId,
|
|
bv.variety as varietyName,
|
|
fh.comment,
|
|
fh.technician,
|
|
fh.create_by,
|
|
fh.create_time,
|
|
fh.event_date as eventDate
|
|
from sc_fix_hoof fh
|
|
left join bas_sheep bs on fh.sheep_id = bs.id
|
|
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
|
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
|
</sql>
|
|
|
|
<select id="selectScFixHoofList" resultMap="ScFixHoofResult">
|
|
<include refid="selectScFixHoofVo"/>
|
|
<where>
|
|
<if test="sc.ids != null and sc.ids.length > 0">
|
|
and fh.id IN
|
|
<foreach collection="sc.ids" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<if test="sc.ids == null or sc.ids.length == 0">
|
|
<if test="manageTagsList != null and manageTagsList.size() > 0">
|
|
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
|
|
bs.manage_tags like concat('%', #{tag}, '%')
|
|
</foreach>
|
|
</if>
|
|
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
|
|
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
|
|
<if test="sc.technician != null and sc.technician != ''">and fh.technician like concat('%',
|
|
#{sc.technician}, '%')
|
|
</if>
|
|
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
|
|
and fh.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
|
|
</if>
|
|
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
|
|
and fh.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
|
|
</if>
|
|
<if test="sc.isDelete != null">
|
|
and bs.is_delete = #{sc.isDelete}
|
|
</if>
|
|
</if>
|
|
${sc.params.dataScope}
|
|
</where>
|
|
ORDER BY fh.create_time DESC
|
|
</select>
|
|
|
|
<select id="selectScFixHoofById" parameterType="java.lang.Integer" resultMap="ScFixHoofResult">
|
|
<include refid="selectScFixHoofVo"/>
|
|
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">sheep_id,</if>
|
|
<if test="sheepfold != null">sheepfold,</if>
|
|
<if test="varietyId != null">variety_id,</if>
|
|
<if test="comment != null">comment,</if>
|
|
<if test="technician != null and technician != ''">technician,</if>
|
|
<if test="eventDate != null and eventDate != ''">event_date,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="deptId != null">dept_id,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="sheepId != null">#{sheepId},</if>
|
|
<if test="sheepfold != null">#{sheepfold},</if>
|
|
<if test="varietyId != null">#{varietyId},</if>
|
|
<if test="comment != null">#{comment},</if>
|
|
<if test="technician != null and technician != ''">#{technician},</if>
|
|
<if test="eventDate != null and eventDate != ''">#{eventDate},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="deptId != null">#{deptId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateScFixHoof" parameterType="ScFixHoof">
|
|
update sc_fix_hoof
|
|
<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>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteScFixHoofById" parameterType="java.lang.Integer">
|
|
delete
|
|
from sc_fix_hoof
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteScFixHoofByIds" parameterType="java.lang.Integer">
|
|
delete from sc_fix_hoof where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="searchEarNumbers" resultType="java.lang.String">
|
|
SELECT DISTINCT bs.manage_tags
|
|
FROM sc_fix_hoof fh
|
|
LEFT JOIN bas_sheep bs ON fh.sheep_id = bs.id
|
|
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
|
|
ORDER BY bs.manage_tags
|
|
</select>
|
|
</mapper> |