139 lines
6.4 KiB
XML

<?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.bodyManage.mapper.ScBodyMeasureMapper">
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure" id="ScBodyMeasureResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="height" column="height"/>
<result property="bust" column="bust"/>
<result property="bodyLength" column="body_length"/>
<result property="pipeLength" column="pipe_length"/>
<result property="chestDepth" column="chest_depth"/>
<result property="hipHeight" column="hip_height"/>
<result property="rumpWidth" column="rump_width"/>
<result property="rumpHeignt" column="rump_heignt"/>
<result property="hipWidth" column="hip_width"/>
<result property="hipCrossHeight" column="hip_cross_height"/>
<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="selectScBodyMeasureVo">
select sm.id,
sm.sheep_id,
bs.manage_tags,
sm.height,
sm.bust,
sm.body_length,
sm.pipe_length,
sm.chest_depth,
sm.hip_height,
sm.rump_width,
sm.rump_heignt,
sm.hip_width,
sm.hip_cross_height,
sm.comment,
sm.technician,
sm.create_by,
sm.create_time
from sc_body_measure sm
left join bas_sheep bs on sm.sheep_id = bs.id
</sql>
<select id="selectScBodyMeasureList" parameterType="ScBodyMeasure" resultMap="ScBodyMeasureResult">
<include refid="selectScBodyMeasureVo"/>
<where>
<if test="sheepId != null ">and sm.sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="params.beginCreateTime != null and params.endCreateTime != null">
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">
<include refid="selectScBodyMeasureVo"/>
where sm.id = #{id}
</select>
<insert id="insertScBodyMeasure" parameterType="ScBodyMeasure" useGeneratedKeys="true" keyProperty="id">
insert into sc_body_measure
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="height != null">height,</if>
<if test="bust != null">bust,</if>
<if test="bodyLength != null">body_length,</if>
<if test="pipeLength != null">pipe_length,</if>
<if test="chestDepth != null">chest_depth,</if>
<if test="hipHeight != null">hip_height,</if>
<if test="rumpWidth != null">rump_width,</if>
<if test="rumpHeignt != null">rump_heignt,</if>
<if test="hipWidth != null">hip_width,</if>
<if test="hipCrossHeight != null">hip_cross_height,</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="height != null">#{height},</if>
<if test="bust != null">#{bust},</if>
<if test="bodyLength != null">#{bodyLength},</if>
<if test="pipeLength != null">#{pipeLength},</if>
<if test="chestDepth != null">#{chestDepth},</if>
<if test="hipHeight != null">#{hipHeight},</if>
<if test="rumpWidth != null">#{rumpWidth},</if>
<if test="rumpHeignt != null">#{rumpHeignt},</if>
<if test="hipWidth != null">#{hipWidth},</if>
<if test="hipCrossHeight != null">#{hipCrossHeight},</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="updateScBodyMeasure" parameterType="ScBodyMeasure">
update sc_body_measure
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="height != null">height = #{height},</if>
<if test="bust != null">bust = #{bust},</if>
<if test="bodyLength != null">body_length = #{bodyLength},</if>
<if test="pipeLength != null">pipe_length = #{pipeLength},</if>
<if test="chestDepth != null">chest_depth = #{chestDepth},</if>
<if test="hipHeight != null">hip_height = #{hipHeight},</if>
<if test="rumpWidth != null">rump_width = #{rumpWidth},</if>
<if test="rumpHeignt != null">rump_heignt = #{rumpHeignt},</if>
<if test="hipWidth != null">hip_width = #{hipWidth},</if>
<if test="hipCrossHeight != null">hip_cross_height = #{hipCrossHeight},</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="deleteScBodyMeasureById" parameterType="Long">
delete
from sc_body_measure
where id = #{id}
</delete>
<delete id="deleteScBodyMeasureByIds" parameterType="String">
delete from sc_body_measure where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>