161 lines
6.9 KiB
XML
161 lines
6.9 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.klp.mapper.DrMillProductionPlanMapper">
|
|
|
|
<resultMap id="BaseRM" type="com.klp.domain.DrMillProductionPlan">
|
|
<id property="planId" column="plan_id"/>
|
|
<result property="planNo" column="plan_no"/>
|
|
<result property="planStatus" column="plan_status"/>
|
|
<result property="prodStatus" column="prod_status"/>
|
|
<result property="sortNo" column="sort_no"/>
|
|
<result property="inMatNo" column="in_mat_no"/>
|
|
<result property="alloyNo" column="sg_sign"/>
|
|
<result property="inMatThick" column="in_mat_thick"/>
|
|
<result property="inMatWidth" column="in_mat_width"/>
|
|
<result property="inMatWeight" column="in_mat_wt"/>
|
|
<result property="inMatLength" column="in_mat_len"/>
|
|
<result property="inMatId" column="in_mat_in_dia"/>
|
|
<result property="inMatOd" column="in_mat_dia"/>
|
|
<result property="outThick" column="out_thick"/>
|
|
<result property="passCount" column="pass_count"/>
|
|
<result property="recipeId" column="recipe_id"/>
|
|
<result property="recipeNo" column="recipe_no"/>
|
|
<result property="versionId" column="version_id"/>
|
|
<result property="enterCoilNo" column="enter_coil_no"/>
|
|
<result property="currentCoilNo" column="current_coil_no"/>
|
|
<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="cols">
|
|
plan_id, plan_no, plan_status, prod_status, sort_no,
|
|
in_mat_no, sg_sign, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len,
|
|
in_mat_in_dia, in_mat_dia, out_thick, pass_count, recipe_id, recipe_no,
|
|
version_id, enter_coil_no, current_coil_no,
|
|
del_flag, create_by, create_time, update_by, update_time, remark
|
|
</sql>
|
|
|
|
<select id="selectList" resultMap="BaseRM">
|
|
SELECT <include refid="cols"/>
|
|
FROM mill_production_plan
|
|
WHERE del_flag = '0'
|
|
<if test="inMatNo != null and inMatNo != ''">
|
|
AND (in_mat_no LIKE CONCAT('%', #{inMatNo}, '%')
|
|
OR enter_coil_no LIKE CONCAT('%', #{inMatNo}, '%')
|
|
OR current_coil_no LIKE CONCAT('%', #{inMatNo}, '%'))
|
|
</if>
|
|
<if test="planStatus != null and planStatus != ''">
|
|
AND plan_status = #{planStatus}
|
|
</if>
|
|
<if test="prodStatus != null and prodStatus != ''">
|
|
AND prod_status = #{prodStatus}
|
|
</if>
|
|
ORDER BY sort_no ASC, plan_id ASC
|
|
</select>
|
|
|
|
<!-- 实绩分页:按创建时间倒序,支持卷号/状态/时间范围过滤 -->
|
|
<sql id="actualWhere">
|
|
WHERE del_flag = '0'
|
|
<if test="inMatNo != null and inMatNo != ''">
|
|
AND (in_mat_no LIKE CONCAT('%',#{inMatNo},'%')
|
|
OR enter_coil_no LIKE CONCAT('%',#{inMatNo},'%')
|
|
OR current_coil_no LIKE CONCAT('%',#{inMatNo},'%'))
|
|
</if>
|
|
<if test="planStatus != null and planStatus != ''">
|
|
AND plan_status = #{planStatus}
|
|
</if>
|
|
<if test="createStartTime != null and createStartTime != ''">
|
|
AND create_time >= #{createStartTime}
|
|
</if>
|
|
<if test="createEndTime != null and createEndTime != ''">
|
|
AND create_time <= #{createEndTime}
|
|
</if>
|
|
</sql>
|
|
|
|
<select id="selectPageList" resultMap="BaseRM">
|
|
SELECT <include refid="cols"/>
|
|
FROM mill_production_plan
|
|
<include refid="actualWhere"/>
|
|
ORDER BY create_time DESC
|
|
<if test="pageSize != null and pageNum != null">
|
|
LIMIT #{pageSize} OFFSET #{offset}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="countPageList" resultType="long">
|
|
SELECT COUNT(*) FROM mill_production_plan
|
|
<include refid="actualWhere"/>
|
|
</select>
|
|
|
|
<select id="selectById" resultMap="BaseRM">
|
|
SELECT <include refid="cols"/> FROM mill_production_plan
|
|
WHERE plan_id = #{planId} AND del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectByPlanNo" resultMap="BaseRM">
|
|
SELECT <include refid="cols"/> FROM mill_production_plan
|
|
WHERE plan_no = #{planNo} AND del_flag = '0'
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<select id="countByStatus" resultType="int">
|
|
SELECT COUNT(*) FROM mill_production_plan WHERE del_flag = '0' AND plan_status = #{status}
|
|
</select>
|
|
|
|
<insert id="insert" useGeneratedKeys="true" keyProperty="planId">
|
|
INSERT INTO mill_production_plan (
|
|
plan_no, plan_status, prod_status, sort_no,
|
|
in_mat_no, sg_sign, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len,
|
|
in_mat_in_dia, in_mat_dia, out_thick, pass_count, recipe_id, recipe_no,
|
|
version_id, enter_coil_no, current_coil_no,
|
|
create_by, create_time, update_by, update_time, remark, del_flag
|
|
) VALUES (
|
|
#{planNo}, IFNULL(#{planStatus},'0'), IFNULL(#{prodStatus},'Idle'), IFNULL(#{sortNo},0),
|
|
#{inMatNo}, #{alloyNo}, #{inMatThick}, #{inMatWidth}, #{inMatWeight}, #{inMatLength},
|
|
#{inMatId}, #{inMatOd}, #{outThick}, IFNULL(#{passCount},0), #{recipeId}, #{recipeNo},
|
|
#{versionId}, #{enterCoilNo}, #{currentCoilNo},
|
|
#{createBy}, NOW(), #{updateBy}, NOW(), #{remark}, '0'
|
|
)
|
|
</insert>
|
|
|
|
<update id="update">
|
|
UPDATE mill_production_plan
|
|
SET plan_status = #{planStatus},
|
|
prod_status = #{prodStatus},
|
|
in_mat_no = #{inMatNo},
|
|
sg_sign = #{alloyNo},
|
|
in_mat_thick = #{inMatThick},
|
|
in_mat_width = #{inMatWidth},
|
|
in_mat_wt = #{inMatWeight},
|
|
in_mat_len = #{inMatLength},
|
|
in_mat_in_dia = #{inMatId},
|
|
in_mat_dia = #{inMatOd},
|
|
out_thick = #{outThick},
|
|
pass_count = #{passCount},
|
|
recipe_id = #{recipeId},
|
|
recipe_no = #{recipeNo},
|
|
version_id = #{versionId},
|
|
enter_coil_no = #{enterCoilNo},
|
|
current_coil_no = #{currentCoilNo},
|
|
update_by = #{updateBy},
|
|
update_time = NOW(),
|
|
remark = #{remark}
|
|
WHERE plan_id = #{planId}
|
|
</update>
|
|
|
|
<update id="deleteById">
|
|
UPDATE mill_production_plan SET del_flag = '2', update_time = NOW()
|
|
WHERE plan_id = #{planId}
|
|
</update>
|
|
|
|
<update id="updateSortNo">
|
|
UPDATE mill_production_plan SET sort_no = #{sortNo} WHERE plan_id = #{planId}
|
|
</update>
|
|
|
|
</mapper>
|