|
@@ -0,0 +1,802 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.ruixuan.isc.mapper.KwaiXiaoDianReportMapper">
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getSumInfo" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) AS 'orderNumRate',
|
|
|
+ round((t.totalFee - tt.totalFee) / tt.totalFee * 100, 2) AS 'totalFeeRate',
|
|
|
+ t.*,ttt.*
|
|
|
+ FROM (
|
|
|
+ SELECT COUNT(t1.oid) AS 'orderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END), 0) AS 'validOrderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
|
|
|
+ round(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END) / COUNT(t1.oid) * 100,2) AS
|
|
|
+ 'validRadio',
|
|
|
+ SUM(CASE WHEN t1.status >= 40 AND t1.status < 80 THEN 1 ELSE 0 END) AS 'deliveryNum',
|
|
|
+ ifnull(
|
|
|
+ round(sum(case when t1.status >= 40 and t1.status < 80 then 1 else 0 end) /
|
|
|
+ sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2),
|
|
|
+ 0) AS 'deliveryRate',
|
|
|
+ SUM(CASE WHEN t1.status = 30 THEN 1 ELSE 0 END) AS 'notDeliveryNum',
|
|
|
+ round(SUM(t1.express_fee) / 100, 2) AS 'expressFee',
|
|
|
+ SUM(CASE WHEN t2.item_type = 1 THEN 1 ELSE 0 END) AS 'zxOrderNUm',
|
|
|
+ SUM(CASE WHEN t2.item_type = 2 THEN 1 ELSE 0 END) AS 'tpOrderNUm',
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee',
|
|
|
+
|
|
|
+ round(sum(case
|
|
|
+ when t1.status != 80 and t1.status != 10 then t1.total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'validTotalFee',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then t1.total_fee else 0 end) / sum(t1.total_fee) *
|
|
|
+ 100,
|
|
|
+ 2) as 'validTotalFeeRadio',
|
|
|
+ round(sum(case when t2.item_type = 1 then t1.total_fee else 0 end) / 1000000,2) as 'zxTotalFee',
|
|
|
+ round(sum(case when t2.item_type = 2 then t1.total_fee else 0 end) / 1000000, 2) as 'tpTotalFee',
|
|
|
+ COUNT(DISTINCT t1.item_id) AS 'itemCount',
|
|
|
+ COUNT(DISTINCT
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN t2.item_type = 1
|
|
|
+ THEN t1.item_id
|
|
|
+ END
|
|
|
+ )
|
|
|
+ ) AS 'zxOrderCount',
|
|
|
+ COUNT(DISTINCT
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN t2.item_type = 2
|
|
|
+ THEN t1.item_id
|
|
|
+ END
|
|
|
+ )
|
|
|
+ ) AS 'tpOrderCount'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ WHERE t1.stat_date >= #{start}
|
|
|
+ AND t1.stat_date <= #{end}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND t1.item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ ) t
|
|
|
+ JOIN (
|
|
|
+ SELECT COUNT(t1.oid) AS 'orderNum',
|
|
|
+ round(SUM(t1.total_fee) / 100, 2) AS 'totalFee'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ WHERE t1.stat_date >= #{lastStart}
|
|
|
+ AND t1.stat_date <= #{lastEnd}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND t1.item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) tt join (
|
|
|
+ SELECT
|
|
|
+ ifnull( round(sum(case when t1.status >= 40 and t1.status < 80 then t1.total_fee else 0 end) / 100, 2),0) as
|
|
|
+ 'estimatedIncome',
|
|
|
+ ifnull(round(sum(case when t1.status >= 40 and t1.status < 80 and t2.item_type = 1 then t1.total_fee else 0
|
|
|
+ end) / 100 , 2), 0 ) as 'zxEstimatedIncome',
|
|
|
+ ifnull(round(sum(case when t1.status >= 40 and t1.status < 80 and t2.item_type = 2 then t1.total_fee else 0
|
|
|
+ end) / 100 , 2),0) as 'tpEstimatedIncome'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1 LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ WHERE t1.send_time >= #{start}
|
|
|
+ AND t1.send_time <= #{end}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND t1.item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ ) ttt
|
|
|
+ </select>
|
|
|
+ <select id="getMonthInfo" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) AS 'orderNumRate',
|
|
|
+ round((t.totalFee - tt.totalFee) / tt.totalFee * 100, 2) AS 'totalFeeRate', t.* from(
|
|
|
+ select count(t1.oid) as 'orderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status != 80 and t1.status != 10 THEN 1 ELSE 0 END),
|
|
|
+ 0) AS 'validOrderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) / count(t1.oid) * 100,
|
|
|
+ 2) as 'validRadio',
|
|
|
+ sum(case when t1.status >= 40 and t1.status < 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ ifnull(
|
|
|
+ round(sum(case when t1.status >= 40 and t1.status < 80 then 1 else 0 end) /
|
|
|
+ sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2),
|
|
|
+ 0) as 'deliveryRate',
|
|
|
+ sum(case when t1.status = 30 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(t1.express_fee) / 100, 2) as 'expressFee',
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee',
|
|
|
+ round(sum(case
|
|
|
+ when t1.status != 80 and t1.status != 10 then t1.total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'validTotalFee',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then t1.total_fee else 0 end) / sum(t1.total_fee) *
|
|
|
+ 100,
|
|
|
+ 2) as 'validTotalFeeRadio',
|
|
|
+
|
|
|
+ count(distinct t1.item_id) as 'itemCount'
|
|
|
+ from kwaixiaodian_order_cursor_list t1
|
|
|
+ where t1.stat_date >= #{monthStart}
|
|
|
+ AND t1.stat_date <= #{monthEnd}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND t1.item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) t join (
|
|
|
+ select count(t1.oid) as 'orderNum',
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee'
|
|
|
+ from kwaixiaodian_order_cursor_list t1
|
|
|
+ where t1.stat_date >= #{lastMonthStart}
|
|
|
+ AND t1.stat_date <= #{lastMonthEnd}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND t1.item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) tt
|
|
|
+ </select>
|
|
|
+ <select id="getEchartData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select date_format(stat_date, '%m-%d') as 'date',
|
|
|
+ count(oid) as 'orderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN status != 80 and status != 10 THEN 1 ELSE 0 END),
|
|
|
+ 0) AS 'validOrderNum',
|
|
|
+ round(sum(case
|
|
|
+ when status != 80 and status != 10 then total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'validTotalFee',
|
|
|
+ count(distinct item_id) as 'itemCount'
|
|
|
+ from kwaixiaodian_order_cursor_list
|
|
|
+ where stat_date >= #{echartStart}
|
|
|
+ and stat_date <= #{echartEnd}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by stat_date
|
|
|
+ order by stat_date asc
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="getGmvHours" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select stat_hour as 'time',
|
|
|
+ round(sum(case
|
|
|
+ when status != 80 and status != 10 then total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'charge'
|
|
|
+ from kwaixiaodian_order_cursor_list
|
|
|
+ where stat_date = #{date}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by stat_hour
|
|
|
+ order by stat_hour
|
|
|
+ </select>
|
|
|
+ <select id="getShopListData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) AS 'orderNumRate',
|
|
|
+ t.*
|
|
|
+ from (SELECT t1.shop_id as 'shopId',
|
|
|
+ t2.shop_name as 'shopName',
|
|
|
+ t2.master_score as 'masterScore',
|
|
|
+ t2.shop_score as 'shopScore',
|
|
|
+ COUNT(t1.oid) AS 'orderNum',
|
|
|
+ IFNULL(
|
|
|
+ SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END),
|
|
|
+ 0) AS 'validOrderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
|
|
|
+ round(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END) / COUNT(t1.oid) * 100, 2) AS
|
|
|
+ 'validRadio',
|
|
|
+ SUM(CASE
|
|
|
+ WHEN t1.status >= 40 AND t1.status
|
|
|
+ <
|
|
|
+ 80 THEN 1
|
|
|
+ ELSE 0 END) AS 'deliveryNum',
|
|
|
+ ifnull(
|
|
|
+ round(sum(case when t1.status >= 40 and t1.status
|
|
|
+ <
|
|
|
+ 80 then 1 else 0 end) /
|
|
|
+ sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2),
|
|
|
+ 0) AS 'deliveryRate',
|
|
|
+ SUM(CASE WHEN t1.status = 30 THEN 1 ELSE 0 END) AS 'notDeliveryNum',
|
|
|
+ round(SUM(t1.express_fee) / 100, 2) AS 'expressFee',
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee',
|
|
|
+ round(sum(case
|
|
|
+ when t1.status != 80 and t1.status != 10 then t1.total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'validTotalFee',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then t1.total_fee else 0 end) / sum(t1.total_fee) *
|
|
|
+ 100,
|
|
|
+ 2) as 'validTotalFeeRadio',
|
|
|
+ COUNT(DISTINCT t1.item_id) AS 'itemCount'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_shop_score t2
|
|
|
+ ON t1.shop_id = t2.shop_id
|
|
|
+ WHERE t1.stat_date >= #{start}
|
|
|
+ AND t1.stat_date <= #{end}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND t1.item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by t1.shop_id) t
|
|
|
+ left join (SELECT t1.shop_id as 'shopId',
|
|
|
+ COUNT(t1.oid) AS 'orderNum'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ WHERE t1.stat_date >= #{lastStart}
|
|
|
+ AND t1.stat_date <= #{lastEnd}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='itemIds != null and itemIds.size() > 0'>
|
|
|
+ AND t1.item_it in
|
|
|
+ <foreach collection="itemIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by t1.shop_id) tt on t.shopId = tt.shopId
|
|
|
+ order by t.orderNum desc
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="getTeamList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT * from(
|
|
|
+ select
|
|
|
+ '1' as 'type',
|
|
|
+ round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) AS 'orderNumRate',
|
|
|
+ t.*,
|
|
|
+ ifnull((select user.nick_name
|
|
|
+ from sys_user user
|
|
|
+ left join sys_user_role userRole on user.user_id = userRole.user_id
|
|
|
+ left join sys_role role on userRole.role_id = role.role_id
|
|
|
+ where user.dept_id = t.deptId
|
|
|
+ and role.role_key in (
|
|
|
+ 'industry_sale_manager', 'industry_courtship_manager', 'industry_purchase_manager'
|
|
|
+ )
|
|
|
+ and user.status = 0
|
|
|
+ limit 1),'-') as 'leaderName'
|
|
|
+ from (SELECT t3.dept_id as 'deptId',
|
|
|
+ t4.dept_name as 'deptName',
|
|
|
+ count(distinct t2.user_id) as 'userCount',
|
|
|
+ COUNT(t1.oid) AS 'orderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END),
|
|
|
+ 0) AS 'validOrderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
|
|
|
+ round(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END) / COUNT(t1.oid) * 100, 2) AS
|
|
|
+ 'validRadio',
|
|
|
+ SUM(CASE
|
|
|
+ WHEN t1.status >= 40 AND t1.status
|
|
|
+ <
|
|
|
+ 80 THEN 1
|
|
|
+ ELSE 0 END) AS 'deliveryNum',
|
|
|
+ ifnull(
|
|
|
+ round(sum(case
|
|
|
+ when t1.status >= 40 and t1.status
|
|
|
+ <
|
|
|
+ 80 then 1
|
|
|
+ else 0 end) /
|
|
|
+ sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2),
|
|
|
+ 0) AS 'deliveryRate',
|
|
|
+ SUM(CASE WHEN t1.status = 30 THEN 1 ELSE 0 END) AS 'notDeliveryNum',
|
|
|
+ round(SUM(t1.express_fee) / 100, 2) AS 'expressFee',
|
|
|
+ SUM(CASE WHEN t2.item_type = 1 THEN 1 ELSE 0 END) AS 'zxOrderNUm',
|
|
|
+ SUM(CASE WHEN t2.item_type = 2 THEN 1 ELSE 0 END) AS 'tpOrderNUm',
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee',
|
|
|
+
|
|
|
+ round(sum(case
|
|
|
+ when t1.status != 80 and t1.status != 10 then t1.total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'validTotalFee',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then t1.total_fee else 0 end) / sum(t1.total_fee) *
|
|
|
+ 100,
|
|
|
+ 2) as 'validTotalFeeRadio',
|
|
|
+ round(sum(case when t2.item_type = 1 then t1.total_fee else 0 end) / 1000000,
|
|
|
+ 2) as 'zxTotalFee',
|
|
|
+ round(sum(case when t2.item_type = 2 then t1.total_fee else 0 end) / 1000000,
|
|
|
+ 2) as 'tpTotalFee',
|
|
|
+ COUNT(DISTINCT t1.item_id) AS 'itemCount',
|
|
|
+ COUNT(DISTINCT
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN t2.item_type = 1
|
|
|
+ THEN t1.item_id
|
|
|
+ END
|
|
|
+ )
|
|
|
+ ) AS 'zxOrderCount',
|
|
|
+ COUNT(DISTINCT
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN t2.item_type = 2
|
|
|
+ THEN t1.item_id
|
|
|
+ END
|
|
|
+ )
|
|
|
+ ) AS 'tpOrderCount'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ left join sys_user t3 on t2.user_id = t3.user_id
|
|
|
+ left join sys_dept t4 on t3.dept_id = t4.dept_id
|
|
|
+ WHERE t1.stat_date >= #{start}
|
|
|
+ AND t1.stat_date <= #{end}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='userIds != null and userIds.size() > 0'>
|
|
|
+ AND t2.user_id in
|
|
|
+ <foreach collection="userIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ and t3.dept_id is not null
|
|
|
+ group by t3.dept_id) t
|
|
|
+ left join (SELECT t3.dept_id as 'deptId',
|
|
|
+ COUNT(t1.oid) AS 'orderNum'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ left join sys_user t3 on t2.user_id = t3.user_id
|
|
|
+ left join sys_dept t4 on t3.dept_id = t4.dept_id
|
|
|
+ WHERE t1.stat_date >= #{lastStart}
|
|
|
+ AND t1.stat_date <= #{lastEnd}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='userIds != null and userIds.size() > 0'>
|
|
|
+ AND t2.user_id in
|
|
|
+ <foreach collection="userIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and t3.dept_id is not null
|
|
|
+ group by t3.dept_id) tt on t.deptId = tt.deptId
|
|
|
+ union all
|
|
|
+ select
|
|
|
+ '2' as 'type',
|
|
|
+ round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) AS 'orderNumRate',
|
|
|
+ t.*,
|
|
|
+
|
|
|
+ ifnull((select user.nick_name
|
|
|
+ from sys_user user
|
|
|
+ left join sys_user_role userRole on user.user_id = userRole.user_id
|
|
|
+ left join sys_role role on userRole.role_id = role.role_id
|
|
|
+ where user.dept_id = t.deptId
|
|
|
+ and role.role_key in (
|
|
|
+ 'industry_sale_manager', 'industry_courtship_manager', 'industry_purchase_manager'
|
|
|
+ )
|
|
|
+ and user.status = 0
|
|
|
+ limit 1),'-') as 'leaderName'
|
|
|
+ from (SELECT t3.dept_id as 'deptId',
|
|
|
+ t4.dept_name as 'deptName',
|
|
|
+ count(distinct t2.courtship_purchase_id) as 'userCount',
|
|
|
+ COUNT(t1.oid) AS 'orderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END),
|
|
|
+ 0) AS 'validOrderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
|
|
|
+ round(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END) / COUNT(t1.oid) * 100, 2) AS
|
|
|
+ 'validRadio',
|
|
|
+ SUM(CASE
|
|
|
+ WHEN t1.status >= 40 AND t1.status
|
|
|
+ <
|
|
|
+ 80 THEN 1
|
|
|
+ ELSE 0 END) AS 'deliveryNum',
|
|
|
+ ifnull(
|
|
|
+ round(sum(case
|
|
|
+ when t1.status >= 40 and t1.status
|
|
|
+ <
|
|
|
+ 80 then 1
|
|
|
+ else 0 end) /
|
|
|
+ sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2),
|
|
|
+ 0) AS 'deliveryRate',
|
|
|
+ SUM(CASE WHEN t1.status = 30 THEN 1 ELSE 0 END) AS 'notDeliveryNum',
|
|
|
+ round(SUM(t1.express_fee) / 100, 2) AS 'expressFee',
|
|
|
+ SUM(CASE WHEN t2.item_type = 1 THEN 1 ELSE 0 END) AS 'zxOrderNUm',
|
|
|
+ SUM(CASE WHEN t2.item_type = 2 THEN 1 ELSE 0 END) AS 'tpOrderNUm',
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee',
|
|
|
+ round(sum(case
|
|
|
+ when t1.status != 80 and t1.status != 10 then t1.total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'validTotalFee',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then t1.total_fee else 0 end) / sum(t1.total_fee) *
|
|
|
+ 100,
|
|
|
+ 2) as 'validTotalFeeRadio',
|
|
|
+ round(sum(case when t2.item_type = 1 then t1.total_fee else 0 end) / 1000000,
|
|
|
+ 2) as 'zxTotalFee',
|
|
|
+ round(sum(case when t2.item_type = 2 then t1.total_fee else 0 end) / 1000000,
|
|
|
+ 2) as 'tpTotalFee',
|
|
|
+ COUNT(DISTINCT t1.item_id) AS 'itemCount',
|
|
|
+ COUNT(DISTINCT
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN t2.item_type = 1
|
|
|
+ THEN t1.item_id
|
|
|
+ END
|
|
|
+ )
|
|
|
+ ) AS 'zxOrderCount',
|
|
|
+ COUNT(DISTINCT
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN t2.item_type = 2
|
|
|
+ THEN t1.item_id
|
|
|
+ END
|
|
|
+ )
|
|
|
+ ) AS 'tpOrderCount'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ left join sys_user t3 on t2.courtship_purchase_id = t3.user_id
|
|
|
+ left join sys_dept t4 on t3.dept_id = t4.dept_id
|
|
|
+ WHERE t1.stat_date >= #{start}
|
|
|
+ AND t1.stat_date <= #{end}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='userIds != null and userIds.size() > 0'>
|
|
|
+ AND t2.courtship_purchase_id in
|
|
|
+ <foreach collection="userIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ and t3.dept_id is not null
|
|
|
+ group by t3.dept_id) t
|
|
|
+ left join (SELECT t3.dept_id as 'deptId',
|
|
|
+ COUNT(t1.oid) AS 'orderNum'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ left join sys_user t3 on t2.courtship_purchase_id = t3.user_id
|
|
|
+ left join sys_dept t4 on t3.dept_id = t4.dept_id
|
|
|
+ WHERE t1.stat_date >= #{lastStart}
|
|
|
+ AND t1.stat_date <= #{lastEnd}
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='userIds != null and userIds.size() > 0'>
|
|
|
+ AND t2.courtship_purchase_id in
|
|
|
+ <foreach collection="userIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and t3.dept_id is not null
|
|
|
+ group by t3.dept_id) tt on t.deptId = tt.deptId
|
|
|
+ ) team order by team.orderNum desc
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="getItemInfo" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT
|
|
|
+ ifnull(SUM(CASE WHEN item_type = 1 THEN 1 ELSE 0 END),'-') AS 'zxOrderNum',
|
|
|
+ ifnull(SUM(CASE WHEN item_type = 2 THEN 1 ELSE 0 END) ,'-') AS 'tpOrderNum'
|
|
|
+ FROM kwaixiaodian_item_get
|
|
|
+ WHERE 1 = 1
|
|
|
+ AND data_create_time >= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
|
|
|
+ %H:%i:%s')
|
|
|
+ AND data_create_time <= str_to_date(concat(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d %H:%i:%s')
|
|
|
+ <if test='userIds != null and userIds.size() > 0'>
|
|
|
+ AND user_id in
|
|
|
+ <foreach collection="userIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test='courtshipPurchaseIds != null and courtshipPurchaseIds.size() > 0'>
|
|
|
+ AND courtship_purchase_id in
|
|
|
+ <foreach collection="courtshipPurchaseIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="getUserListByDeptId" resultType="java.lang.Long"
|
|
|
+ parameterType="java.lang.Long">
|
|
|
+ SELECT user_id
|
|
|
+ FROM sys_user
|
|
|
+ WHERE dept_id = #{deptId}
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="getTeamDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select
|
|
|
+ t.*,
|
|
|
+ round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) AS 'orderNumRate',
|
|
|
+ ifnull(ttt.zxOrderNum,'-') as 'zxOrderNum',
|
|
|
+ ifnull(ttt.tpOrderNum,'-') as 'tpOrderNum'
|
|
|
+ from (SELECT t3.user_id as 'userId',
|
|
|
+ t3.nick_name as 'userName',
|
|
|
+ COUNT(t1.oid) AS 'orderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END),
|
|
|
+ 0) AS 'validOrderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
|
|
|
+ round(SUM(CASE WHEN t1.status != 80 AND t1.status != 10 THEN 1 ELSE 0 END) / COUNT(t1.oid) * 100, 2) AS
|
|
|
+ 'validRadio',
|
|
|
+ SUM(CASE
|
|
|
+ WHEN t1.status >= 40 AND t1.status
|
|
|
+ <
|
|
|
+ 80 THEN 1
|
|
|
+ ELSE 0 END) AS 'deliveryNum',
|
|
|
+ ifnull(
|
|
|
+ round(sum(case
|
|
|
+ when t1.status >= 40 and t1.status
|
|
|
+ <
|
|
|
+ 80 then 1
|
|
|
+ else 0 end) /
|
|
|
+ sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2),
|
|
|
+ 0) AS 'deliveryRate',
|
|
|
+ SUM(CASE WHEN t1.status = 30 THEN 1 ELSE 0 END) AS 'notDeliveryNum',
|
|
|
+ round(SUM(t1.express_fee) / 100, 2) AS 'expressFee',
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee',
|
|
|
+
|
|
|
+ round(sum(case
|
|
|
+ when t1.status != 80 and t1.status != 10 then t1.total_fee
|
|
|
+ else 0 end) / 100,
|
|
|
+ 2) as 'validTotalFee',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then t1.total_fee else 0 end) / sum(t1.total_fee) *
|
|
|
+ 100,
|
|
|
+ 2) as 'validTotalFeeRadio',
|
|
|
+ round(sum(case when t2.item_type = 1 then t1.total_fee else 0 end) / 1000000,
|
|
|
+ 2) as 'zxTotalFee',
|
|
|
+ round(sum(case when t2.item_type = 2 then t1.total_fee else 0 end) / 1000000,
|
|
|
+ 2) as 'tpTotalFee',
|
|
|
+ COUNT(DISTINCT t1.item_id) AS 'itemCount'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ left join sys_user t3
|
|
|
+ <if test="type == '1'.toString()">
|
|
|
+ on t2.user_id = t3.user_id
|
|
|
+ </if>
|
|
|
+ <if test="type == '2'.toString()">
|
|
|
+ on t2.courtship_purchase_id = t3.user_id
|
|
|
+ </if>
|
|
|
+
|
|
|
+ WHERE t1.stat_date >= #{start}
|
|
|
+ AND t1.stat_date <= #{end}
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='userId != null and userId != ""'>
|
|
|
+ and t2.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ and t3.dept_id = #{deptId}
|
|
|
+ group by t3.user_id) t
|
|
|
+ left join (SELECT t3.user_id as 'userId',
|
|
|
+ COUNT(t1.oid) AS 'orderNum'
|
|
|
+ FROM kwaixiaodian_order_cursor_list t1
|
|
|
+ LEFT JOIN kwaixiaodian_item_get t2
|
|
|
+ ON t1.company_id = t2.company_id AND t1.item_id = t2.item_id
|
|
|
+ left join sys_user t3
|
|
|
+ <if test="type == '1'.toString()">
|
|
|
+ on t2.user_id = t3.user_id
|
|
|
+ </if>
|
|
|
+ <if test="type == '2'.toString()">
|
|
|
+ on t2.courtship_purchase_id = t3.user_id
|
|
|
+ </if>
|
|
|
+ WHERE t1.stat_date >= #{lastStart}
|
|
|
+ AND t1.stat_date <= #{lastEnd}
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='userId != null and userId != ""'>
|
|
|
+ and t2.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ and t3.dept_id = #{deptId}
|
|
|
+ group by t3.user_id) tt on t.userId = tt.userId
|
|
|
+ <if test="type == '1'.toString()">
|
|
|
+ left join (
|
|
|
+ select t1.user_id as 'userId',
|
|
|
+ SUM(CASE WHEN t1.item_type = 1 THEN 1 ELSE 0 END) AS 'zxOrderNum',
|
|
|
+ SUM(CASE WHEN t1.item_type = 2 THEN 1 ELSE 0 END) AS 'tpOrderNum'
|
|
|
+ from kwaixiaodian_item_get t1
|
|
|
+ left join sys_user t2 on t1.user_id = t2.user_id
|
|
|
+ where t2.dept_id = #{deptId}
|
|
|
+ AND t1.data_create_time >= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
|
|
|
+ %H:%i:%s')
|
|
|
+ AND t1.data_create_time <= str_to_date(concat(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d
|
|
|
+ %H:%i:%s')
|
|
|
+ <if test='userId != null and userId != ""'>
|
|
|
+ and t1.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ group by t1.user_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="type == '2'.toString()">
|
|
|
+ left join (
|
|
|
+ select t1.courtship_purchase_id as 'userId',
|
|
|
+ (CASE WHEN t1.item_type = 1 THEN 1 ELSE 0 END) AS 'zxOrderNum',
|
|
|
+ SUM(CASE WHEN t1.item_type = 2 THEN 1 ELSE 0 END) AS 'tpOrderNum'
|
|
|
+ from kwaixiaodian_item_get t1
|
|
|
+ left join sys_user t2 on t1.courtship_purchase_id = t2.user_id
|
|
|
+ where t2.dept_id = #{deptId}
|
|
|
+ AND t1.data_create_time >= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
|
|
|
+ %H:%i:%s')
|
|
|
+ AND t1.data_create_time <= str_to_date(concat(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d
|
|
|
+ %H:%i:%s')
|
|
|
+ <if test='userId != null and userId != ""'>
|
|
|
+ and t1.courtship_purchase_id = #{userId}
|
|
|
+ </if>
|
|
|
+ group by t1.courtship_purchase_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ ttt on t.userId = ttt.userId
|
|
|
+ order by t.orderNum desc
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="getItemList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select t1.*,
|
|
|
+ round((t1.orderNum - t2.orderNum) / t2.orderNum * 100, 2) as 'orderNumRate'
|
|
|
+ from (
|
|
|
+ select ifnull(t2.user_name,'-') as 'userName',
|
|
|
+ ifnull(t2.courtship_purchase_name,'-') as 'courtshipPurchaseName',
|
|
|
+ (
|
|
|
+ CASE when t2.item_type = 1
|
|
|
+ then '自选品'
|
|
|
+ when t2.item_type = 2
|
|
|
+ then '推品'
|
|
|
+ else '-'
|
|
|
+ end
|
|
|
+ ) as 'itemType',
|
|
|
+ t1.item_id as itemId,
|
|
|
+ t1.item_title as 'itemTitle',
|
|
|
+ t1.item_pic_url as 'itemPicUrl',
|
|
|
+ (case
|
|
|
+ when min(t1.price) = max(t1.price)
|
|
|
+ then concat(round(min(t1.price) / 100, 2), '元')
|
|
|
+ else concat(round(min(t1.price) / 100, 2), '~', round(max(t1.price) / 100, 2), '元')
|
|
|
+ end
|
|
|
+ ) as price,
|
|
|
+ round(sum(t1.total_fee) / 100, 2) as 'totalFee',
|
|
|
+ IFNULL(round(SUM(CASE WHEN t1.status != 80 and t1.status != 10 THEN t1.total_fee ELSE 0 END) / 100, 2), 0) as
|
|
|
+ 'validTotalFee',
|
|
|
+ count(t1.oid) as 'orderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status != 80 and t1.status != 10 THEN 1 ELSE 0 END), 0) AS 'validOrderNum',
|
|
|
+ IFNULL(SUM(CASE WHEN t1.status = 80 THEN 1 ELSE 0 END), 0) AS 'effOrderNum',
|
|
|
+ round(sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) / count(t1.oid) * 100,
|
|
|
+ 2) as 'validRadio',
|
|
|
+ sum(case when t1.status >= 40 and t1.status < 80 then 1 else 0 end) as 'deliveryNum',
|
|
|
+ round(sum(case when t1.status >= 40 and t1.status < 80 then 1 else 0 end) /
|
|
|
+ sum(case when t1.status != 80 and t1.status != 10 then 1 else 0 end) * 100, 2) as 'deliveryRate',
|
|
|
+ sum(case when t1.status = 30 then 1 else 0 end) as 'notDeliveryNum',
|
|
|
+ round(sum(t1.express_fee) / 100, 2) as 'expressFee'
|
|
|
+ from kwaixiaodian_order_cursor_list t1
|
|
|
+ left join kwaixiaodian_item_get t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ and t1.company_id = t2.company_id
|
|
|
+ where t1.stat_date >= #{start}
|
|
|
+ and t1.stat_date <= #{end}
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='shopId != null and shopId != ""'>
|
|
|
+ and t1.shop_id = #{shopId}
|
|
|
+ </if>
|
|
|
+ <if test='itemType != null and itemType != ""'>
|
|
|
+ and t2.item_type = #{itemType}
|
|
|
+ </if>
|
|
|
+ <if test='userIds != null and userIds.size() > 0'>
|
|
|
+ AND t2.user_id in
|
|
|
+ <foreach collection="userIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test='courtshipPurchaseIds != null and courtshipPurchaseIds.size() > 0'>
|
|
|
+ AND t2.courtship_purchase_id in
|
|
|
+ <foreach collection="courtshipPurchaseIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by t1.item_id) t1
|
|
|
+ left join (
|
|
|
+ select t1.item_id as itemId,
|
|
|
+ count(t1.oid) as 'orderNum'
|
|
|
+ from kwaixiaodian_order_cursor_list t1 left join kwaixiaodian_item_get t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ and t1.company_id = t2.company_id
|
|
|
+ where t1.stat_date >= #{lastStart}
|
|
|
+ and t1.stat_date <= #{lastEnd}
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{nowHour}
|
|
|
+ </if>
|
|
|
+ <if test='companyId != null and companyId != ""'>
|
|
|
+ and t1.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test='shopId != null and shopId != ""'>
|
|
|
+ and t1.shop_id = #{shopId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test='userIds != null and userIds.size() > 0'>
|
|
|
+ AND t2.user_id in
|
|
|
+ <foreach collection="userIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by t1.item_id) t2 on t1.itemId = t2.itemId
|
|
|
+ order by t1.orderNum desc
|
|
|
+
|
|
|
+ </select>
|
|
|
+</mapper>
|