92 lines
4.0 KiB
XML
Raw Normal View History

2025-07-09 14:31:05 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2025-07-15 18:40:22 +08:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2025-07-18 15:27:22 +08:00
<mapper namespace="com.zhyc.module.produce.other.mapper.ScFixHoofMapper">
2025-07-15 18:40:22 +08:00
<resultMap type="ScFixHoof" id="ScFixHoofResult">
2025-07-15 18:40:22 +08:00
<result property="id" column="id"/>
2025-07-18 12:57:42 +08:00
<result property="sheepId" column="sheep_id"/>
2025-07-15 18:40:22 +08:00
<result property="sheepfold" column="sheepfold"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
2025-07-09 14:31:05 +08:00
</resultMap>
<sql id="selectScFixHoofVo">
2025-07-15 18:40:22 +08:00
select fh.id,
2025-07-18 12:57:42 +08:00
fh.sheep_id,
2025-07-15 18:40:22 +08:00
fh.sheepfold,
2025-07-18 12:57:42 +08:00
sf.sheepfold_name as sheepfoldName,
2025-07-15 18:40:22 +08:00
fh.comment,
fh.technician,
fh.create_by,
fh.create_time
from sc_fix_hoof fh
left join da_sheepfold sf on fh.sheepfold = sf.id
2025-07-09 14:31:05 +08:00
</sql>
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
<include refid="selectScFixHoofVo"/>
2025-07-15 18:40:22 +08:00
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</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>
2025-07-09 14:31:05 +08:00
</where>
</select>
2025-07-15 18:40:22 +08:00
<select id="selectScFixHoofById" parameterType="java.lang.Integer" resultMap="ScFixHoofResult">
<include refid="selectScFixHoofVo"/>
2025-07-15 18:40:22 +08:00
where fh.id = #{id}
2025-07-09 14:31:05 +08:00
</select>
2025-07-18 12:57:42 +08:00
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
insert into sc_fix_hoof
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">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 and technician != ''">#{technician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
2025-07-09 14:31:05 +08:00
</insert>
<update id="updateScFixHoof" parameterType="ScFixHoof">
update sc_fix_hoof
2025-07-09 14:31:05 +08:00
<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 and technician != ''">technician = #{technician},</if>
2025-07-09 14:31:05 +08:00
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
2025-07-15 18:40:22 +08:00
<delete id="deleteScFixHoofById" parameterType="java.lang.Integer">
delete
from sc_fix_hoof
where id = #{id}
2025-07-09 14:31:05 +08:00
</delete>
2025-07-15 18:40:22 +08:00
<delete id="deleteScFixHoofByIds" parameterType="java.lang.Integer">
delete from sc_fix_hoof where id in
2025-07-09 14:31:05 +08:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>