131 lines
6.9 KiB
XML
131 lines
6.9 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.biosafety.mapper.QuarantineReportMapper">
|
||
|
|
|
||
|
|
<resultMap type="QuarantineReport" id="QuarantineReportResult">
|
||
|
|
<result property="id" column="id" />
|
||
|
|
<result property="sheepId" column="sheep_id" />
|
||
|
|
<result property="sheepNo" column="sheep_no"/>
|
||
|
|
<result property="sheepType" column="sheep_type"/>
|
||
|
|
<result property="gender" column="gender"/>
|
||
|
|
<result property="monthAge" column="month_age"/>
|
||
|
|
<result property="parity" column="parity"/>
|
||
|
|
<result property="breed" column="breed"/>
|
||
|
|
<result property="datetime" column="datetime" />
|
||
|
|
<result property="quarItem" column="quar_item" />
|
||
|
|
<result property="itemName" column="item_name"/>
|
||
|
|
<result property="sample" column="sample" />
|
||
|
|
<result property="sampleType" column="sample_type" />
|
||
|
|
<result property="sampler" column="sampler" />
|
||
|
|
<result property="quarOfficer" column="quar_officer" />
|
||
|
|
<result property="result" column="result" />
|
||
|
|
<result property="status" column="status" />
|
||
|
|
<result property="updateBy" column="update_by" />
|
||
|
|
<result property="updateTime" column="update_time" />
|
||
|
|
<result property="createBy" column="create_by" />
|
||
|
|
<result property="createTime" column="create_time" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectQuarantineReportVo">
|
||
|
|
select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
|
||
|
|
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
|
||
|
|
sqi.name as item_name,
|
||
|
|
sqs.name as sample,
|
||
|
|
sf.bs_manage_tags sheep_no,sf.gender,sf.parity,sf.breed,sf.month_age
|
||
|
|
from sw_quarantine_report sqr
|
||
|
|
left join sw_quarantine_items sqi on sqr.quar_item = sqi.id
|
||
|
|
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
|
||
|
|
left join sheep_file sf on sqr.sheep_id = sf.id
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectQuarantineReportList" parameterType="QuarantineReport" resultMap="QuarantineReportResult">
|
||
|
|
<include refid="selectQuarantineReportVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="sheepId != null "> and sheep_id = #{sheepId}</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="quarItem != null "> and quar_item = #{quarItem}</if>
|
||
|
|
<if test="sampleType != null "> and sample_type = #{sampleType}</if>
|
||
|
|
<if test="sampler != null and sampler != ''"> and sampler = #{sampler}</if>
|
||
|
|
<if test="quarOfficer != null and quarOfficer != ''"> and quar_officer = #{quarOfficer}</if>
|
||
|
|
<if test="result != null "> and result = #{result}</if>
|
||
|
|
<if test="status != null "> and status = #{status}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectQuarantineReportById" parameterType="Long" resultMap="QuarantineReportResult">
|
||
|
|
select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
|
||
|
|
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
|
||
|
|
sqi.name as item_name,
|
||
|
|
sqs.name as sample,
|
||
|
|
sf.bs_manage_tags sheep_no
|
||
|
|
from sw_quarantine_report sqr
|
||
|
|
left join sw_quarantine_items sqi on sqr.quar_item = sqi.id
|
||
|
|
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
|
||
|
|
left join sheep_file sf on sqr.sheep_id = sf.id
|
||
|
|
where sqr.id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertQuarantineReport" parameterType="QuarantineReport" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
insert into sw_quarantine_report
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="sheepId != null">sheep_id,</if>
|
||
|
|
<if test="datetime != null">datetime,</if>
|
||
|
|
<if test="quarItem != null">quar_item,</if>
|
||
|
|
<if test="sampleType != null">sample_type,</if>
|
||
|
|
<if test="sampler != null">sampler,</if>
|
||
|
|
<if test="quarOfficer != null">quar_officer,</if>
|
||
|
|
<if test="result != null">result,</if>
|
||
|
|
<if test="status != null">status,</if>
|
||
|
|
<if test="updateBy != null">update_by,</if>
|
||
|
|
<if test="updateTime != null">update_time,</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="datetime != null">#{datetime},</if>
|
||
|
|
<if test="quarItem != null">#{quarItem},</if>
|
||
|
|
<if test="sampleType != null">#{sampleType},</if>
|
||
|
|
<if test="sampler != null">#{sampler},</if>
|
||
|
|
<if test="quarOfficer != null">#{quarOfficer},</if>
|
||
|
|
<if test="result != null">#{result},</if>
|
||
|
|
<if test="status != null">#{status},</if>
|
||
|
|
<if test="updateBy != null">#{updateBy},</if>
|
||
|
|
<if test="updateTime != null">#{updateTime},</if>
|
||
|
|
<if test="createBy != null">#{createBy},</if>
|
||
|
|
<if test="createTime != null">#{createTime},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateQuarantineReport" parameterType="QuarantineReport">
|
||
|
|
update sw_quarantine_report
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||
|
|
<if test="datetime != null">datetime = #{datetime},</if>
|
||
|
|
<if test="quarItem != null">quar_item = #{quarItem},</if>
|
||
|
|
<if test="sampleType != null">sample_type = #{sampleType},</if>
|
||
|
|
<if test="sampler != null">sampler = #{sampler},</if>
|
||
|
|
<if test="quarOfficer != null">quar_officer = #{quarOfficer},</if>
|
||
|
|
<if test="result != null">result = #{result},</if>
|
||
|
|
<if test="status != null">status = #{status},</if>
|
||
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
|
</trim>
|
||
|
|
where id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteQuarantineReportById" parameterType="Long">
|
||
|
|
delete from sw_quarantine_report where id = #{id}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteQuarantineReportByIds" parameterType="String">
|
||
|
|
delete from sw_quarantine_report where id in
|
||
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
|
#{id}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|