118 lines
6.1 KiB
XML
Raw Normal View History

2025-07-15 17:08:09 +08:00
<?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.DiagnosisMapper">
<resultMap type="Diagnosis" id="DiagnosisResult">
<result property="id" column="id" />
<result property="treatId" column="treat_id" />
<result property="sheepId" column="sheep_id" />
<result property="datetime" column="datetime" />
<result property="sheepType" column="sheep_type" />
<result property="gender" column="gender" />
<result property="parity" column="parity" />
<result property="diseasePid" column="disease_pid" />
<result property="diseaseId" column="disease_id" />
<result property="result" column="result" />
<result property="begindate" column="begindate" />
<result property="enddate" column="enddate" />
<result property="treatDay" column="treat_day" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectDiagnosisVo">
select id, treat_id, sheep_id, datetime, sheep_type, gender, parity, disease_pid, disease_id, result, begindate, enddate, treat_day, sheepfold_id, create_by, create_time from sw_diagnosis
</sql>
<select id="selectDiagnosisList" parameterType="Diagnosis" resultMap="DiagnosisResult">
<include refid="selectDiagnosisVo"/>
<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="diseasePid != null "> and disease_pid = #{diseasePid}</if>
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>
<if test="result != null "> and result = #{result}</if>
<if test="treatDay != null "> and treat_day = #{treatDay}</if>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
</where>
</select>
<select id="selectDiagnosisById" parameterType="Long" resultMap="DiagnosisResult">
<include refid="selectDiagnosisVo"/>
where id = #{id}
</select>
<insert id="insertDiagnosis" parameterType="Diagnosis" useGeneratedKeys="true" keyProperty="id">
insert into sw_diagnosis
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="treatId != null">treat_id,</if>
<if test="sheepId != null">sheep_id,</if>
<if test="datetime != null">datetime,</if>
<if test="sheepType != null">sheep_type,</if>
<if test="gender != null">gender,</if>
<if test="parity != null">parity,</if>
<if test="diseasePid != null">disease_pid,</if>
<if test="diseaseId != null">disease_id,</if>
<if test="result != null">result,</if>
<if test="begindate != null">begindate,</if>
<if test="enddate != null">enddate,</if>
<if test="treatDay != null">treat_day,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="treatId != null">#{treatId},</if>
<if test="sheepId != null">#{sheepId},</if>
<if test="datetime != null">#{datetime},</if>
<if test="sheepType != null">#{sheepType},</if>
<if test="gender != null">#{gender},</if>
<if test="parity != null">#{parity},</if>
<if test="diseasePid != null">#{diseasePid},</if>
<if test="diseaseId != null">#{diseaseId},</if>
<if test="result != null">#{result},</if>
<if test="begindate != null">#{begindate},</if>
<if test="enddate != null">#{enddate},</if>
<if test="treatDay != null">#{treatDay},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDiagnosis" parameterType="Diagnosis">
update sw_diagnosis
<trim prefix="SET" suffixOverrides=",">
<if test="treatId != null">treat_id = #{treatId},</if>
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="sheepType != null">sheep_type = #{sheepType},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="parity != null">parity = #{parity},</if>
<if test="diseasePid != null">disease_pid = #{diseasePid},</if>
<if test="diseaseId != null">disease_id = #{diseaseId},</if>
<if test="result != null">result = #{result},</if>
<if test="begindate != null">begindate = #{begindate},</if>
<if test="enddate != null">enddate = #{enddate},</if>
<if test="treatDay != null">treat_day = #{treatDay},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDiagnosisById" parameterType="Long">
delete from sw_diagnosis where id = #{id}
</delete>
<delete id="deleteDiagnosisByIds" parameterType="String">
delete from sw_diagnosis where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>