97 lines
4.7 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.jlt.csa.mapper.PickDetailMapper">
<resultMap type="PickDetail" id="PickDetailResult">
<result property="id" column="id" />
<result property="taskId" column="task_id" />
<result property="strainId" column="strain_id" />
<result property="planWeight" column="plan_weight" />
<result property="resultWeight" column="result_weight" />
<result property="isCompleted" column="is_completed" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPickDetailVo">
select id, task_id, strain_id, plan_weight, result_weight, is_completed, del_flag, create_by, create_time, update_by, update_time, remark from csa_pick_detail
</sql>
<select id="selectPickDetailList" parameterType="PickDetail" resultMap="PickDetailResult">
<include refid="selectPickDetailVo"/>
<where>
<if test="taskId != null "> and task_id = #{taskId}</if>
<if test="isCompleted != null and isCompleted != ''"> and is_completed = #{isCompleted}</if>
</where>
</select>
<select id="selectPickDetailById" parameterType="Long" resultMap="PickDetailResult">
<include refid="selectPickDetailVo"/>
where id = #{id}
</select>
<insert id="insertPickDetail" parameterType="PickDetail" useGeneratedKeys="true" keyProperty="id">
insert into csa_pick_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">task_id,</if>
<if test="strainId != null">strain_id,</if>
<if test="planWeight != null">plan_weight,</if>
<if test="resultWeight != null">result_weight,</if>
<if test="isCompleted != null and isCompleted != ''">is_completed,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
<if test="strainId != null">#{strainId},</if>
<if test="planWeight != null">#{planWeight},</if>
<if test="resultWeight != null">#{resultWeight},</if>
<if test="isCompleted != null and isCompleted != ''">#{isCompleted},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePickDetail" parameterType="PickDetail">
update csa_pick_detail
<trim prefix="SET" suffixOverrides=",">
<if test="taskId != null">task_id = #{taskId},</if>
<if test="strainId != null">strain_id = #{strainId},</if>
<if test="planWeight != null">plan_weight = #{planWeight},</if>
<if test="resultWeight != null">result_weight = #{resultWeight},</if>
<if test="isCompleted != null and isCompleted != ''">is_completed = #{isCompleted},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePickDetailById" parameterType="Long">
delete from csa_pick_detail where id = #{id}
</delete>
<delete id="deletePickDetailByIds" parameterType="String">
delete from csa_pick_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>