evoToK3Cloud/ruoyi-system/src/main/resources/mapper/system/ProductionOrderMapper.xml
2026-05-18 09:47:48 +08:00

61 lines
2.7 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.ruoyi.system.mapper.ProductionOrderMapper">
<resultMap type="com.ruoyi.system.domain.ProductionOrder" id="ProductionOrderResult">
<result property="id" column="id"/>
<result property="productionOrderNo" column="production_order_no"/>
<result property="drawingNo" column="drawing_no"/>
<result property="drawingName" column="drawing_name"/>
<result property="quantity" column="quantity"/>
<result property="material" column="material"/>
<result property="singleWeight" column="single_weight"/>
<result property="totalWeight" column="total_weight"/>
<result property="remark" column="remark"/>
<result property="parentPart" column="parent_part"/>
<result property="parentDrawingNo" column="parent_drawing_no"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="mainName" column="main_name"/>
<result property="mainPart" column="main_part"/>
<result property="batchQuantity" column="batch_quantity"/>
</resultMap>
<select id="selectWeightByDrawingNos" resultType="com.ruoyi.system.domain.ProductionOrder">
select p.drawing_no as drawingNo,
p.single_weight as singleWeight
from production_order p
inner join (
select drawing_no, max(id) as max_id
from production_order
where drawing_no in
<foreach collection="drawingNos" item="drawingNo" open="(" separator="," close=")">
#{drawingNo}
</foreach>
group by drawing_no
) t on p.id = t.max_id
where p.single_weight is not null
</select>
<select id="selectDiscWeightByMaterialCodes" resultType="com.ruoyi.system.domain.ProductionOrder">
select p.material_code as drawingNo,
p.disc_weight as singleWeight
from process_route p
inner join (
select material_code, max(id) as max_id
from process_route
where material_code in
<foreach collection="materialCodes" item="materialCode" open="(" separator="," close=")">
#{materialCode}
</foreach>
group by material_code
) t on p.id = t.max_id
where p.disc_weight is not null
</select>
</mapper>