Files
klp-oa/klp-wms/src/main/resources/mapper/klp/WmsRawMaterialMapper.xml
Joshi e5acc06e1c feat(WmsRawMaterialMapper): 添加原材料查询过滤条件
- 在左连接中增加data_type和status条件过滤
- 添加原材料名称模糊匹配查询功能
- 优化查询逻辑以提高数据筛选准确性
2026-03-07 11:39:37 +08:00

66 lines
3.3 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.mapper.WmsRawMaterialMapper">
<resultMap type="com.klp.domain.WmsRawMaterial" id="WmsRawMaterialResult">
<result property="rawMaterialId" column="raw_material_id"/>
<result property="rawMaterialCode" column="raw_material_code"/>
<result property="rawMaterialName" column="raw_material_name"/>
<result property="steelGrade" column="steel_grade"/>
<result property="targetColdGrade" column="target_cold_grade"/>
<result property="baseMaterialId" column="base_material_id"/>
<result property="surfaceTreatmentId" column="surface_treatment_id"/>
<result property="thickness" column="thickness"/>
<result property="thicknessDeviation" column="thickness_deviation"/>
<result property="width" column="width"/>
<result property="targetColdWidth" column="target_cold_width"/>
<result property="targetColdThickness" column="target_cold_thickness"/>
<result property="crown" column="crown"/>
<result property="coilWeight" column="coil_weight"/>
<result property="surfaceQuality" column="surface_quality"/>
<result property="hardnessHv5" column="hardness_hv5"/>
<result property="hardnessDiff" column="hardness_diff"/>
<result property="compositionMn" column="composition_mn"/>
<result property="compositionP" column="composition_p"/>
<result property="grainSize" column="grain_size"/>
<result property="headTailCutFlag" column="head_tail_cut_flag"/>
<result property="inspectionResult" column="inspection_result"/>
<result property="isEnabled" column="is_enabled"/>
<result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="unit" column="unit"/>
<result property="bomId" column="bom_id"/>
<result property="specification" column="specification"/>
<result property="material" column="material"/>
<result property="manufacturer" column="manufacturer"/>
<result property="surfaceTreatmentDesc" column="surface_treatment_desc"/>
<result property="zincLayer" column="zinc_layer"/>
</resultMap>
<select id="selectStatistics" resultType="com.klp.domain.vo.dashboard.WmsRawMaterialStatisticsVo">
SELECT
rm.manufacturer,
rm.material,
rm.specification,
COUNT(mc.coil_id) AS coilCount,
COALESCE(SUM(mc.net_weight), 0) AS totalWeight
FROM wms_raw_material rm
LEFT JOIN wms_material_coil mc ON rm.raw_material_id = mc.item_id
AND mc.item_type = 'raw_material'
AND mc.del_flag = 0
AND mc.data_type = 1
AND mc.status = 0
WHERE rm.del_flag = 0
AND rm.raw_material_name LIKE CONCAT('%', '热轧卷板', '%')
GROUP BY rm.manufacturer, rm.material, rm.specification
ORDER BY rm.manufacturer, rm.material, rm.specification
</select>
</mapper>