zhoushihao
2025-09-04 7c8ab3da1310aad916eff841cae77c106ecb91c6
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -18,7 +18,8 @@
        <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">
@@ -121,17 +122,36 @@
            where flow_card_id = #{flowCardId}
              and tempering_layout_id is null
              and tempering_feed_sequence is null
        )
        select flow_card_id,
               layer,
               order_sort,
               first_length,
               films_id,
               second_Length,
               thickness,
               count(*) as lack_cout
        from relation_length
        group by flow_card_id, layer, order_sort, films_id, first_length, second_Length, thickness
        ),
             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, 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)