135 lines
7.1 KiB
XML
135 lines
7.1 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.TreatmentMapper">
|
||
|
|
|
||
|
|
<resultMap type="Treatment" id="TreatmentResult">
|
||
|
|
<result property="id" column="id" />
|
||
|
|
<result property="diagId" column="diag_id" />
|
||
|
|
<result property="sheepId" column="sheep_id" />
|
||
|
|
<result property="variety" column="variety" />
|
||
|
|
<result property="sheepType" column="sheep_type" />
|
||
|
|
<result property="monthAge" column="month_age" />
|
||
|
|
<result property="gender" column="gender" />
|
||
|
|
<result property="parity" column="parity" />
|
||
|
|
<result property="breed" column="breed" />
|
||
|
|
<result property="lactDay" column="lact_day" />
|
||
|
|
<result property="gestDay" column="gest_day" />
|
||
|
|
<result property="datetime" column="datetime" />
|
||
|
|
<result property="diseaseId" column="disease_id" />
|
||
|
|
<result property="diseasePid" column="disease_pid" />
|
||
|
|
<result property="veterinary" column="veterinary" />
|
||
|
|
<result property="usageId" column="usage_id" />
|
||
|
|
<result property="comment" column="comment" />
|
||
|
|
<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="selectTreatmentVo">
|
||
|
|
select id, diag_id, sheep_id, variety, sheep_type, month_age, gender, parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, comment, update_by, update_time, create_by, create_time from sw_treatment
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectTreatmentList" parameterType="Treatment" resultMap="TreatmentResult">
|
||
|
|
<include refid="selectTreatmentVo"/>
|
||
|
|
<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="diseaseId != null "> and disease_id = #{diseaseId}</if>
|
||
|
|
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectTreatmentById" parameterType="Long" resultMap="TreatmentResult">
|
||
|
|
<include refid="selectTreatmentVo"/>
|
||
|
|
where id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
insert into sw_treatment
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="diagId != null">diag_id,</if>
|
||
|
|
<if test="sheepId != null">sheep_id,</if>
|
||
|
|
<if test="variety != null">variety,</if>
|
||
|
|
<if test="sheepType != null">sheep_type,</if>
|
||
|
|
<if test="monthAge != null">month_age,</if>
|
||
|
|
<if test="gender != null">gender,</if>
|
||
|
|
<if test="parity != null">parity,</if>
|
||
|
|
<if test="breed != null">breed,</if>
|
||
|
|
<if test="lactDay != null">lact_day,</if>
|
||
|
|
<if test="gestDay != null">gest_day,</if>
|
||
|
|
<if test="datetime != null">datetime,</if>
|
||
|
|
<if test="diseaseId != null">disease_id,</if>
|
||
|
|
<if test="diseasePid != null">disease_pid,</if>
|
||
|
|
<if test="veterinary != null">veterinary,</if>
|
||
|
|
<if test="usageId != null">usage_id,</if>
|
||
|
|
<if test="comment != null">comment,</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="diagId != null">#{diagId},</if>
|
||
|
|
<if test="sheepId != null">#{sheepId},</if>
|
||
|
|
<if test="variety != null">#{variety},</if>
|
||
|
|
<if test="sheepType != null">#{sheepType},</if>
|
||
|
|
<if test="monthAge != null">#{monthAge},</if>
|
||
|
|
<if test="gender != null">#{gender},</if>
|
||
|
|
<if test="parity != null">#{parity},</if>
|
||
|
|
<if test="breed != null">#{breed},</if>
|
||
|
|
<if test="lactDay != null">#{lactDay},</if>
|
||
|
|
<if test="gestDay != null">#{gestDay},</if>
|
||
|
|
<if test="datetime != null">#{datetime},</if>
|
||
|
|
<if test="diseaseId != null">#{diseaseId},</if>
|
||
|
|
<if test="diseasePid != null">#{diseasePid},</if>
|
||
|
|
<if test="veterinary != null">#{veterinary},</if>
|
||
|
|
<if test="usageId != null">#{usageId},</if>
|
||
|
|
<if test="comment != null">#{comment},</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="updateTreatment" parameterType="Treatment">
|
||
|
|
update sw_treatment
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="diagId != null">diag_id = #{diagId},</if>
|
||
|
|
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||
|
|
<if test="variety != null">variety = #{variety},</if>
|
||
|
|
<if test="sheepType != null">sheep_type = #{sheepType},</if>
|
||
|
|
<if test="monthAge != null">month_age = #{monthAge},</if>
|
||
|
|
<if test="gender != null">gender = #{gender},</if>
|
||
|
|
<if test="parity != null">parity = #{parity},</if>
|
||
|
|
<if test="breed != null">breed = #{breed},</if>
|
||
|
|
<if test="lactDay != null">lact_day = #{lactDay},</if>
|
||
|
|
<if test="gestDay != null">gest_day = #{gestDay},</if>
|
||
|
|
<if test="datetime != null">datetime = #{datetime},</if>
|
||
|
|
<if test="diseaseId != null">disease_id = #{diseaseId},</if>
|
||
|
|
<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="comment != null">comment = #{comment},</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="deleteTreatmentById" parameterType="Long">
|
||
|
|
delete from sw_treatment where id = #{id}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteTreatmentByIds" parameterType="String">
|
||
|
|
delete from sw_treatment where id in
|
||
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
|
#{id}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|