79 lines
3.7 KiB
XML
Raw Normal View History

2025-07-09 14:31:05 +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.produce.mapper.ScCastrateMapper">
<resultMap type="ScCastrate" id="ScCastrateResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="sheepfold" column="sheepfold" />
<result property="comment" column="comment" />
<result property="technician" column="technician" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectScCastrateVo">
select id, sheep_id, sheepfold, comment, technician, create_by, create_time from sc_castrate
</sql>
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
<include refid="selectScCastrateVo"/>
<where>
<if test="sheepId != null and sheepId != ''"> and sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null "> and sheepfold like concat('%', #{sheepfold}, '%')</if>
<if test="technician != null and technician != ''"> and technician like concat('%', #{technician}, '%')</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
</select>
<select id="selectScCastrateById" parameterType="Long" resultMap="ScCastrateResult">
<include refid="selectScCastrateVo"/>
where id = #{id}
</select>
<insert id="insertScCastrate" parameterType="ScCastrate" useGeneratedKeys="true" keyProperty="id">
insert into sc_castrate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="sheepfold != null">sheepfold,</if>
<if test="comment != null">comment,</if>
<if test="technician != null">technician,</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="sheepfold != null">#{sheepfold},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null">#{technician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateScCastrate" parameterType="ScCastrate">
update sc_castrate
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null">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="deleteScCastrateById" parameterType="Long">
delete from sc_castrate where id = #{id}
</delete>
<delete id="deleteScCastrateByIds" parameterType="String">
delete from sc_castrate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>