113 lines
5.5 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.HealthMapper">
<resultMap type="Health" id="HealthResult">
<result property="id" column="id" />
<result property="datetime" column="datetime" />
<result property="sheepId" column="sheep_id" />
<result property="usageId" column="usage_id" />
<result property="variety" column="variety" />
<result property="sheepType" column="sheep_type" />
<result property="gender" column="gender" />
<result property="monthAge" column="month_age" />
<result property="parity" column="parity" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="technical" column="technical" />
<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="selectHealthVo">
select id, datetime, sheep_id, usage_id, variety, sheep_type, gender, month_age, parity, sheepfold_id, technical, comment, update_by, update_time, create_by, create_time from sw_health
</sql>
<select id="selectHealthList" parameterType="Health" resultMap="HealthResult">
<include refid="selectHealthVo"/>
<where>
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>
</select>
<select id="selectHealthById" parameterType="Long" resultMap="HealthResult">
<include refid="selectHealthVo"/>
where id = #{id}
</select>
<insert id="insertHealth" parameterType="Health" useGeneratedKeys="true" keyProperty="id">
insert into sw_health
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="datetime != null">datetime,</if>
<if test="sheepId != null">sheep_id,</if>
<if test="usageId != null">usage_id,</if>
<if test="variety != null">variety,</if>
<if test="sheepType != null">sheep_type,</if>
<if test="gender != null">gender,</if>
<if test="monthAge != null">month_age,</if>
<if test="parity != null">parity,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="technical != null">technical,</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="datetime != null">#{datetime},</if>
<if test="sheepId != null">#{sheepId},</if>
<if test="usageId != null">#{usageId},</if>
<if test="variety != null">#{variety},</if>
<if test="sheepType != null">#{sheepType},</if>
<if test="gender != null">#{gender},</if>
<if test="monthAge != null">#{monthAge},</if>
<if test="parity != null">#{parity},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="technical != null">#{technical},</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="updateHealth" parameterType="Health">
update sw_health
<trim prefix="SET" suffixOverrides=",">
<if test="datetime != null">datetime = #{datetime},</if>
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="usageId != null">usage_id = #{usageId},</if>
<if test="variety != null">variety = #{variety},</if>
<if test="sheepType != null">sheep_type = #{sheepType},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="monthAge != null">month_age = #{monthAge},</if>
<if test="parity != null">parity = #{parity},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="technical != null">technical = #{technical},</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="deleteHealthById" parameterType="Long">
delete from sw_health where id = #{id}
</delete>
<delete id="deleteHealthByIds" parameterType="String">
delete from sw_health where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>