jiangqs
2023-07-04 9c6fd541f0aa8e384c26998597a6788bb77eca8d
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -735,7 +735,7 @@
            AND toc.create_time <= #{param.endDate}
        </if>
        GROUP BY toc.order_from
        ORDER BY SUM(toc.order_money) DESC LIMIT 10
        ORDER BY SUM(toc.order_money) DESC LIMIT 15
    </select>
    <select id="getTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtTotalActivityTotalVo">
@@ -1258,4 +1258,98 @@
            AND create_time &lt;= #{param.endDate}
        </if>
    </select>
    <select id="listMerOrderDistributionTotal" resultType="com.ruoyi.order.domain.vo.MgtMapTotalPlusVo">
        SELECT
        COUNT(order_id) AS mapValueFirst,
        IFNULL(SUM(order_money),0) AS mapValueSecond
        FROM t_order
        WHERE del_flag = 0 AND user_id IN
        <foreach collection="userIdList" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="listMerOrderTotalGoodsType" resultType="com.ruoyi.order.domain.vo.MgtMapTotalPlusVo">
        SELECT
        tog.goods_type mapKey,
        COUNT(DISTINCT toc.order_id) AS mapValueFirst,
        IFNULL(SUM(tog.goods_total_money),0) AS mapValueSecond
        FROM
        t_order toc
        INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id
        WHERE toc.del_flag = 0
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId}
        </if>
        <if test="param.shopIdList != null and param.shopIdList.size() > 0">
            AND toc.shop_id IN
            <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="param.startDate!=null and param.startDate!=''">
            AND toc.create_time &gt;= #{param.startDate}
        </if>
        <if test="param.endDate!=null and param.endDate!=''">
            AND toc.create_time &lt;= #{param.endDate}
        </if>
        GROUP BY tog.goods_type
    </select>
    <select id="listMerOrderTotalGoodsRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo">
        SELECT
        tog.goods_name mapKey,
        IFNULL(SUM(tog.goods_total_money),0) mapValue
        FROM t_order toc
        INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id
        WHERE toc.del_flag = 0
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId}
        </if>
        <if test="param.shopIdList != null and param.shopIdList.size() > 0">
            AND toc.shop_id IN
            <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="param.startDate!=null and param.startDate!=''">
            AND toc.create_time &gt;= #{param.startDate}
        </if>
        <if test="param.endDate!=null and param.endDate!=''">
            AND toc.create_time &lt;= #{param.endDate}
        </if>
        GROUP BY tog.goods_name
        ORDER BY SUM(tog.goods_total_money) DESC LIMIT 10
    </select>
    <select id="listMerOrderTotalOrderFrom" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo">
        SELECT
        CASE toc.order_from
        WHEN 1 THEN "商城订单"
        WHEN 2 THEN "秒杀活动订单"
        WHEN 3 THEN "线下创建订单"
        END mapKey,
        IFNULL(SUM(toc.order_money),0) mapValue
        FROM t_order toc
        WHERE toc.del_flag = 0
        <if test="param.shopId != null and param.shopId != ''">
            AND toc.shop_id = #{param.shopId}
        </if>
        <if test="param.shopIdList != null and param.shopIdList.size() > 0">
            AND toc.shop_id IN
            <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="param.startDate!=null and param.startDate!=''">
            AND toc.create_time &gt;= #{param.startDate}
        </if>
        <if test="param.endDate!=null and param.endDate!=''">
            AND toc.create_time &lt;= #{param.endDate}
        </if>
        GROUP BY toc.order_from
        ORDER BY SUM(toc.order_money) DESC LIMIT 15
    </select>
</mapper>