<?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.aps.core.mapper.ApsPlateStandardRequireMapper">
|
|
<resultMap type="com.aps.core.domain.ApsPlate.ApsPlateStandardRequire" id="ApsPlateStandardRequireResult">
|
<result property="id" column="id" />
|
<result property="requireTrackId" column="require_track_id" />
|
<result property="bomLineId" column="bom_line_id" />
|
<result property="bomLineCode" column="bom_line_code" />
|
<result property="bomLineLevel" column="bom_line_level" />
|
<result property="bomUseAmount" column="bom_use_amount" />
|
<result property="processRouteId" column="process_route_id" />
|
<result property="processRouteHours" column="process_route_hours" />
|
<result property="requireAmount" column="require_amount" />
|
<result property="netRequirement" column="net_requirement" />
|
<result property="startDate" column="start_date" />
|
<result property="completeDate" column="complete_date" />
|
<result property="demandDate" column="demand_date" />
|
<result property="orgCode" column="org_code" />
|
<result property="productionBase" column="production_base" />
|
<result property="matchState" column="match_state" />
|
<result property="matchMode" column="match_mode" />
|
<result property="unmatchedDemandAmount" column="unmatched_demand_amount" />
|
<result property="suggestedCompletionDate" column="suggested_completion_date" />
|
<result property="hasDelayRisk" column="has_delay_risk" />
|
<result property="batchNumber" column="batch_number" />
|
<result property="delFlag" column="del_flag" />
|
<result property="createTime" column="create_time" />
|
<result property="createBy" column="create_by" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="orderCreateTime" column="order_create_time" />
|
</resultMap>
|
|
<sql id="selectApsPlateStandardRequireVo">
|
select id, require_track_id, bom_line_id, bom_line_code, bom_line_level, bom_use_amount,
|
process_route_id, process_route_hours, require_amount, net_requirement, start_date,
|
complete_date, demand_date, org_code, production_base, match_state, match_mode,
|
unmatched_demand_amount, suggested_completion_date, has_delay_risk, batch_number,
|
del_flag, create_time, create_by, update_by, update_time,order_create_time
|
from aps_plate_standard_require
|
</sql>
|
|
<select id="selectApsPlateStandardRequireList" parameterType="com.aps.core.domain.ApsPlate.ApsPlateStandardRequire" resultMap="ApsPlateStandardRequireResult">
|
<include refid="selectApsPlateStandardRequireVo"/>
|
<where>
|
<if test="requireTrackId != null and requireTrackId != ''"> and require_track_id = #{requireTrackId}</if>
|
<if test="bomLineId != null and bomLineId != ''"> and bom_line_id = #{bomLineId}</if>
|
<if test="bomLineCode != null and bomLineCode != ''"> and bom_line_code = #{bomLineCode}</if>
|
<if test="bomLineLevel != null "> and bom_line_level = #{bomLineLevel}</if>
|
<if test="bomUseAmount != null and bomUseAmount != ''"> and bom_use_amount = #{bomUseAmount}</if>
|
<if test="processRouteId != null and processRouteId != ''"> and process_route_id = #{processRouteId}</if>
|
<if test="processRouteHours != null and processRouteHours != ''"> and process_route_hours = #{processRouteHours}</if>
|
<if test="requireAmount != null and requireAmount != ''"> and require_amount = #{requireAmount}</if>
|
<if test="netRequirement != null and netRequirement != ''"> and net_requirement = #{netRequirement}</if>
|
<if test="startDate != null and startDate != ''"> and start_date = #{startDate}</if>
|
<if test="completeDate != null and completeDate != ''"> and complete_date = #{completeDate}</if>
|
<if test="demandDate != null and demandDate != ''"> and demand_date = #{demandDate}</if>
|
<if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if>
|
<if test="productionBase != null and productionBase != ''"> and production_base = #{productionBase}</if>
|
<if test="matchState != null and matchState != ''"> and match_state = #{matchState}</if>
|
<if test="matchMode != null and matchMode != ''"> and match_mode = #{matchMode}</if>
|
<if test="unmatchedDemandAmount != null and unmatchedDemandAmount != ''"> and unmatched_demand_amount = #{unmatchedDemandAmount}</if>
|
<if test="suggestedCompletionDate != null and suggestedCompletionDate != ''"> and suggested_completion_date = #{suggestedCompletionDate}</if>
|
<if test="hasDelayRisk != null and hasDelayRisk != ''"> and has_delay_risk = #{hasDelayRisk}</if>
|
<if test="batchNumber != null and batchNumber != ''"> and batch_number = #{batchNumber}</if>
|
</where>
|
</select>
|
|
<select id="selectApsPlateStandardRequireById" parameterType="Long" resultMap="ApsPlateStandardRequireResult">
|
<include refid="selectApsPlateStandardRequireVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertApsPlateStandardRequire" parameterType="com.aps.core.domain.ApsPlate.ApsPlateStandardRequire">
|
insert into aps_plate_standard_require
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="requireTrackId != null">require_track_id,</if>
|
<if test="bomLineId != null">bom_line_id,</if>
|
<if test="bomLineCode != null">bom_line_code,</if>
|
<if test="bomLineLevel != null">bom_line_level,</if>
|
<if test="bomUseAmount != null">bom_use_amount,</if>
|
<if test="processRouteId != null">process_route_id,</if>
|
<if test="processRouteHours != null">process_route_hours,</if>
|
<if test="requireAmount != null">require_amount,</if>
|
<if test="netRequirement != null">net_requirement,</if>
|
<if test="startDate != null">start_date,</if>
|
<if test="completeDate != null">complete_date,</if>
|
<if test="demandDate != null">demand_date,</if>
|
<if test="orgCode != null">org_code,</if>
|
<if test="productionBase != null">production_base,</if>
|
<if test="matchState != null">match_state,</if>
|
<if test="matchMode != null">match_mode,</if>
|
<if test="unmatchedDemandAmount != null">unmatched_demand_amount,</if>
|
<if test="suggestedCompletionDate != null">suggested_completion_date,</if>
|
<if test="hasDelayRisk != null">has_delay_risk,</if>
|
<if test="batchNumber != null">batch_number,</if>
|
<if test="delFlag != null">del_flag,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
<if test="updateTime != null">update_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id},</if>
|
<if test="requireTrackId != null">#{requireTrackId},</if>
|
<if test="bomLineId != null">#{bomLineId},</if>
|
<if test="bomLineCode != null">#{bomLineCode},</if>
|
<if test="bomLineLevel != null">#{bomLineLevel},</if>
|
<if test="bomUseAmount != null">#{bomUseAmount},</if>
|
<if test="processRouteId != null">#{processRouteId},</if>
|
<if test="processRouteHours != null">#{processRouteHours},</if>
|
<if test="requireAmount != null">#{requireAmount},</if>
|
<if test="netRequirement != null">#{netRequirement},</if>
|
<if test="startDate != null">#{startDate},</if>
|
<if test="completeDate != null">#{completeDate},</if>
|
<if test="demandDate != null">#{demandDate},</if>
|
<if test="orgCode != null">#{orgCode},</if>
|
<if test="productionBase != null">#{productionBase},</if>
|
<if test="matchState != null">#{matchState},</if>
|
<if test="matchMode != null">#{matchMode},</if>
|
<if test="unmatchedDemandAmount != null">#{unmatchedDemandAmount},</if>
|
<if test="suggestedCompletionDate != null">#{suggestedCompletionDate},</if>
|
<if test="hasDelayRisk != null">#{hasDelayRisk},</if>
|
<if test="batchNumber != null">#{batchNumber},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateApsPlateStandardRequire" parameterType="com.aps.core.domain.ApsPlate.ApsPlateStandardRequire">
|
update aps_plate_standard_require
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="requireTrackId != null">require_track_id = #{requireTrackId},</if>
|
<if test="bomLineId != null">bom_line_id = #{bomLineId},</if>
|
<if test="bomLineCode != null">bom_line_code = #{bomLineCode},</if>
|
<if test="bomLineLevel != null">bom_line_level = #{bomLineLevel},</if>
|
<if test="bomUseAmount != null">bom_use_amount = #{bomUseAmount},</if>
|
<if test="processRouteId != null">process_route_id = #{processRouteId},</if>
|
<if test="processRouteHours != null">process_route_hours = #{processRouteHours},</if>
|
<if test="requireAmount != null">require_amount = #{requireAmount},</if>
|
<if test="netRequirement != null">net_requirement = #{netRequirement},</if>
|
<if test="startDate != null">start_date = #{startDate},</if>
|
<if test="completeDate != null">complete_date = #{completeDate},</if>
|
<if test="demandDate != null">demand_date = #{demandDate},</if>
|
<if test="orgCode != null">org_code = #{orgCode},</if>
|
<if test="productionBase != null">production_base = #{productionBase},</if>
|
<if test="matchState != null">match_state = #{matchState},</if>
|
<if test="matchMode != null">match_mode = #{matchMode},</if>
|
<if test="unmatchedDemandAmount != null">unmatched_demand_amount = #{unmatchedDemandAmount},</if>
|
<if test="suggestedCompletionDate != null">suggested_completion_date = #{suggestedCompletionDate},</if>
|
<if test="hasDelayRisk != null">has_delay_risk = #{hasDelayRisk},</if>
|
<if test="batchNumber != null">batch_number = #{batchNumber},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteApsPlateStandardRequireById" parameterType="Long">
|
delete from aps_plate_standard_require where id = #{id}
|
</delete>
|
|
<delete id="deleteApsPlateStandardRequireByIds" parameterType="String">
|
delete from aps_plate_standard_require where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<select id="selectPlateSupplyGapList" parameterType="com.aps.core.domain.ApsPlate.ApsPlateStandardRequire" resultMap="ApsPlateStandardRequireResult">
|
select id, require_track_id, bom_line_code, bom_line_level,
|
match_state, match_mode, unmatched_demand_amount, start_date,
|
complete_date, demand_date, org_code, production_base
|
from aps_plate_standard_require where unmatched_demand_amount>0 and del_flag='0' and bom_line_level>0
|
<if test="requireTrackId != null and requireTrackId != ''"> and require_track_id like '%' || #{requireTrackId} || '%'</if>
|
<if test="bomLineCode != null and bomLineCode != ''"> and bom_line_code like '%' || #{bomLineCode} || '%'</if>
|
</select>
|
|
<insert id="batchInsert" parameterType="java.util.List">
|
insert into aps_plate_standard_require
|
(id, require_track_id,doc_num,batch_number, org_code, bom_header_code,bom_line_id, bom_line_code, bom_line_level, bom_use_amount, process_route_id,
|
process_route_hours, require_amount, net_requirement, start_date, complete_date, demand_date,
|
production_base, match_state, match_mode, unmatched_demand_amount, suggested_completion_date,
|
has_delay_risk, del_flag, create_time, create_by,order_create_time)
|
values
|
<foreach collection="list" item="item" separator=",">
|
(
|
#{item.id},
|
#{item.requireTrackId},
|
#{item.docNum},
|
#{item.batchNumber},
|
#{item.orgCode},
|
#{item.bomHeaderCode},
|
#{item.bomLineId},
|
#{item.bomLineCode},
|
#{item.bomLineLevel},
|
#{item.bomUseAmount},
|
#{item.processRouteId},
|
#{item.processRouteHours},
|
#{item.requireAmount},
|
#{item.netRequirement},
|
#{item.startDate},
|
#{item.completeDate},
|
#{item.demandDate},
|
#{item.productionBase},
|
#{item.matchState},
|
#{item.matchMode},
|
#{item.unmatchedDemandAmount},
|
#{item.suggestedCompletionDate},
|
#{item.hasDelayRisk},
|
#{item.delFlag},
|
#{item.createTime},
|
#{item.createBy},
|
#{item.orderCreateTime}
|
)
|
</foreach>
|
</insert>
|
<update id="deleteLastPatch" parameterType="String">
|
update aps_plate_standard_require set del_flag = '1' where batch_number = #{batchNumber}
|
</update>
|
</mapper>
|