|
|
|
<?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"/>
|
|
|
|
</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>
|
|
|
|
|
|
|
|
<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>
|
|
|
|
</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>
|
|
|
|
</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>
|
|
|
|
</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>
|
|
|
|
</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>
|
|
|
|
</mapper>
|