| | |
| | | SELECT |
| | | pp.*, |
| | | pms.material_code AS materialCode, |
| | | pms.specification AS specification, |
| | | pms.material_id AS productMaterialId, |
| | | pm.material_name AS productName, |
| | | pm.base_unit |
| | | pms.model, |
| | | pms.product_id AS productMaterialId, |
| | | pm.product_name AS productName, |
| | | pm.unit |
| | | FROM production_plan pp |
| | | left join product_material_sku pms on pp.product_material_sku_id = pms.id |
| | | left join product_material pm on pms.material_id = pm.id |
| | | left join product_material pm on pms.product_id = pm.id |
| | | WHERE 1 = 1 |
| | | <if test="c.customerName != null and c.customerName != '' "> |
| | | AND pp.customer_name LIKE CONCAT('%',#{c.customerName},'%') |
| | | </if> |
| | | <if test="c.productName != null and c.productName != '' "> |
| | | AND pm.material_name LIKE CONCAT('%',#{c.productName},'%') |
| | | AND pm.product_name LIKE CONCAT('%',#{c.productName},'%') |
| | | </if> |
| | | <if test="c.materialCode != null and c.materialCode != '' "> |
| | | AND pms.material_code LIKE CONCAT('%',#{c.materialCode},'%') |
| | | </if> |
| | | <if test="c.specification != null and c.specification != '' "> |
| | | AND pms.specification LIKE CONCAT('%',#{c.specification},'%') |
| | | <if test="c.model != null and c.model != '' "> |
| | | AND pms.model LIKE CONCAT('%',#{c.model},'%') |
| | | </if> |
| | | <if test="c.applyNo != null and c.applyNo != '' "> |
| | | AND pp.apply_no LIKE CONCAT('%',#{c.applyNo},'%') |
| | |
| | | <select id="selectSummaryByProductType" resultType="com.ruoyi.productionPlan.dto.ProductionPlanSummaryDto"> |
| | | SELECT |
| | | sku.material_code AS materialCode, |
| | | pm.material_name AS productName, |
| | | sku.specification AS specification, |
| | | pm.product_name AS productName, |
| | | sku.model, |
| | | pp.length, |
| | | pp.width, |
| | | pp.height, |
| | | pm.base_unit AS baseUnit, |
| | | pm.unit AS unit, |
| | | COALESCE(SUM(pp.quantity),0) AS quantity, |
| | | COALESCE(SUM(pp.volume),0) AS volume |
| | | FROM production_plan pp |
| | | LEFT JOIN product_material_sku sku |
| | | ON pp.product_material_sku_id = sku.id |
| | | LEFT JOIN product_material pm |
| | | ON sku.material_id = pm.id |
| | | ON sku.product_id = pm.id |
| | | <where> |
| | | <if test="materialCode != null and materialCode != ''"> |
| | | AND sku.material_code LIKE CONCAT('%', #{materialCode}, '%') |
| | | </if> |
| | | |
| | | <if test="productName != null and productName != ''"> |
| | | AND pm.material_name LIKE CONCAT('%', #{productName}, '%') |
| | | AND pm.product_name LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | |
| | | <if test="specification != null and specification != ''"> |
| | | AND sku.specification LIKE CONCAT('%', #{specification}, '%') |
| | | <if test="model != null and model != ''"> |
| | | AND sku.model LIKE CONCAT('%', #{model}, '%') |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | sku.material_code, |
| | | pm.material_name, |
| | | sku.specification, |
| | | pm.product_name, |
| | | sku.model, |
| | | pp.length, |
| | | pp.width, |
| | | pp.height, |
| | | pm.base_unit |
| | | pm.unit |
| | | </select> |
| | | |
| | | <select id="selectWithMaterialByIds" resultType="com.ruoyi.productionPlan.dto.ProductionPlanDto"> |
| | | SELECT |
| | | pp.*, |
| | | pms.material_code AS materialCode, |
| | | pms.specification AS specification, |
| | | pm.material_name AS productName, |
| | | pm.base_unit |
| | | pms.model, |
| | | pm.product_name AS productName, |
| | | pm.unit |
| | | FROM production_plan pp |
| | | LEFT JOIN product_material_sku pms ON pp.product_material_sku_id = pms.id |
| | | LEFT JOIN product_material pm ON pms.material_id = pm.id |
| | | LEFT JOIN product_material pm ON pms.product_id = pm.id |
| | | WHERE pp.id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |