Files
klp-oa/klp-aps/src/main/resources/mapper/aps/ApsQuickSheetMapper.xml

177 lines
6.2 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.aps.mapper.ApsQuickSheetMapper">
<select id="selectList" parameterType="com.klp.aps.domain.dto.ApsQuickSheetQueryReq" resultType="com.klp.aps.domain.vo.ApsQuickSheetRowVo">
SELECT
quick_sheet_id AS quickSheetId,
plan_date AS planDate,
line_id AS lineId,
line_name AS lineName,
plan_code AS planCode,
plan_type AS planType,
scheduler,
remark,
biz_seq_no AS bizSeqNo,
order_code AS orderCode,
contract_code AS contractCode,
customer_name AS customerName,
salesman,
product_name AS productName,
product_material AS productMaterial,
coating_g AS coatingG,
product_width AS productWidth,
rolling_thick AS rollingThick,
mark_coat_thick AS markCoatThick,
ton_steel_length_range AS tonSteelLengthRange,
plan_qty AS planQty,
plan_weight AS planWeight,
surface_treatment AS surfaceTreatment,
width_req AS widthReq,
usage_req AS usageReq,
post_process AS postProcess,
next_process AS nextProcess,
sample_req AS sampleReq,
raw_manufacturer AS rawManufacturer,
raw_material AS rawMaterial,
raw_thick AS rawThick,
raw_width AS rawWidth,
raw_material_id AS rawMaterialId,
raw_coil_nos AS rawCoilNos,
raw_location AS rawLocation,
raw_packaging AS rawPackaging,
raw_edge_req AS rawEdgeReq,
raw_coating_type AS rawCoatingType,
raw_net_weight AS rawNetWeight,
start_time AS startTime,
end_time AS endTime
FROM aps_quick_sheet
WHERE del_flag = 0
<if test="startDate != null">
AND start_time <![CDATA[>=]]> CONCAT(#{startDate}, ' 00:00:00')
</if>
<if test="endDate != null">
AND start_time <![CDATA[<=]]> CONCAT(#{endDate}, ' 23:59:59')
</if>
<if test="lineId != null">
AND line_id = #{lineId}
</if>
<if test="customerName != null and customerName != ''">
AND customer_name LIKE CONCAT('%', #{customerName}, '%')
</if>
ORDER BY quick_sheet_id DESC
</select>
<select id="countToday" resultType="int">
SELECT COUNT(1)
FROM aps_quick_sheet
WHERE del_flag = 0
AND plan_date = #{planDate}
</select>
<select id="selectIdByPlanCode" resultType="long">
SELECT quick_sheet_id
FROM aps_quick_sheet
WHERE plan_code = #{planCode}
AND del_flag = 0
LIMIT 1
</select>
<insert id="insertRow">
INSERT INTO aps_quick_sheet (
line_id, line_name, plan_date, plan_code, plan_type, scheduler, remark,
biz_seq_no, order_code, contract_code, customer_name, salesman,
product_name, product_material, coating_g, product_width, rolling_thick, mark_coat_thick,
ton_steel_length_range, plan_qty, plan_weight, surface_treatment, width_req, usage_req,
post_process, next_process, sample_req,
raw_manufacturer, raw_material, raw_thick, raw_width, raw_material_id, raw_coil_nos,
raw_location, raw_packaging, raw_edge_req, raw_coating_type, raw_net_weight,
start_time, end_time,
create_by, update_by, create_time, update_time, del_flag
) VALUES (
#{lineId}, #{lineName}, #{planDate}, #{planCode}, #{planType}, #{scheduler}, #{remark},
#{bizSeqNo}, #{orderCode}, #{contractCode}, #{customerName}, #{salesman},
#{productName}, #{productMaterial}, #{coatingG}, #{productWidth}, #{rollingThick}, #{markCoatThick},
#{tonSteelLengthRange}, #{planQty}, #{planWeight}, #{surfaceTreatment}, #{widthReq}, #{usageReq},
#{postProcess}, #{nextProcess}, #{sampleReq},
#{rawManufacturer}, #{rawMaterial}, #{rawThick}, #{rawWidth}, #{rawMaterialId}, #{rawCoilNos},
#{rawLocation}, #{rawPackaging}, #{rawEdgeReq}, #{rawCoatingType}, #{rawNetWeight},
#{startTime}, #{endTime},
#{createBy}, #{updateBy}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0
)
</insert>
<update id="updateRow">
UPDATE aps_quick_sheet
SET line_id = #{lineId},
line_name = #{lineName},
plan_code = #{planCode},
plan_type = #{planType},
scheduler = #{scheduler},
remark = #{remark},
biz_seq_no = #{bizSeqNo},
order_code = #{orderCode},
contract_code = #{contractCode},
customer_name = #{customerName},
salesman = #{salesman},
product_name = #{productName},
product_material = #{productMaterial},
coating_g = #{coatingG},
product_width = #{productWidth},
rolling_thick = #{rollingThick},
mark_coat_thick = #{markCoatThick},
ton_steel_length_range = #{tonSteelLengthRange},
plan_qty = #{planQty},
plan_weight = #{planWeight},
surface_treatment = #{surfaceTreatment},
width_req = #{widthReq},
usage_req = #{usageReq},
post_process = #{postProcess},
next_process = #{nextProcess},
sample_req = #{sampleReq},
raw_manufacturer = #{rawManufacturer},
raw_material = #{rawMaterial},
raw_thick = #{rawThick},
raw_width = #{rawWidth},
raw_material_id = #{rawMaterialId},
raw_coil_nos = #{rawCoilNos},
raw_location = #{rawLocation},
raw_packaging = #{rawPackaging},
raw_edge_req = #{rawEdgeReq},
raw_coating_type = #{rawCoatingType},
raw_net_weight = #{rawNetWeight},
start_time = #{startTime},
end_time = #{endTime},
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
<update id="deleteRow">
UPDATE aps_quick_sheet
SET del_flag = 1,
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
<update id="softDelete">
UPDATE aps_quick_sheet
SET del_flag = 1,
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
<update id="deleteById">
UPDATE aps_quick_sheet
SET del_flag = 1,
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
</mapper>