Files
KWMS_interface/src/main/resources/mapper/InPtsProductionDetailMapper.xml
2026-01-20 15:41:23 +08:00

224 lines
13 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.project.joggle.mapper.InPtsProductionDetailMapper">
<resultMap id="BaseResultMap" type="com.project.joggle.domain.InPtsProductionDetail">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="action" column="action" jdbcType="INTEGER"/>
<result property="parentTraceCode" column="parent_trace_code" jdbcType="VARCHAR"/>
<result property="parentAppendCode" column="parent_append_code" jdbcType="VARCHAR"/>
<result property="productNo" column="product_no" jdbcType="VARCHAR"/>
<result property="productName" column="product_name" jdbcType="VARCHAR"/>
<result property="productSpec" column="product_spec" jdbcType="VARCHAR"/>
<result property="packagingRatioName" column="packaging_ratio_name" jdbcType="VARCHAR"/>
<result property="productionDate" column="production_date" jdbcType="VARCHAR"/>
<result property="productionBatch" column="production_batch" jdbcType="VARCHAR"/>
<result property="expirationDate" column="expiration_date" jdbcType="VARCHAR"/>
<result property="sourceNo" column="source_no" jdbcType="VARCHAR"/>
<result property="taskNo" column="task_no" jdbcType="VARCHAR"/>
<result property="lineNo" column="line_no" jdbcType="VARCHAR"/>
<result property="teamGroupNo" column="team_group_no" jdbcType="VARCHAR"/>
<result property="machineNo" column="machine_no" jdbcType="VARCHAR"/>
<result property="fuzzy" column="fuzzy" jdbcType="INTEGER"/>
<result property="curCode" column="cur_code" jdbcType="VARCHAR"/>
<result property="scanNo" column="scan_no" jdbcType="INTEGER"/>
<result property="layerNo" column="layer_no" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="inType" column="in_type" jdbcType="VARCHAR"/>
<result property="errorcount" column="errorcount" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, action, parent_trace_code,parent_append_code,
product_no, product_name, product_spec,
packaging_ratio_name, production_date, production_batch,
expiration_date, source_no, task_no,
line_no, team_group_no, machine_no,
fuzzy, cur_code, scan_no,
layer_no, status,in_type,errorcount
</sql>
<select id="selectInptsProductionDetailList" parameterType="InPtsProductionDetail" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM in_pts_production_detail
<where>
<if test="id != null and id != ''">AND id = #{id}</if>
<if test="action != null and action != ''">AND action = #{action}</if>
<if test="parentTraceCode != null and parentTraceCode != ''">AND parent_trace_code = #{parentTraceCode}</if>
<if test="parentAppendCode != null and parentAppendCode != ''">AND parent_append_code = #{parentAppendCode}</if>
<if test="productNo != null and productNo != ''">AND product_no = #{productNo}</if>
<if test="productName != null and productName != ''">AND product_name = #{productName}</if>
<if test="productSpec != null and productSpec != ''">AND product_spec = #{productSpec}</if>
<if test="packagingRatioName != null and packagingRatioName != ''">AND packaging_ratio_name = #{packagingRatioName}</if>
<if test="productionDate != null">AND production_date = #{productionDate}</if>
<if test="productionBatch != null and productionBatch != ''">AND production_batch = #{productionBatch}</if>
<if test="expirationDate != null">AND expiration_date = #{expirationDate}</if>
<if test="sourceNo != null and sourceNo != ''">AND source_no = #{sourceNo}</if>
<if test="taskNo != null and taskNo != ''">AND task_no = #{taskNo}</if>
<if test="lineNo != null and lineNo != ''">AND line_no = #{lineNo}</if>
<if test="teamGroupNo != null and teamGroupNo != ''">AND team_group_no = #{teamGroupNo}</if>
<if test="machineNo != null and machineNo != ''">AND machine_no = #{machineNo}</if>
<if test="fuzzy != null">AND fuzzy = #{fuzzy}</if>
<if test="status != null and status != ''">AND status = #{status}</if>
<if test="inType != null and inType != ''">AND in_type = #{inType}</if>
</where>
</select>
<insert id="insertInPtsProductionDetail" parameterType="com.project.joggle.domain.InPtsProductionDetail">
INSERT INTO in_pts_production_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="action != null "> action,</if>
<if test="parentTraceCode != null and parentTraceCode != ''">parent_trace_code,</if>
<if test="parentAppendCode != null and parentAppendCode != ''">parent_append_code,</if>
<if test="productNo != null and productNo != ''">product_no,</if>
<if test="productName != null and productName != ''">product_name,</if>
<if test="productSpec != null and productSpec != ''">product_spec,</if>
<if test="packagingRatioName != null and packagingRatioName != ''">packaging_ratio_name,</if>
<if test="productionDate != null">production_date,</if>
<if test="productionBatch != null and productionBatch != ''">production_batch,</if>
<if test="expirationDate != null">expiration_date,</if>
<if test="sourceNo != null and sourceNo != ''">source_no,</if>
<if test="taskNo != null and taskNo != ''">task_no,</if>
<if test="lineNo != null and lineNo != ''">line_no,</if>
<if test="teamGroupNo != null and teamGroupNo != ''">team_group_no,</if>
<if test="machineNo != null and machineNo != ''">machine_no,</if>
<if test="fuzzy != null">fuzzy,</if>
<if test="curCode != null and curCode != ''">cur_code,</if>
<if test="scanNo != null">scan_no,</if>
<if test="layerNo != null">layer_no,</if>
<if test="status != null and status != ''">status,</if>
<if test="inType != null and inType != ''">in_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="action != null ">#{action},</if>
<if test="parentTraceCode != null and parentTraceCode != ''">#{parentTraceCode},</if>
<if test="parentAppendCode != null and parentAppendCode != ''">#{parentAppendCode},</if>
<if test="productNo != null and productNo != ''">#{productNo},</if>
<if test="productName != null and productName != ''">#{productName},</if>
<if test="productSpec != null and productSpec != ''">#{productSpec},</if>
<if test="packagingRatioName != null and packagingRatioName != ''">#{packagingRatioName},</if>
<if test="productionDate != null">#{productionDate},</if>
<if test="productionBatch != null and productionBatch != ''">#{productionBatch},</if>
<if test="expirationDate != null">#{expirationDate},</if>
<if test="sourceNo != null and sourceNo != ''">#{sourceNo},</if>
<if test="taskNo != null and taskNo != ''">#{taskNo},</if>
<if test="lineNo != null and lineNo != ''">#{lineNo},</if>
<if test="teamGroupNo != null and teamGroupNo != ''">#{teamGroupNo},</if>
<if test="machineNo != null and machineNo != ''">#{machineNo},</if>
<if test="fuzzy != null">#{fuzzy},</if>
<if test="curCode != null and curCode != ''">#{curCode},</if>
<if test="scanNo != null">#{scanNo},</if>
<if test="layerNo != null">#{layerNo},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="inType != null and inType != ''">#{inType},</if>
</trim>
</insert>
<update id="updateInPtsProductionDetail" parameterType="com.project.joggle.domain.InPtsProductionDetail">
UPDATE in_pts_production_detail
<set>
<if test="action != null and action != ''">action = #{action},</if>
<if test="parentTraceCode != null and parentTraceCode != ''">parent_trace_code = #{parentTraceCode},</if>
<if test="parentAppendCode != null and parentAppendCode != ''">parent_append_code = #{parentAppendCode},</if>
<if test="productNo != null and productNo != ''">product_no = #{productNo},</if>
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="productSpec != null and productSpec != ''">product_spec = #{productSpec},</if>
<if test="packagingRatioName != null and packagingRatioName != ''">packaging_ratio_name = #{packagingRatioName},</if>
<if test="productionDate != null">production_date = #{productionDate},</if>
<if test="productionBatch != null and productionBatch != ''">production_batch = #{productionBatch},</if>
<if test="expirationDate != null">expiration_date = #{expirationDate},</if>
<if test="sourceNo != null and sourceNo != ''">source_no = #{sourceNo},</if>
<if test="taskNo != null and taskNo != ''">task_no = #{taskNo},</if>
<if test="lineNo != null and lineNo != ''">line_no = #{lineNo},</if>
<if test="teamGroupNo != null and teamGroupNo != ''">team_group_no = #{teamGroupNo},</if>
<if test="machineNo != null and machineNo != ''">machine_no = #{machineNo},</if>
<if test="fuzzy != null">fuzzy = #{fuzzy},</if>
<if test="curCode != null and curCode != ''">cur_code = #{curCode},</if>
<if test="scanNo != null">scan_no = #{scanNo},</if>
<if test="layerNo != null">layer_no = #{layerNo},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="inType != null and inType != ''">in_type = #{inType},</if>
</set>
WHERE id = #{id}
</update>
<update id="updateStatusByParentAppendCode" parameterType="string">
UPDATE in_pts_production_detail
SET status = #{status}
WHERE parent_append_code = #{parentAppendCode} and status = '0'
</update>
<select id="selectInPtsProductionDetailById" resultMap="BaseResultMap" parameterType="com.project.joggle.domain.InPtsProductionDetail">
SELECT <include refid="Base_Column_List"/>
FROM in_pts_production_detail
WHERE id = #{id}
</select>
<delete id="deleteInPtsProductionDetail" parameterType="string">
DELETE FROM in_pts_production_detail
WHERE id = #{id}
</delete>
<select id="selectInptsProductionDetailByParentAppendCode" parameterType="string" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM in_pts_production_detail
WHERE parent_append_code = #{parentAppendCode}
and status = '0'
</select>
<select id="selectTopInptsProductionDetail" resultMap="BaseResultMap">
SELECT * FROM (
SELECT <include refid="Base_Column_List"/>
FROM in_pts_production_detail
WHERE status in (2,4)
and in_type in (1,4)
and (errorcount is null or errorcount &lt;3)
order by production_date asc
) WHERE ROWNUM = 1
</select>
<select id="selectInptsProductionDetailBySourceNo" parameterType="string" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM in_pts_production_detail
WHERE source_no = #{sourceNo}
and status in (2,4)
and in_type =4
</select>
<select id="selectInPtsProductionDetailByAppendCodeAndStatus" parameterType="string" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM in_pts_production_detail
WHERE parent_append_code = #{parentAppendCode}
and status in (2,4)
and in_type =4
</select>
<update id="updateInPtsProductionDetailByParentAppendCode" parameterType="string">
UPDATE in_pts_production_detail
<set>
<if test="status != null and status != ''">
status = #{status}
</if>
<if test="errorcount !=null and errorcount != ''">
errorcount= #{errorcount}
</if>
</set>
WHERE parent_append_code = #{parentAppendCode}
and status='2'
</update>
<update id="updateInPtsProductionDetailByOrderNo" parameterType="string">
UPDATE in_pts_production_detail
SET status = #{status}
WHERE parent_append_code = #{parentAppendCode}
and status > 2
</update>
</mapper>