gaoluyang
2026-11-03 a829dd34332bbc10c6b42ef86635ed48e34c6207
src/main/resources/mapper/basic/ProductModelMapper.xml
@@ -54,12 +54,25 @@
    </select>
    <select id="selectBatchNoListByProductModelId" resultType="java.lang.String">
        select distinct si.batch_no
        select si.batch_no
        from stock_inventory si
        left join (
            select sir.batch_no, min(sir.create_time) as first_in_time
            from stock_in_record sir
            where sir.product_model_id = #{productModelId}
              and sir.batch_no is not null
              and sir.batch_no != ''
            group by sir.batch_no
        ) first_in on first_in.batch_no = si.batch_no
        where si.product_model_id = #{productModelId}
          and si.batch_no is not null
          and si.batch_no != ''
        order by si.batch_no
          and si.qualitity - IFNULL(si.locked_quantity, 0) > 0
        group by si.batch_no
        order by MIN(first_in.first_in_time) is null,
                 MIN(first_in.first_in_time),
                 MIN(si.create_time),
                 MIN(si.batch_no)
    </select>
    <select id="selectLatestRecord" resultType="com.ruoyi.basic.pojo.ProductModel">
            SELECT * FROM product_model