|
|
@@ -29,33 +29,22 @@
|
|
|
where status = 1
|
|
|
and date_format(create_time, '%Y') = date_format(#{date}, '%Y')
|
|
|
</select>
|
|
|
- <!--今日收入-->
|
|
|
+ <!--时间范围内收入-->
|
|
|
<select id="findDayIncome" resultType="java.math.BigDecimal">
|
|
|
select ifnull(sum(pay_money), 0)
|
|
|
from tb_order
|
|
|
where status in (3, 4)
|
|
|
- and date_format(pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
|
|
|
- </select>
|
|
|
- <!--本月收入-->
|
|
|
- <select id="findMonthIncome" resultType="java.math.BigDecimal">
|
|
|
- select ifnull(sum(pay_money), 0)
|
|
|
- from tb_order
|
|
|
- where status in (3, 4)
|
|
|
- and date_format(pay_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
|
|
|
- </select>
|
|
|
- <!--本年收入-->
|
|
|
- <select id="findYearIncome" resultType="java.math.BigDecimal">
|
|
|
- select ifnull(sum(pay_money), 0)
|
|
|
- from tb_order
|
|
|
- where status in (3, 4)
|
|
|
- and date_format(pay_time, '%Y') = date_format(#{date}, '%Y')
|
|
|
+ and pay_time >= #{starTime}
|
|
|
+ and pay_time <![CDATA[<=]]> #{endTime}
|
|
|
</select>
|
|
|
+
|
|
|
<!--今日发单数量-->
|
|
|
<select id="findIndentCount" resultType="int">
|
|
|
select count(*)
|
|
|
from tb_order
|
|
|
where status in (3, 4)
|
|
|
- and date_format(pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
|
|
|
+ and pay_time >= #{starTime}
|
|
|
+ and pay_time <![CDATA[<=]]> #{endTime}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPayOrderAnalyze" resultType="com.sqx.modules.order.entity.TbOrder">
|
|
|
@@ -258,7 +247,7 @@
|
|
|
( 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
|
|
|
+ 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 !=''">
|
|
|
@@ -270,22 +259,13 @@
|
|
|
<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>
|
|
|
|
|
|
<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 left join goods_shop u on tor.shop_id = u.shop_id
|
|
|
+ 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 !=''">
|
|
|
@@ -297,15 +277,6 @@
|
|
|
<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>
|
|
|
</select>
|
|
|
|
|
|
<select id="excelShopCenter" resultType="com.sqx.modules.order.entity.TbOrder">
|
|
|
@@ -516,15 +487,6 @@
|
|
|
<if test="query.shopId!=null">
|
|
|
and shop_id = #{query.shopId}
|
|
|
</if>
|
|
|
- <if test="query.dateType=='day'">
|
|
|
- and date_format(pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='month'">
|
|
|
- and date_format(pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='year'">
|
|
|
- and date_format(pay_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
- </if>
|
|
|
<if test="query.startTime!=null and query.startTime!=''">
|
|
|
and pay_time>=#{query.startTime}
|
|
|
</if>
|
|
|
@@ -540,15 +502,6 @@
|
|
|
<if test="query.shopId!=null">
|
|
|
and shop_id = #{query.shopId}
|
|
|
</if>
|
|
|
- <if test="query.dateType=='day'">
|
|
|
- and date_format(pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='month'">
|
|
|
- and date_format(pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='year'">
|
|
|
- and date_format(pay_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
- </if>
|
|
|
<if test="query.startTime!=null and query.startTime!=''">
|
|
|
and pay_time>=#{query.startTime}
|
|
|
</if>
|
|
|
@@ -562,15 +515,6 @@
|
|
|
<if test="query.shopId!=null">
|
|
|
and shop_id = #{query.shopId}
|
|
|
</if>
|
|
|
- <if test="query.dateType=='day'">
|
|
|
- and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='month'">
|
|
|
- and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='year'">
|
|
|
- and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
- </if>
|
|
|
<if test="query.startTime!=null and query.startTime!=''">
|
|
|
and create_time>=#{query.startTime}
|
|
|
</if>
|
|
|
@@ -584,15 +528,6 @@
|
|
|
<if test="query.shopId!=null">
|
|
|
and shop_id = #{query.shopId}
|
|
|
</if>
|
|
|
- <if test="query.dateType=='day'">
|
|
|
- and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='month'">
|
|
|
- and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
|
|
|
- </if>
|
|
|
- <if test="query.dateType=='year'">
|
|
|
- and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
|
|
|
- </if>
|
|
|
<if test="query.startTime!=null and query.startTime!=''">
|
|
|
and create_time>=#{query.startTime}
|
|
|
</if>
|