100 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">
<mapper namespace="com.zhyc.module.produce.other.fixHoof.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"/>
<result property="sheepId" column="sheep_id"/>
<result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/>
2025-07-15 18:40:22 +08:00
<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,
fh.sheep_id,
fh.sheepfold,
sf.sheepfold_name as sheepfoldName,
fh.variety_id,
bv.variety as varietyName,
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
left join bas_sheep_variety bv on fh.variety_id = bv.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="varietyId != null">
and fh.variety_id = #{varietyId}
</if>
2025-07-15 18:40:22 +08:00
<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>
<insert id="insertScFixHoof" parameterType="ScFixHoof"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_fix_hoof
(sheep_id,
sheepfold,
variety_id,
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if>
create_by,
create_time)
VALUES
(#{sheepId},
#{sheepfold},
<if test="varietyId != null">#{varietyId},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if>
#{createBy},
#{createTime})
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="varietyId != null">variety_id=#{varietyId},</if>
2025-07-09 14:31:05 +08:00
<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>