You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
10 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.op.plan.mapper.ProWetMaterialPlanDetailMapper">
<resultMap type="ProWetMaterialPlanDetail" id="ProWetMaterialPlanDetailResult">
<result property="id" column="id" />
<result property="factoryCode" column="factory_code" />
<result property="wetMaterialPlanId" column="wet_material_plan_id" />
<result property="workorderId" column="workorder_id" />
<result property="atrr1" column="atrr1" />
<result property="atrr2" column="atrr2" />
<result property="atrr3" column="atrr3" />
<result property="status" column="status" />
<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="bucketId" column="bucket_id" />
<result property="bucketCode" column="bucket_code" />
<result property="materialCode" column="material_code" />
<result property="materialId" column="material_id" />
<result property="materialName" column="material_name" />
<result property="productName" column="product_name" />
<result property="shiftId" column="shift_id" />
<result property="shiftCode" column="shift_code" />
<result property="shiftDesc" column="shift_desc" />
<result property="planTime" column="plan_time" />
<result property="productName" column="product_name" />
<result property="productDate" column="product_date" />
<result property="workorderCode" column="workorder_code" />
</resultMap>
<sql id="selectProWetMaterialPlanDetailVo">
select id, factory_code, wet_material_plan_id, workorder_id, atrr1, atrr2, atrr3, status, create_by, create_time, update_by, update_time, bucket_id, bucket_code, material_code, material_id, material_name, product_name, shift_id, shift_code, shift_desc, plan_time from pro_wet_material_plan_detail
</sql>
<select id="selectProWetMaterialPlanDetailList" parameterType="ProWetMaterialPlanDetail" resultMap="ProWetMaterialPlanDetailResult">
<include refid="selectProWetMaterialPlanDetailVo"/>
<where>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="wetMaterialPlanId != null and wetMaterialPlanId != ''"> and wet_material_plan_id = #{wetMaterialPlanId}</if>
<if test="workorderId != null and workorderId != ''"> and workorder_id = #{workorderId}</if>
<if test="atrr1 != null and atrr1 != ''"> and atrr1 = #{atrr1}</if>
<if test="atrr2 != null and atrr2 != ''"> and atrr2 = #{atrr2}</if>
<if test="atrr3 != null and atrr3 != ''"> and atrr3 = #{atrr3}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="bucketId != null and bucketId != ''"> and bucket_id = #{bucketId}</if>
<if test="bucketCode != null and bucketCode != ''"> and bucket_code = #{bucketCode}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="shiftId != null "> and shift_id = #{shiftId}</if>
<if test="shiftCode != null and shiftCode != ''"> and shift_code = #{shiftCode}</if>
<if test="shiftDesc != null and shiftDesc != ''"> and shift_desc = #{shiftDesc}</if>
<if test="planTime != null and planTime != ''"> and plan_time = #{planTime}</if>
</where>
</select>
<select id="selectProWetMaterialPlanDetailById" parameterType="String" resultMap="ProWetMaterialPlanDetailResult">
<include refid="selectProWetMaterialPlanDetailVo"/>
where id = #{id}
</select>
<select id="selectProWetMaterialPlanDetailListById" parameterType="String" resultMap="ProWetMaterialPlanDetailResult">
select p.*,w.workorder_code,w.product_date
from pro_wet_material_plan_detail p join pro_order_workorder w
on w.workorder_id = p.workorder_id
where p.wet_material_plan_id = #{id}
</select>
<select id="selectProWetMaterialPlanDetailByWorkId"
resultType="com.op.plan.domain.ProWetMaterialPlanDetail">
<include refid="selectProWetMaterialPlanDetailVo"/>
where workorder_id = #{id}
</select>
<select id="selectProWetMaterialPlanDetailByOrderId"
resultType="com.op.plan.domain.ProWetMaterialPlanDetail">
<include refid="selectProWetMaterialPlanDetailVo"/>
where wet_material_plan_id = #{id} and status = 'Y'
</select>
<select id="selectDetailListById" resultType="com.op.plan.domain.ProWetMaterialPlanDetail">
where wet_material_plan_id = #{id} and status = 'Y'
</select>
<insert id="insertProWetMaterialPlanDetail" parameterType="ProWetMaterialPlanDetail">
insert into pro_wet_material_plan_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="wetMaterialPlanId != null">wet_material_plan_id,</if>
<if test="workorderId != null">workorder_id,</if>
<if test="atrr1 != null">atrr1,</if>
<if test="atrr2 != null">atrr2,</if>
<if test="atrr3 != null">atrr3,</if>
<if test="status != null">status,</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="bucketId != null">bucket_id,</if>
<if test="bucketCode != null">bucket_code,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialId != null">material_id,</if>
<if test="materialName != null">material_name,</if>
<if test="productName != null">product_name,</if>
<if test="shiftId != null">shift_id,</if>
<if test="shiftCode != null">shift_code,</if>
<if test="shiftDesc != null">shift_desc,</if>
<if test="planTime != null">plan_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="wetMaterialPlanId != null">#{wetMaterialPlanId},</if>
<if test="workorderId != null">#{workorderId},</if>
<if test="atrr1 != null">#{atrr1},</if>
<if test="atrr2 != null">#{atrr2},</if>
<if test="atrr3 != null">#{atrr3},</if>
<if test="status != null">#{status},</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="bucketId != null">#{bucketId},</if>
<if test="bucketCode != null">#{bucketCode},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialName != null">#{materialName},</if>
<if test="productName != null">#{productName},</if>
<if test="shiftId != null">#{shiftId},</if>
<if test="shiftCode != null">#{shiftCode},</if>
<if test="shiftDesc != null">#{shiftDesc},</if>
<if test="planTime != null">#{planTime},</if>
</trim>
</insert>
<update id="updateProWetMaterialPlanDetail" parameterType="ProWetMaterialPlanDetail">
update pro_wet_material_plan_detail
<trim prefix="SET" suffixOverrides=",">
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="wetMaterialPlanId != null">wet_material_plan_id = #{wetMaterialPlanId},</if>
<if test="workorderId != null">workorder_id = #{workorderId},</if>
<if test="atrr1 != null">atrr1 = #{atrr1},</if>
<if test="atrr2 != null">atrr2 = #{atrr2},</if>
<if test="atrr3 != null">atrr3 = #{atrr3},</if>
<if test="status != null">status = #{status},</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="bucketId != null">bucket_id = #{bucketId},</if>
<if test="bucketCode != null">bucket_code = #{bucketCode},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="shiftId != null">shift_id = #{shiftId},</if>
<if test="shiftCode != null">shift_code = #{shiftCode},</if>
<if test="shiftDesc != null">shift_desc = #{shiftDesc},</if>
<if test="planTime != null">plan_time = #{planTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProWetMaterialPlanDetailById" parameterType="String">
delete from pro_wet_material_plan_detail where id = #{id}
</delete>
<delete id="deleteProWetMaterialPlanDetailByIds" parameterType="String">
delete from pro_wet_material_plan_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>