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.
259 lines
14 KiB
XML
259 lines
14 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.os.mes.prod.mapper.ProdPlanInfoMapper">
|
|
|
|
<resultMap type="ProdPlanInfo" id="ProdPlanInfoResult">
|
|
<result property="objId" column="obj_id"/>
|
|
<result property="planCode" column="plan_code"/>
|
|
<result property="orderCode" column="order_code"/>
|
|
<result property="materialCode" column="material_code"/>
|
|
<result property="materialName" column="material_name"/>
|
|
<result property="stationCode" column="station_code"/>
|
|
<result property="deviceCode" column="device_code"/>
|
|
<result property="teamCode" column="team_code"/>
|
|
<result property="planAmount" column="plan_amount"/>
|
|
<result property="completeAmount" column="complete_amount"/>
|
|
<result property="beginTime" column="begin_time"/>
|
|
<result property="endTime" column="end_time"/>
|
|
<result property="compFlag" column="comp_flag"/>
|
|
<result property="createdBy" column="created_by"/>
|
|
<result property="createdTime" column="created_time"/>
|
|
<result property="updatedBy" column="updated_by"/>
|
|
<result property="updatedTime" column="updated_time"/>
|
|
<result property="planBeginTime" column="plan_begin_time"/>
|
|
<result property="planEndTime" column="plan_end_time"/>
|
|
<result property="stationName" column="station_name"/>
|
|
<result property="teamName" column="team_name"/>
|
|
<result property="planStatus" column="plan_status"/>
|
|
<result property="classes" column="classes"/>
|
|
<result property="processCode" column="process_code"/>
|
|
<collection property="prodPlanDetailList" javaType="java.util.List" resultMap="ProdPlanDetailResult"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="ProdPlanDetailResult" type="ProdPlanDetail">
|
|
<result property="objId" column="d_obj_id"/>
|
|
<result property="planCode" column="d_plan_code"/>
|
|
<result property="materialCode" column="d_material_code"/>
|
|
<result property="planAmount" column="d_plan_amount"/>
|
|
<result property="completeAmount" column="d_complete_amount"/>
|
|
<result property="beginTime" column="d_begin_time"/>
|
|
<result property="endTime" column="d_end_time"/>
|
|
<result property="currentStaffId" column="d_current_staff_id"/>
|
|
<result property="nextStaffId" column="d_next_staff_id"/>
|
|
<result property="endFlag" column="d_end_flag"/>
|
|
<result property="classes" column="d_classes"/>
|
|
<result property="processCode" column="d_process_code"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectProdPlanInfoVo">
|
|
select ppi.obj_id,
|
|
ppi.plan_code,
|
|
ppi.order_code,
|
|
ppi.material_code,
|
|
ppi.material_name,
|
|
ppi.station_code,
|
|
bpl.product_line_name station_name,
|
|
ppi.device_code,
|
|
ppi.team_code,
|
|
btm.team_name,
|
|
ppi.plan_amount,
|
|
ppi.complete_amount,
|
|
ppi.begin_time,
|
|
ppi.end_time,
|
|
ppi.comp_flag,
|
|
ppi.created_by,
|
|
ppi.created_time,
|
|
ppi.updated_by,
|
|
ppi.updated_time,
|
|
ppi.plan_begin_time,
|
|
ppi.plan_end_time
|
|
from prod_plan_info ppi
|
|
left join base_product_line bpl on bpl.product_line_code = ppi.station_code
|
|
left join base_team_members btm on btm.team_code = ppi.team_code
|
|
</sql>
|
|
|
|
<sql id="selectProdPlanDetailVo">
|
|
select ppi.obj_id,
|
|
ppi.plan_code,
|
|
ppi.order_code,
|
|
ppi.material_code,
|
|
ppi.material_name,
|
|
ppi.station_code,
|
|
bpl.product_line_name station_name,
|
|
ppi.device_code,
|
|
ppi.team_code,
|
|
btm.team_name,
|
|
ppi.plan_amount,
|
|
ppi.complete_amount,
|
|
ppi.begin_time,
|
|
ppi.end_time,
|
|
ppi.comp_flag,
|
|
ppi.created_by,
|
|
ppi.created_time,
|
|
ppi.updated_by,
|
|
ppi.updated_time,
|
|
ppi.plan_begin_time,
|
|
ppi.plan_end_time,
|
|
ppi.plan_status,
|
|
ppi.classes,
|
|
ppi.process_code,
|
|
ppd.obj_id d_obj_id,
|
|
ppd.plan_code d_plan_code,
|
|
ppd.material_code d_material_code,
|
|
ppd.plan_amount d_plan_amount,
|
|
ppd.complete_amount d_complete_amount,
|
|
ppd.begin_time d_begin_time,
|
|
ppd.end_time d_end_time,
|
|
ppd.current_staff_id d_current_staff_id,
|
|
ppd.next_staff_id d_next_staff_id,
|
|
ppd.end_flag d_end_flag,
|
|
ppd.classes d_classes,
|
|
ppd.process_code d_process_code
|
|
from prod_plan_info ppi
|
|
left join base_product_line bpl on bpl.product_line_code = ppi.station_code
|
|
left join base_team_members btm on btm.team_code = ppi.team_code
|
|
left join prod_plan_detail ppd on ppd.plan_code = ppi.plan_code
|
|
</sql>
|
|
|
|
<select id="selectProdPlanInfoList" parameterType="ProdPlanInfo" resultMap="ProdPlanInfoResult">
|
|
<include refid="selectProdPlanInfoVo"/>
|
|
<where>
|
|
<if test="planCode != null and planCode != ''">and ppi.plan_code = #{planCode}</if>
|
|
<if test="orderCode != null and orderCode != ''">and ppi.order_code = #{orderCode}</if>
|
|
<if test="materialCode != null and materialCode != ''">and ppi.material_code = #{materialCode}</if>
|
|
<if test="materialName != null and materialName != ''">and ppi.material_name like concat('%',
|
|
#{materialName}, '%')
|
|
</if>
|
|
<if test="stationCode != null and stationCode != ''">and ppi.station_code = #{stationCode}</if>
|
|
<if test="deviceCode != null and deviceCode != ''">and ppi.device_code = #{deviceCode}</if>
|
|
<if test="teamCode != null and teamCode != ''">and ppi.team_code = #{teamCode}</if>
|
|
<if test="planAmount != null ">and ppi.plan_amount = #{planAmount}</if>
|
|
<if test="completeAmount != null ">and ppi.complete_amount = #{completeAmount}</if>
|
|
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
|
|
and ppi.begin_time between #{params.beginBeginTime} and #{params.endBeginTime}
|
|
</if>
|
|
<if test="endTime != null ">and ppi.end_time = #{endTime}</if>
|
|
<if test="compFlag != null and compFlag != ''">and ppi.comp_flag = #{compFlag}</if>
|
|
<if test="createdBy != null and createdBy != ''">and ppi.created_by = #{createdBy}</if>
|
|
<if test="createdTime != null ">and ppi.created_time = #{createdTime}</if>
|
|
<if test="updatedBy != null and updatedBy != ''">and ppi.updated_by = #{updatedBy}</if>
|
|
<if test="updatedTime != null ">and ppi.updated_time = #{updatedTime}</if>
|
|
<if test="planBeginTime != null ">and ppi.plan_begin_time = #{planBeginTime}</if>
|
|
<if test="planEndTime != null ">and ppi.plan_end_time = #{planEndTime}</if>
|
|
<if test="planStatus != null and planStatus != ''">and plan_status = #{planStatus}</if>
|
|
<if test="classes != null and classes != ''">and classes = #{classes}</if>
|
|
<if test="processCode != null and processCode != ''">and process_code = #{processCode}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectProdPlanInfoByObjId" parameterType="Long" resultMap="ProdPlanInfoResult">
|
|
<include refid="selectProdPlanInfoVo"/>
|
|
where ppi.obj_id = #{objId}
|
|
</select>
|
|
|
|
<insert id="insertProdPlanInfo" parameterType="ProdPlanInfo" useGeneratedKeys="true" keyProperty="objId">
|
|
insert into prod_plan_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="planCode != null and planCode != ''">plan_code,</if>
|
|
<if test="orderCode != null">order_code,</if>
|
|
<if test="materialCode != null">material_code,</if>
|
|
<if test="materialName != null">material_name,</if>
|
|
<if test="stationCode != null">station_code,</if>
|
|
<if test="deviceCode != null">device_code,</if>
|
|
<if test="teamCode != null">team_code,</if>
|
|
<if test="planAmount != null">plan_amount,</if>
|
|
<if test="completeAmount != null">complete_amount,</if>
|
|
<if test="beginTime != null">begin_time,</if>
|
|
<if test="endTime != null">end_time,</if>
|
|
<if test="compFlag != null">comp_flag,</if>
|
|
<if test="createdBy != null">created_by,</if>
|
|
<if test="createdTime != null">created_time,</if>
|
|
<if test="updatedBy != null">updated_by,</if>
|
|
<if test="updatedTime != null">updated_time,</if>
|
|
<if test="planBeginTime != null">plan_begin_time,</if>
|
|
<if test="planEndTime != null">plan_end_time,</if>
|
|
<if test="planStatus != null">plan_status,</if>
|
|
<if test="classes != null">classes,</if>
|
|
<if test="processCode != null">process_code,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="planCode != null and planCode != ''">#{planCode},</if>
|
|
<if test="orderCode != null">#{orderCode},</if>
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
<if test="materialName != null">#{materialName},</if>
|
|
<if test="stationCode != null">#{stationCode},</if>
|
|
<if test="deviceCode != null">#{deviceCode},</if>
|
|
<if test="teamCode != null">#{teamCode},</if>
|
|
<if test="planAmount != null">#{planAmount},</if>
|
|
<if test="completeAmount != null">#{completeAmount},</if>
|
|
<if test="beginTime != null">#{beginTime},</if>
|
|
<if test="endTime != null">#{endTime},</if>
|
|
<if test="compFlag != null">#{compFlag},</if>
|
|
<if test="createdBy != null">#{createdBy},</if>
|
|
<if test="createdTime != null">#{createdTime},</if>
|
|
<if test="updatedBy != null">#{updatedBy},</if>
|
|
<if test="updatedTime != null">#{updatedTime},</if>
|
|
<if test="planBeginTime != null">#{planBeginTime},</if>
|
|
<if test="planEndTime != null">#{planEndTime},</if>
|
|
<if test="planStatus != null">#{planStatus},</if>
|
|
<if test="classes != null">#{classes},</if>
|
|
<if test="processCode != null">#{processCode},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateProdPlanInfo" parameterType="ProdPlanInfo">
|
|
update prod_plan_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
|
|
<if test="orderCode != null">order_code = #{orderCode},</if>
|
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
|
<if test="materialName != null">material_name = #{materialName},</if>
|
|
<if test="stationCode != null">station_code = #{stationCode},</if>
|
|
<if test="deviceCode != null">device_code = #{deviceCode},</if>
|
|
<if test="teamCode != null">team_code = #{teamCode},</if>
|
|
<if test="planAmount != null">plan_amount = #{planAmount},</if>
|
|
<if test="completeAmount != null">complete_amount = #{completeAmount},</if>
|
|
<if test="beginTime != null">begin_time = #{beginTime},</if>
|
|
<if test="endTime != null">end_time = #{endTime},</if>
|
|
<if test="compFlag != null">comp_flag = #{compFlag},</if>
|
|
<if test="createdBy != null">created_by = #{createdBy},</if>
|
|
<if test="createdTime != null">created_time = #{createdTime},</if>
|
|
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
|
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
|
<if test="planBeginTime != null">plan_begin_time = #{planBeginTime},</if>
|
|
<if test="planEndTime != null">plan_end_time = #{planEndTime},</if>
|
|
<if test="planStatus != null">plan_status = #{planStatus},</if>
|
|
<if test="classes != null">classes = #{classes},</if>
|
|
<if test="processCode != null">process_code = #{processCode},</if>
|
|
</trim>
|
|
where obj_id = #{objId}
|
|
</update>
|
|
|
|
<delete id="deleteProdPlanInfoByObjId" parameterType="Long">
|
|
delete
|
|
from prod_plan_info
|
|
where obj_id = #{objId}
|
|
</delete>
|
|
|
|
<delete id="deleteProdPlanInfoByObjIds" parameterType="String">
|
|
delete from prod_plan_info where obj_id in
|
|
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
|
#{objId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectProdPlanAndDetailList" parameterType="ProdPlanInfo" resultMap="ProdPlanInfoResult">
|
|
<include refid="selectProdPlanDetailVo"/>
|
|
<where>
|
|
<if test="planCode != null and planCode != ''">and ppi.plan_code = #{planCode}</if>
|
|
<if test="orderCode != null and orderCode != ''">and ppi.order_code = #{orderCode}</if>
|
|
<if test="processCode != null and processCode != ''">and ppi.process_code = #{processCode}</if>
|
|
<if test="params.beginOrderDate != null and params.beginOrderDate != '' and params.endOrderDate != null and params.endOrderDate != ''">
|
|
and LEFT(CONVERT(VARCHAR(17), ppd.begin_time, 120), 10) between #{params.beginOrderDate} and #{params.endOrderDate}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
</mapper> |