廖井涛
2025-02-11 28c2126249a35ded0b816a07d80c015caa45a4f3
north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
@@ -10,7 +10,7 @@
        from
            sd.`order` as o
        where
            o.quantity=#{order.quantity} and o.area=#{order.area} and o.project=#{order.project} and o.customer_id=#{order.customerId}
            o.quantity=#{order.quantity} and o.area=#{order.area} and trim(o.project)=trim(#{order.project}) and o.customer_id=#{order.customerId}
    </select>
    <select id="selectMaxOrderId">
@@ -39,6 +39,7 @@
            `order` as a
        where
            year(a.create_time)  = year(now())
            and a.id>400
    </select>
    <select id="selectOrderIdMin">
@@ -47,6 +48,22 @@
    <select id="selectOrderIdIs">
        select count(*) from sd.`order` where SUBSTR(order_id,3,11)=#{substringInt}
    </select>
    <select id="selectOrderIdDay">
        select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},9,2)=01
    </select>
    <select id="selectOrderIdMonth">
        select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},7,4)=0001
    </select>
    <select id="selectOrderIdYear">
        select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},5,2)=000001
    </select>
    <select id="selectOrderId">
        select * from sd.`order` where order_id=#{orderId}
    </select>
    <update id="updateOrderId">
@@ -85,8 +102,8 @@
    </update>
    
    <select id="getOrderList">
        select
            *,
       select * from (select
            o.*,
        ifnull(sum(fgi.quantity_available),0) as goodsQuantity
        from
            sd.`order` as o
@@ -179,16 +196,38 @@
            and o.processing_note REGEXP #{order.processingNote}
        </if>
        group by o.id
        order by o.id desc
        ) as acc
        order by
        <if test="orderBy == null ">
            id desc
        </if>
        <if test="orderBy == 'desc'">
            ${field} desc
        </if>
        <if test="orderBy == 'asc'">
            ${field}
        </if>
        limit #{offset},#{pageSize}
    </select>
    <select id="getPageTotal">
        select
            CEILING(count(o.id)/#{pageSize}) as 'pageTotal',
            count(o.id) as 'total'
            count(o.id) as 'dataTotal',
            sum(o.quantity) as quantity,
            sum(o.area) as area,
            sum(o.money) as money,
            ifnull(fgi.goodsQuantity ,0) as goodsQuantity ,
            ROUND(sum(perimeter),2) as perimeter,
            #{pageSize} as pageSize
        from
        `order` as o
        left join(
                    select order_id,
                           ifnull(sum(quantity_available),0) as goodsQuantity
                    from mm.finished_goods_inventory group by order_id
                    )  as  fgi
        on o.order_id = fgi.order_id
        where date (o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
            <if test="orderType!= null and orderType != 0">
                and o.create_order = #{orderType}
@@ -318,4 +357,15 @@
            o.order_id = #{orderId}
    </update>
    <select id="selectDifferentSize">
    select a.order_number,count(a.order_number),a.order_id from(select order_id,order_number
    from sd.order_glass_detail ogd
    where ogd.order_id = #{orderId}
    group by ogd.order_number,ogd.child_height,child_width)
    as a
    group by a.order_number
    having count(a.order_number) > 1
    </select>
</mapper>