|
|
@@ -80,7 +80,7 @@
|
|
|
select count(*)
|
|
|
from tb_indent
|
|
|
where rider_user_id = #{userId}
|
|
|
- and indent_state in (2, 3, 4, 6, 11)
|
|
|
+ and indent_state in ('2', '3', '4', '6', '11')
|
|
|
and date_format(create_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
|
|
|
</select>
|
|
|
|
|
|
@@ -88,7 +88,7 @@
|
|
|
select ifnull(sum(rider_money), 0)
|
|
|
from tb_indent
|
|
|
where rider_user_id = #{userId}
|
|
|
- and indent_state = 6
|
|
|
+ and indent_state = '6'
|
|
|
</select>
|
|
|
|
|
|
<select id="sumCashMoney" resultType="java.math.BigDecimal">
|
|
|
@@ -158,67 +158,84 @@
|
|
|
|
|
|
<select id="rankingList" resultType="com.sqx.modules.errand.entity.TbIndent">
|
|
|
SELECT
|
|
|
- *,
|
|
|
- @rank_num := @rank_num + 1 AS rankNum
|
|
|
- FROM
|
|
|
- ( SELECT @rank_num := 0 ) r,
|
|
|
- ( SELECT ifnull( sum( rider_money ), 0 ) AS moneyOrder, i.rider_user_id, u.nick_name as nickName, u.avatar as
|
|
|
- avatar,
|
|
|
- i.user_province as userProvince, i.user_city as userCity, i.user_district as userDistrict,rs.station_name as stationName,
|
|
|
- u.user_name as riderNickName,u.balance as riderBalance,u.phone as riderPhone
|
|
|
- FROM tb_indent i left join tb_user u on i.rider_user_id = u.user_id
|
|
|
- left join rider_station rs on u.rider_station_id=rs.id
|
|
|
- WHERE i.rider_user_id IS NOT NULL and i.indent_state = 6
|
|
|
- <if test="address!=null and address!=''">
|
|
|
- and (i.user_province like concat('%',#{address},'%') or i.user_city like concat('%',#{address},'%') or
|
|
|
- i.user_district like concat('%',#{address},'%'))
|
|
|
- </if>
|
|
|
- <if test="dateType=='day'">
|
|
|
- and date_format(i.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="dateType=='month'">
|
|
|
- and date_format(i.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
|
|
|
- </if>
|
|
|
- <if test="dateType=='year'">
|
|
|
- and date_format(i.create_time,'%Y')=date_format(#{date},'%Y')
|
|
|
- </if>
|
|
|
- <if test="riderStationId != null and riderStationId != ''">
|
|
|
- and u.rider_station_id=#{riderStationId}
|
|
|
- </if>
|
|
|
- GROUP BY i.rider_user_id ) a
|
|
|
+ a.*,
|
|
|
+ ROW_NUMBER() OVER (ORDER BY a.moneyOrder DESC) AS rankNum
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ ifnull(sum(rider_money), 0) AS moneyOrder,
|
|
|
+ i.rider_user_id,
|
|
|
+ u.nick_name as nickName,
|
|
|
+ u.avatar as avatar,
|
|
|
+ i.user_province as userProvince,
|
|
|
+ i.user_city as userCity,
|
|
|
+ i.user_district as userDistrict,
|
|
|
+ rs.station_name as stationName,
|
|
|
+ u.user_name as riderNickName,
|
|
|
+ u.balance as riderBalance,
|
|
|
+ u.phone as riderPhone
|
|
|
+ FROM tb_indent i
|
|
|
+ LEFT JOIN tb_user u ON i.rider_user_id = u.user_id
|
|
|
+ LEFT JOIN rider_station rs ON u.rider_station_id=rs.id
|
|
|
+ WHERE i.rider_user_id IS NOT NULL and i.indent_state = '6'
|
|
|
+ <if test="address!=null and address!=''">
|
|
|
+ and (i.user_province like concat('%',#{address},'%') or i.user_city like concat('%',#{address},'%') or
|
|
|
+ i.user_district like concat('%',#{address},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="dateType=='day'">
|
|
|
+ and date_format(i.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="dateType=='month'">
|
|
|
+ and date_format(i.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
|
|
|
+ </if>
|
|
|
+ <if test="dateType=='year'">
|
|
|
+ and date_format(i.create_time,'%Y')=date_format(#{date},'%Y')
|
|
|
+ </if>
|
|
|
+ <if test="riderStationId != null and riderStationId != ''">
|
|
|
+ and u.rider_station_id=#{riderStationId}
|
|
|
+ </if>
|
|
|
+ GROUP BY i.rider_user_id
|
|
|
+ ) a
|
|
|
ORDER BY moneyOrder DESC
|
|
|
</select>
|
|
|
|
|
|
<select id="excelRankList" resultType="com.sqx.modules.errand.entity.TbIndent">
|
|
|
SELECT
|
|
|
- *,
|
|
|
- @rank_num := @rank_num + 1 AS rankNum
|
|
|
- FROM
|
|
|
- ( SELECT @rank_num := 0 ) r,
|
|
|
- ( SELECT ifnull( sum( rider_money ), 0 ) AS moneyOrder, i.rider_user_id, u.nick_name as nickName, u.avatar as
|
|
|
- avatar,
|
|
|
- i.user_province as userProvince, i.user_city as userCity, i.user_district as userDistrict,rs.station_name as stationName,
|
|
|
- u.user_name as riderNickName,u.balance as riderBalance
|
|
|
- FROM tb_indent i left join tb_user u on i.rider_user_id = u.user_id
|
|
|
- left join rider_station rs on u.rider_station_id=rs.id
|
|
|
- WHERE i.rider_user_id IS NOT NULL
|
|
|
- <if test="query.address!=null and query.address!=''">
|
|
|
- and (i.user_province like concat('%',#{query.address},'%') or i.user_city like concat('%',#{query.address},'%') or
|
|
|
- i.user_district like concat('%',#{query.address},'%'))
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='day'">
|
|
|
- and date_format(i.create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='month'">
|
|
|
- and date_format(i.create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='year'">
|
|
|
- and date_format(i.create_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
- </if>
|
|
|
- <if test="query.riderStationId != null and query.riderStationId !=''">
|
|
|
- and u.rider_station_id=#{query.riderStationId}
|
|
|
- </if>
|
|
|
- GROUP BY i.rider_user_id ) a
|
|
|
+ a.*,
|
|
|
+ ROW_NUMBER() OVER (ORDER BY a.moneyOrder DESC) AS rankNum
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ ifnull(sum(rider_money), 0) AS moneyOrder,
|
|
|
+ i.rider_user_id,
|
|
|
+ u.nick_name as nickName,
|
|
|
+ u.avatar as avatar,
|
|
|
+ i.user_province as userProvince,
|
|
|
+ i.user_city as userCity,
|
|
|
+ i.user_district as userDistrict,
|
|
|
+ rs.station_name as stationName,
|
|
|
+ u.user_name as riderNickName,
|
|
|
+ u.balance as riderBalance
|
|
|
+ FROM tb_indent i
|
|
|
+ LEFT JOIN tb_user u ON i.rider_user_id = u.user_id
|
|
|
+ LEFT JOIN rider_station rs ON u.rider_station_id=rs.id
|
|
|
+ WHERE i.rider_user_id IS NOT NULL
|
|
|
+ <if test="query.address!=null and query.address!=''">
|
|
|
+ and (i.user_province like concat('%',#{query.address},'%') or i.user_city like concat('%',#{query.address},'%') or
|
|
|
+ i.user_district like concat('%',#{query.address},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="query.dateType=='day'">
|
|
|
+ and date_format(i.create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="query.dateType=='month'">
|
|
|
+ and date_format(i.create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
+ </if>
|
|
|
+ <if test="query.dateType=='year'">
|
|
|
+ and date_format(i.create_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
+ </if>
|
|
|
+ <if test="query.riderStationId != null and query.riderStationId !=''">
|
|
|
+ and u.rider_station_id=#{query.riderStationId}
|
|
|
+ </if>
|
|
|
+ GROUP BY i.rider_user_id
|
|
|
+ ) a
|
|
|
ORDER BY moneyOrder DESC
|
|
|
</select>
|
|
|
|
|
|
@@ -243,74 +260,89 @@
|
|
|
|
|
|
<select id="selectRankingList" resultType="com.sqx.modules.order.entity.TbOrder">
|
|
|
SELECT
|
|
|
- *,
|
|
|
- @rank_num := @rank_num + 1 AS rankNum
|
|
|
- FROM
|
|
|
- ( SELECT @rank_num := 0 ) r,
|
|
|
- ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney, tor.shop_id , u.shop_name,gp.id as
|
|
|
- shopType,gp.shop_type_name as shopTypeName
|
|
|
- FROM tb_order tor force index(tb_order_pay_time_IDX) left join goods_shop u on tor.shop_id = u.shop_id
|
|
|
- left join shop_type gp on gp.id=u.shop_type_id
|
|
|
- WHERE tor.shop_id IS NOT NULL and tor.status = 4
|
|
|
- <if test="query.startTime != null and query.startTime !=''">
|
|
|
- and tor.pay_time >= #{query.startTime}
|
|
|
- </if>
|
|
|
- <if test="query.endTime != null and query.endTime != ''">
|
|
|
- and tor.pay_time <![CDATA[<=]]> #{query.endTime}
|
|
|
- </if>
|
|
|
- <if test="query.shopType != null and query.shopType != '' ">
|
|
|
- and gp.id = #{query.shopType}
|
|
|
- </if>
|
|
|
- GROUP BY tor.shop_id ) a
|
|
|
+ a.*,
|
|
|
+ ROW_NUMBER() OVER (ORDER BY a.shopMoney DESC) AS rankNum
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ ifnull(sum(pay_money), 0) AS shopMoney,
|
|
|
+ ifnull(sum(shop_income_money), 0) AS shopIncomeMoney,
|
|
|
+ tor.shop_id,
|
|
|
+ u.shop_name,
|
|
|
+ gp.id as shopType,
|
|
|
+ gp.shop_type_name as shopTypeName
|
|
|
+ FROM tb_order tor
|
|
|
+ LEFT JOIN goods_shop u ON tor.shop_id = u.shop_id
|
|
|
+ LEFT JOIN shop_type gp ON gp.id=u.shop_type_id
|
|
|
+ WHERE tor.shop_id IS NOT NULL and tor.status = 4
|
|
|
+ <if test="query.startTime != null and query.startTime !=''">
|
|
|
+ and tor.pay_time >= #{query.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="query.endTime != null and query.endTime != ''">
|
|
|
+ and tor.pay_time <![CDATA[<=]]> #{query.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="query.shopType != null and query.shopType != '' ">
|
|
|
+ and gp.id = #{query.shopType}
|
|
|
+ </if>
|
|
|
+ GROUP BY tor.shop_id
|
|
|
+ ) a
|
|
|
ORDER BY shopMoney DESC
|
|
|
</select>
|
|
|
|
|
|
<select id="selectRankingListAmount" resultType="com.sqx.modules.order.entity.TbOrder">
|
|
|
- SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney
|
|
|
- FROM tb_order tor force index(tb_order_pay_time_IDX) left join goods_shop u on tor.shop_id = u.shop_id
|
|
|
- left join shop_type gp on gp.id=u.shop_type_id
|
|
|
+ SELECT
|
|
|
+ ifnull( sum( pay_money ), 0 ) AS shopMoney,
|
|
|
+ ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney
|
|
|
+ FROM tb_order tor
|
|
|
+ left join goods_shop u on tor.shop_id = u.shop_id
|
|
|
+ left join shop_type gp on gp.id=u.shop_type_id
|
|
|
WHERE tor.shop_id IS NOT NULL and tor.status = 4
|
|
|
- <if test="query.startTime != null and query.startTime !=''">
|
|
|
- and tor.pay_time >= #{query.startTime}
|
|
|
- </if>
|
|
|
- <if test="query.endTime != null and query.endTime != ''">
|
|
|
- and tor.pay_time <![CDATA[<=]]> #{query.endTime}
|
|
|
- </if>
|
|
|
- <if test="query.shopType != null and query.shopType != '' ">
|
|
|
- and gp.id = #{query.shopType}
|
|
|
- </if>
|
|
|
+ <if test="query.startTime != null and query.startTime !=''">
|
|
|
+ and tor.pay_time >= #{query.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="query.endTime != null and query.endTime != ''">
|
|
|
+ and tor.pay_time <![CDATA[<=]]> #{query.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="query.shopType != null and query.shopType != '' ">
|
|
|
+ and gp.id = #{query.shopType}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<select id="excelShopCenter" resultType="com.sqx.modules.order.entity.TbOrder">
|
|
|
SELECT
|
|
|
- *,
|
|
|
- @rank_num := @rank_num + 1 AS Rank
|
|
|
- FROM
|
|
|
- ( SELECT @rank_num := 0 ) r,
|
|
|
- ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney, tor.shop_id , u.shop_name,gp.id as
|
|
|
- shopType,gp.shop_type_name as shopTypeName
|
|
|
- FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
|
|
|
- left join shop_type gp on gp.id=u.shop_type_id
|
|
|
- WHERE tor.shop_id IS NOT NULL and tor.status = 4
|
|
|
- <if test="query.startTime != null and query.startTime !=''">
|
|
|
- and tor.pay_time >= #{query.startTime}
|
|
|
- </if>
|
|
|
- <if test="query.endTime != null and query.endTime != ''">
|
|
|
- and tor.pay_time <![CDATA[<=]]> #{query.endTime}
|
|
|
- </if>
|
|
|
- <if test="query.shopType != null and query.shopType != '' ">
|
|
|
- and gp.id = #{query.shopType}
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='day'">
|
|
|
- and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='month'">
|
|
|
- and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='year'">
|
|
|
- and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
- </if>
|
|
|
- GROUP BY tor.shop_id ) a
|
|
|
+ a.*,
|
|
|
+ ROW_NUMBER() OVER (ORDER BY a.shopMoney DESC) AS `Rank`
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ ifnull(sum(pay_money), 0) AS shopMoney,
|
|
|
+ ifnull(sum(shop_income_money), 0) AS shopIncomeMoney,
|
|
|
+ tor.shop_id,
|
|
|
+ u.shop_name,
|
|
|
+ gp.id as shopType,
|
|
|
+ gp.shop_type_name as shopTypeName
|
|
|
+ FROM tb_order tor
|
|
|
+ LEFT JOIN goods_shop u ON tor.shop_id = u.shop_id
|
|
|
+ LEFT JOIN shop_type gp ON gp.id=u.shop_type_id
|
|
|
+ WHERE tor.shop_id IS NOT NULL and tor.status = 4
|
|
|
+ <if test="query.startTime != null and query.startTime !=''">
|
|
|
+ and tor.pay_time >= #{query.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="query.endTime != null and query.endTime != ''">
|
|
|
+ and tor.pay_time <![CDATA[<=]]> #{query.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="query.shopType != null and query.shopType != '' ">
|
|
|
+ and gp.id = #{query.shopType}
|
|
|
+ </if>
|
|
|
+ <if test="query.dateType=='day'">
|
|
|
+ and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="query.dateType=='month'">
|
|
|
+ and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
+ </if>
|
|
|
+ <if test="query.dateType=='year'">
|
|
|
+ and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
+ </if>
|
|
|
+ GROUP BY tor.shop_id
|
|
|
+ ) a
|
|
|
ORDER BY shopMoney DESC
|
|
|
</select>
|
|
|
|
|
|
@@ -368,7 +400,7 @@
|
|
|
left join tb_indent ti on ti.order_id = i.order_id
|
|
|
left join tb_user tu on ti.rider_user_id = tu.user_id
|
|
|
where i.user_id = #{userId}
|
|
|
- and i.indent_state in (2, 3, 4, 5, 6, 8, 9, 10)
|
|
|
+ and i.indent_state in ('2', '3', '4', '5', '6', '8', '9', '10')
|
|
|
order by i.create_time desc
|
|
|
</select>
|
|
|
|
|
|
@@ -376,25 +408,29 @@
|
|
|
select *
|
|
|
from tb_indent
|
|
|
where rider_user_id = #{userId}
|
|
|
- and indent_state in (3, 4, 5, 6)
|
|
|
+ and indent_state in ('3', '4', '5', '6')
|
|
|
order by create_time desc
|
|
|
</select>
|
|
|
|
|
|
<select id="findTopUpMoney" resultType="com.sqx.modules.pay.entity.PayDetails">
|
|
|
- select pd.*, tu.nick_name as nickName from pay_details pd left join tb_user tu on pd.user_id = tu.user_id where
|
|
|
- 1 = 1
|
|
|
- <if test="userId!=null">
|
|
|
- and pd.user_id = #{userId}
|
|
|
- </if>
|
|
|
- <if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
|
|
|
- and str_to_date(pd.create_time, '%Y-%m-%d') between str_to_date(#{startTime}, '%Y-%m-%d') AND
|
|
|
- str_to_date(#{endTime}, '%Y-%m-%d')
|
|
|
- </if>
|
|
|
+ select
|
|
|
+ pd.*,
|
|
|
+ tu.nick_name as nickName
|
|
|
+ from pay_details pd
|
|
|
+ left join tb_user tu on pd.user_id = tu.user_id
|
|
|
+ <where>
|
|
|
+ <if test="userId!=null">
|
|
|
+ and pd.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
|
|
|
+ and pd.create_time between #{startTime} AND #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
order by pd.create_time desc
|
|
|
</select>
|
|
|
|
|
|
<select id="billMoney" resultType="java.math.BigDecimal">
|
|
|
- select ifnull(sum(indent_money),0) from tb_indent where indent_state in (2, 3, 4, 6)
|
|
|
+ select ifnull(sum(indent_money),0) from tb_indent where indent_state in ('2', '3', '4', '6')
|
|
|
<if test="dateType=='day'">
|
|
|
and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
|
|
|
</if>
|
|
|
@@ -407,7 +443,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="riderMoney" resultType="java.math.BigDecimal">
|
|
|
- select ifnull(sum(rider_money),0) from tb_indent where indent_state = "6"
|
|
|
+ select ifnull(sum(rider_money),0) from tb_indent where indent_state = '6'
|
|
|
<if test="dateType=='day'">
|
|
|
and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
|
|
|
</if>
|
|
|
@@ -420,7 +456,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="platformMoney" resultType="java.math.BigDecimal">
|
|
|
- select ifnull(sum(platform_money),0) from tb_indent where indent_state = "6"
|
|
|
+ select ifnull(sum(platform_money),0) from tb_indent where indent_state = '6'
|
|
|
<if test="dateType=='day'">
|
|
|
and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
|
|
|
</if>
|