jiangqs
2023-07-05 32bd52ec49d25021b6a35d8ee5f32c70df788165
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -80,7 +80,7 @@
        <result column="payMoney" property="payMoney"/>
        <result column="orderFrom" property="orderFrom" />
        <result column="createTime" property="createTime" />
        <collection property="mgtOrderGoodsVoList" ofType="com.ruoyi.order.domain.vo.MerOrderGoodsPageVo">
        <collection property="mgtOrderGoodsVoList" ofType="com.ruoyi.order.domain.vo.MgtOrderGoodsPageVo">
            <result column="goodsName" property="goodsName"/>
            <result column="buyNum" property="buyNum"/>
        </collection>
@@ -94,11 +94,26 @@
        <result column="orderMoney" property="orderMoney"/>
        <result column="createTime" property="createTime"/>
        <result column="receivableMoney" property="receivableMoney"/>
        <result column="discountMoney" property="discountMoney"/>
        <result column="payMoney" property="payMoney"/>
        <result column="unPaidMoney" property="unPaidMoney"/>
        <result column="orderFrom" property="orderFrom"/>
        <result column="shopId" property="shopId"/>
        <result column="verifyTime" property="verifyTime"/>
        <collection property="mgtOrderGoodsPageVoList" ofType="com.ruoyi.order.domain.vo.MgtOrderGoodsPageVo">
            <result column="goodsName" property="goodsName"/>
            <result column="buyNum" property="buyNum"/>
        </collection>
    </resultMap>
    <resultMap id="mgtShopAllOrderResultMap" type="com.ruoyi.order.domain.vo.MgtShopAllOrderPageVo">
        <result column="orderId" property="orderId"/>
        <result column="orderNo" property="orderNo"/>
        <result column="userId" property="userId"/>
        <result column="orderMoney" property="orderMoney"/>
        <result column="receivableMoney" property="receivableMoney"/>
        <result column="discountMoney" property="discountMoney"/>
        <result column="payMoney" property="payMoney"/>
        <result column="orderFrom" property="orderFrom"/>
        <collection property="mgtOrderGoodsPageVoList" ofType="com.ruoyi.order.domain.vo.MgtOrderGoodsPageVo">
            <result column="goodsName" property="goodsName"/>
            <result column="buyNum" property="buyNum"/>
@@ -579,7 +594,7 @@
        toc.pay_money payMoney,
        toc.shop_id shopId,
        toc.use_time verifyTime,
        CASE toc.order_from WHEN 1 THEN '小程序' WHEN 3 THEN '线下创建' END orderFrom
        CASE toc.order_from WHEN 1 THEN '小程序' WHEN 2 THEN '秒杀活动' WHEN 3 THEN '线下创建' END orderFrom
        FROM t_order toc
        INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id
        WHERE toc.del_flag = 0 AND (toc.order_from = 1 OR toc.order_from = 3)
@@ -610,9 +625,9 @@
    <select id="boardOrderTotal" resultType="com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo">
        SELECT
            SUM(CASE WHEN order_status = 3 THEN pay_money ELSE 0 END) salesTotal,
            SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END) UnUseOrderTotal,
            SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END) activityOrderTotal
            IFNULL(SUM(CASE WHEN order_status = 3 THEN pay_money ELSE 0 END),0) salesTotal,
            IFNULL(SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END),0) UnUseOrderTotal,
            IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityOrderTotal
        FROM t_order
        WHERE del_flag = 0
    </select>
@@ -620,13 +635,13 @@
    <select id="getTotalOrderTotalOrderFrom" resultType="com.ruoyi.order.domain.vo.MgtTotalOrderTotalVo">
        SELECT
        COUNT(order_id) orderTotal,
        SUM(CASE WHEN order_from = 1 THEN 1 ELSE 0 END) onlineTotal,
        SUM(CASE WHEN order_from = 3 THEN 1 ELSE 0 END) offlineTotal,
        SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END) activityTotal,
        IFNULL(SUM(CASE WHEN order_from = 1 THEN 1 ELSE 0 END),0) onlineTotal,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN 1 ELSE 0 END),0) offlineTotal,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityTotal,
        IFNULL(SUM(order_money),0) orderMoney,
        SUM(CASE WHEN order_from = 1 THEN order_money ELSE 0 END) onlineMoney,
        SUM(CASE WHEN order_from = 3 THEN order_money ELSE 0 END) offlineMoney,
        SUM(CASE WHEN order_from = 2 THEN order_money ELSE 0 END) activityMoney
        IFNULL(SUM(CASE WHEN order_from = 1 THEN order_money ELSE 0 END),0) onlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 3 THEN order_money ELSE 0 END),0) offlineMoney,
        IFNULL(SUM(CASE WHEN order_from = 2 THEN order_money ELSE 0 END),0) activityMoney
        FROM t_order WHERE del_flag = 0
        <if test="param.shopId != null and param.shopId != ''">
            AND shop_id = #{param.shopId}
@@ -862,7 +877,7 @@
    <select id="shopSalesTotal" resultType="java.math.BigDecimal">
        SELECT IFNULL(SUM(pay_money),0)
        FROM t_order
        WHERE o.del_flag = 0
        WHERE del_flag = 0
        <if test="param.shopId != null and param.shopId != ''">
            AND shop_id = #{param.shopId}
        </if>
@@ -1363,4 +1378,40 @@
        FROM t_order
        WHERE del_flag = 0 AND shop_id = #{shopId}
    </select>
    <select id="pageMgtShopAllOrder" resultMap="mgtShopAllOrderResultMap">
        SELECT
        toc.order_id orderId,
        toc.order_no orderNo,
        toc.user_id userId,
        tog.goods_name goodsName,
        tog.buy_num buyNum,
        toc.order_money orderMoney,
        toc.discount_money discountMoney,
        toc.receivable_money receivableMoney,
        toc.pay_money payMoney,
        CASE toc.order_from WHEN 1 THEN '小程序' WHEN 2 THEN CONCAT('秒杀活动(',toc.activity_name,')') WHEN 3 THEN '线下创建' END orderFrom
        FROM t_order toc
        INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id
        WHERE toc.del_flag = 0 AND (toc.order_from = 1 OR toc.order_from = 3)
        <if test="param.orderFrom != null">
            AND toc.order_from = #{param.orderFrom}
        </if>
        <if test="param.orderStatus != null">
            AND toc.order_status = #{param.orderStatus}
        </if>
        <if test="param.orderNo != null and param.orderNo !=''">
            AND toc.order_no LIKE CONCAT('%',#{param.orderNo},'%')
        </if>
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId}
        </if>
        <if test="param.startOrderDate != null and param.startOrderDate != '' ">
            AND toc.create_time &gt;= #{param.startOrderDate}
        </if>
        <if test="param.endOrderDate != null and param.endOrderDate != '' ">
            AND toc.create_time &lt;= #{param.endOrderDate}
        </if>
        ORDER BY toc.create_time DESC
    </select>
</mapper>