60 lines
1.9 KiB
XML
60 lines
1.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.gear.mes.production.mapper.GearProductionTaskProductMapper">
|
|
|
|
<select id="selectByTaskId" resultType="com.gear.mes.production.domain.vo.GearProductionTaskProductVo">
|
|
SELECT
|
|
p.line_id AS lineId,
|
|
p.task_id AS taskId,
|
|
p.product_id AS productId,
|
|
p.plan_qty AS planQty,
|
|
p.finished_qty AS finishedQty,
|
|
p.bad_qty AS badQty,
|
|
p.unit AS unit,
|
|
p.remark AS remark,
|
|
COALESCE(gp.product_name, mp.product_name) AS productName,
|
|
COALESCE(gp.product_code, CAST(mp.product_id AS CHAR)) AS productCode,
|
|
COALESCE(gp.type, mp.product_type) AS productType,
|
|
mp.spec AS spec,
|
|
mp.model AS model
|
|
FROM gear_production_task_product p
|
|
LEFT JOIN gear_product gp ON p.product_id = gp.product_id
|
|
LEFT JOIN mat_product mp ON p.product_id = mp.product_id
|
|
WHERE p.task_id = #{taskId}
|
|
ORDER BY p.line_id
|
|
</select>
|
|
|
|
<insert id="insertBatch">
|
|
INSERT INTO gear_production_task_product (
|
|
line_id,
|
|
task_id,
|
|
product_id,
|
|
plan_qty,
|
|
finished_qty,
|
|
bad_qty,
|
|
unit,
|
|
remark
|
|
)
|
|
VALUES
|
|
<foreach collection="list" item="i" separator=",">
|
|
(
|
|
#{i.lineId},
|
|
#{i.taskId},
|
|
#{i.productId},
|
|
#{i.planQty},
|
|
#{i.finishedQty},
|
|
#{i.badQty},
|
|
#{i.unit},
|
|
#{i.remark}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<delete id="deleteByTaskId">
|
|
DELETE FROM gear_production_task_product WHERE task_id = #{taskId}
|
|
</delete>
|
|
|
|
</mapper>
|