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.

166 lines
8.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.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"/>
</resultMap>
<sql id="selectProdPlanInfoVo">
select obj_id,
plan_code,
order_code,
material_code,
material_name,
station_code,
device_code,
team_code,
plan_amount,
complete_amount,
begin_time,
end_time,
comp_flag,
created_by,
created_time,
updated_by,
updated_time,
plan_begin_time,
plan_end_time
from prod_plan_info
</sql>
<select id="selectProdPlanInfoList" parameterType="ProdPlanInfo" resultMap="ProdPlanInfoResult">
<include refid="selectProdPlanInfoVo"/>
<where>
<if test="planCode != null and planCode != ''">and plan_code = #{planCode}</if>
<if test="orderCode != null and orderCode != ''">and order_code = #{orderCode}</if>
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
'%')
</if>
<if test="stationCode != null and stationCode != ''">and station_code = #{stationCode}</if>
<if test="deviceCode != null and deviceCode != ''">and device_code = #{deviceCode}</if>
<if test="teamCode != null and teamCode != ''">and team_code = #{teamCode}</if>
<if test="planAmount != null ">and plan_amount = #{planAmount}</if>
<if test="completeAmount != null ">and complete_amount = #{completeAmount}</if>
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
and begin_time between #{params.beginBeginTime} and #{params.endBeginTime}
</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
<if test="compFlag != null and compFlag != ''">and comp_flag = #{compFlag}</if>
<if test="createdBy != null and createdBy != ''">and created_by = #{createdBy}</if>
<if test="createdTime != null ">and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''">and updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and updated_time = #{updatedTime}</if>
<if test="planBeginTime != null ">and plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null ">and plan_end_time = #{planEndTime}</if>
</where>
</select>
<select id="selectProdPlanInfoByObjId" parameterType="Long" resultMap="ProdPlanInfoResult">
<include refid="selectProdPlanInfoVo"/>
where 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>