wangfei
2025-09-04 721e56d2156cd820beaabd8b4e3e5c06fd87c809
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -13,11 +13,13 @@
    <resultMap id="lackBaseMap" type="com.mes.hollow.entity.dto.LackDetailsDTO">
        <result column="flow_card_id" property="flowCardId"/>
        <result column="layer" property="layer"/>
        <result column="order_sort" property="glassType"/>
        <result column="films_id" property="filmsId"/>
        <result column="first_length" property="width"/>
        <result column="second_Length" property="height"/>
        <result column="thickness" property="thickness"/>
        <result column="lack_cout" property="lackCount"/>
        <result column="lack_count" property="lackCount"/>
        <result column="damage_count" property="damageCount"/>
    </resultMap>
    <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMap">
@@ -107,6 +109,7 @@
        with relation_length as (
            select flow_card_id,
                   layer,
                   order_sort,
                   tempering_layout_id,
                   tempering_feed_sequence,
                   GREATEST(width, height) as first_length,
@@ -119,10 +122,36 @@
            where flow_card_id = #{flowCardId}
              and tempering_layout_id is null
              and tempering_feed_sequence is null
        )
        select flow_card_id, layer, first_length, films_id, second_Length, thickness, count(*) as lack_cout
        ),
             lack_count_temp as (
                 select flow_card_id,
                        layer,
                        order_sort,
                        first_length,
                        films_id,
                        second_Length,
                        thickness,
                        count(*) as lack_count
        from relation_length
        group by flow_card_id, layer, films_id, first_length, second_Length, thickness
                 group by flow_card_id, layer, order_sort, films_id, first_length, second_Length, thickness
             ),
             damage_count_temp as (
                 select process_id        as flow_card_id,
                        technology_number as layer,
                        order_number      as order_sort,
                        count(1)          as damage_count
                 from damage
                 where process_id = #{flowCardId}
                 group by process_id, technology_number, order_number
             ),
             result_count as (
                 select t.*, IFNULL(t1.damage_count, 0) damage_count
                 from lack_count_temp t
                          left join damage_count_temp t1 on t.flow_card_id = t1.flow_card_id and t.layer = t1.layer and
                                                            t.order_sort = t1.order_sort
             )
        select *
        from result_count
    </select>
    <select id="queryLayerByFlowCardId" resultType="java.lang.Integer">
        select count(distinct layer)