From 9ca97fd558700e7054c5f54192a9db7a1e6b8230 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期三, 11 九月 2024 16:31:47 +0800 Subject: [PATCH] 完善导出等接口 --- ruoyi-system/src/main/resources/mapper/system/TOrderMealMapper.xml | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 118 insertions(+), 0 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/TOrderMealMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TOrderMealMapper.xml index 5db7eb4..87a82ee 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TOrderMealMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TOrderMealMapper.xml @@ -230,5 +230,123 @@ </where> ORDER BY tom.createTime DESC </select> + <select id="mealGeneratorListExport" resultType="com.ruoyi.system.vo.TDataGeneratorVO"> + select tdg.id, tdg.userId, tdg.userName, tdg.shopId, tdg.startTime, tdg.endTime, tdg.minMoney, tdg.maxMoney, tdg.status, tdg.createTime, + tdg.updateTime, tdg.disabled, tdg.createBy, tdg.updateBy,tdg.orderType,tdg.weiXinPay,tdg.aliPay,tdg.cardPay,tdg.moneyPay,tdg.otherPay, + ts.shopName + from t_data_generator tdg + left join t_shop ts on tdg.shopId = ts.id + <where> + <if test="query.shopName != null and query.shopName != ''"> + and ts.shopName like concat('%', #{query.shopName}, '%') + </if> + <if test="query.userName != null and query.userName != ''"> + and tdg.shopName like concat('%', #{query.userName}, '%') + </if> + <if test="query.status != null"> + and tdg.status = #{query.status} + </if> + <if test="query.ids != null and query.ids.size()>0"> + and tdg.id IN + <foreach collection="query.ids" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </if> + <if test="query.orderType != null"> + and tdg.orderType = #{query.orderType} + </if> + <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> + AND (tdg.createTime BETWEEN #{query.startTime} AND #{query.endTime}) + </if> + AND tdg.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + and tdg.orderType = 1 + </where> + </select> + <select id="profitDetails" resultType="com.ruoyi.system.vo.GoodsProfitVO"> + SELECT + tomg.goodsName, + tomg.typeName, + IFNULL(SUM( tomg.goodsCount ),0) AS totalSalesCount, + IFNULL(SUM( tomg.goodsCount * tomg.goodsSalePrice ),0) AS goodsSaleAmount, + IFNULL(SUM( tomg.goodsCount * tomg.costPrice ),0) AS goodsCostAmount, + IFNULL(SUM(tomg.goodsCount *(tomg.goodsSalePrice - tomg.costPrice)),0) AS goodsProfitAmount + FROM t_order_meal_goods tomg + LEFT JOIN t_order_meal tom ON tom.id = tomg.orderId + <where> + <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> + AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime}) + </if> + <if test="query.goodsName != null and query.goodsName != ''"> + AND tomg.goodsName like concat('%', #{query.goodsName}, '%') + </if> + <if test="query.typeId != null and query.typeId != ''"> + AND tomg.typeId = #{query.typeId} + </if> + <if test="query.shopId != null"> + AND tom.shopId = #{query.shopId} + </if> + AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + </where> + GROUP BY tomg.goodsName + </select> + <select id="profitDetailsStatistics" resultType="java.util.Map"> + SELECT + IFNULL(SUM(a.goodsSaleAmount),0) AS totalSales, + IFNULL(SUM(a.goodsCostAmount),0) AS totalCosts, + IFNULL(SUM(a.goodsProfitAmount),0) AS totalProfits + FROM ( + SELECT + tomg.goodsName, + tomg.typeName, + IFNULL(SUM( tomg.goodsCount ),0) AS totalSalesCount, + IFNULL(SUM( tomg.goodsCount * tomg.goodsSalePrice ),0) AS goodsSaleAmount, + IFNULL(SUM( tomg.goodsCount * tomg.costPrice ),0) AS goodsCostAmount, + IFNULL(SUM(tomg.goodsCount *(tomg.goodsSalePrice - tomg.costPrice)),0) AS goodsProfitAmount + FROM t_order_meal_goods tomg + LEFT JOIN t_order_meal tom ON tom.id = tomg.orderId + <where> + <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> + AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime}) + </if> + <if test="query.goodsName != null and query.goodsName != ''"> + AND tomg.goodsName like concat('%', #{query.goodsName}, '%') + </if> + <if test="query.typeId != null and query.typeId != ''"> + AND tomg.typeId = #{query.typeId} + </if> + <if test="query.shopId != null"> + AND tom.shopId = #{query.shopId} + </if> + AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + </where> + GROUP BY tomg.goodsName) a + </select> + <select id="profitDetailsExport" resultType="com.ruoyi.system.vo.GoodsProfitVO"> + SELECT + tomg.goodsName, + tomg.typeName, + IFNULL(SUM( tomg.goodsCount ),0) AS totalSalesCount, + IFNULL(SUM( tomg.goodsCount * tomg.goodsSalePrice ),0) AS goodsSaleAmount, + IFNULL(SUM( tomg.goodsCount * tomg.costPrice ),0) AS goodsCostAmount, + IFNULL(SUM(tomg.goodsCount *(tomg.goodsSalePrice - tomg.costPrice)),0) AS goodsProfitAmount + FROM t_order_meal_goods tomg + LEFT JOIN t_order_meal tom ON tom.id = tomg.orderId + <where> + <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> + AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime}) + </if> + <if test="query.goodsName != null and query.goodsName != ''"> + AND tomg.goodsName like concat('%', #{query.goodsName}, '%') + </if> + <if test="query.typeId != null and query.typeId != ''"> + AND tomg.typeId = #{query.typeId} + </if> + <if test="query.shopId != null"> + AND tom.shopId = #{query.shopId} + </if> + AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + </where> + GROUP BY tomg.goodsName + </select> </mapper> -- Gitblit v1.7.1