|
|
@@ -24,51 +24,51 @@ public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
|
|
|
"select #{dayId}, tu.user_id, null,2,null,sum(ti.rider_money),count(ti.rider_money),null,null,null,\n" +
|
|
|
"sum(co.money),sum(co.rate), count(co.money),null,null,max(tu.balance),\n" +
|
|
|
"(select sum(money) b from user_money_details ud1 where ud1.user_id =tu.user_id and ud1.title like '系统赠送%' \n" +
|
|
|
- "and ud1.create_time>#{startTime} and ud1.create_time <=#{endTime})\n" +
|
|
|
+ "and ud1.create_time>#{startTime} and ud1.create_time <=#{endTime})\n" +
|
|
|
"-(select sum(money) a from user_money_details ud2 where ud2.user_id =tu.user_id and ud2.title like '系统扣除%' \n" +
|
|
|
- "and ud2.create_time>#{startTime} and ud2.create_time <= #{endTime}) as gift_amount,null,\n" +
|
|
|
+ "and ud2.create_time>#{startTime} and ud2.create_time <= #{endTime}) as gift_amount,null,\n" +
|
|
|
"sum(ti.rider_money),null,#{now},#{now}\n" +
|
|
|
"from tb_user tu USE INDEX(tb_user_rider_open_id_IDX)\n" +
|
|
|
"left join tb_indent ti USE INDEX(tb_indent_finish_time_IDX) on \n" +
|
|
|
" ti.finish_time >#{startTime} \n" +
|
|
|
- "and ti.finish_time <= #{endTime}\n" +
|
|
|
+ "and ti.finish_time <= #{endTime}\n" +
|
|
|
"and ti.rider_user_id =tu.user_id\n" +
|
|
|
"and ti.indent_state ='6'\n" +
|
|
|
"left join cash_out co on co.user_id =tu.user_id and co.type =1 and co.state=1\n" +
|
|
|
"and co.out_at >#{startTime} \n" +
|
|
|
- "and co.out_at <=#{endTime}\n" +
|
|
|
+ "and co.out_at <=#{endTime}\n" +
|
|
|
"where tu.rider_open_id is not null \n" +
|
|
|
"group by tu.user_id \n" +
|
|
|
"union all \n" +
|
|
|
"select #{dayId}, tu.user_id, null,1,null,sum(tor.shop_income_money),count(tor.shop_income_money),\n" +
|
|
|
"sum(co.money),sum(co.rate),count(co.money),null,null,null,sum(to1.pay_money),count(to1.pay_money),max(um.money),\n" +
|
|
|
"(select sum(money) b from user_money_details ud1 where ud1.user_id =tu.user_id and ud1.title like '系统赠送%' \n" +
|
|
|
- "and ud1.create_time>#{startTime} and ud1.create_time <=#{endTime})\n" +
|
|
|
+ "and ud1.create_time>#{startTime} and ud1.create_time <=#{endTime})\n" +
|
|
|
"-(select sum(money) a from user_money_details ud2 where ud2.user_id =tu.user_id and ud2.title like '系统扣除%' \n" +
|
|
|
- "and ud2.create_time>#{startTime} and ud2.create_time <=#{endTime}) as gift_amount\n" +
|
|
|
+ "and ud2.create_time>#{startTime} and ud2.create_time <=#{endTime}) as gift_amount\n" +
|
|
|
",sum(tor.shop_income_money*(1-gs.shop_rate)/gs.shop_rate) platform_rates,sum(tor.shop_income_money),\n" +
|
|
|
"sum(tor.pay_money),#{now},#{now} \n" +
|
|
|
"from tb_user tu \n" +
|
|
|
"left join goods_shop gs on tu.user_id =gs.user_id\n" +
|
|
|
"left join tb_order tor USE INDEX(tb_order_update_time_IDX) on gs.shop_id =tor.shop_id \n" +
|
|
|
"and tor.update_time >#{startTime}\n" +
|
|
|
- "and tor.update_time <=#{endTime}\n" +
|
|
|
+ "and tor.update_time <=#{endTime}\n" +
|
|
|
"and tor.status=4\n" +
|
|
|
"left join tb_order to1 USE INDEX(tb_order_update_time_IDX) on gs.shop_id =to1.shop_id \n" +
|
|
|
"and to1.update_time >#{startTime}\n" +
|
|
|
- "and to1.update_time <=#{endTime}\n" +
|
|
|
+ "and to1.update_time <=#{endTime}\n" +
|
|
|
"and to1.status in(5,8)\n" +
|
|
|
"left join cash_out co on co.user_id =tu.user_id and co.type =2 and co.state=1\n" +
|
|
|
"and co.out_at >#{startTime} \n" +
|
|
|
- "and co.out_at <=#{endTime}\n" +
|
|
|
+ "and co.out_at <=#{endTime}\n" +
|
|
|
"left join user_money um on um.user_id =tu.user_id\n" +
|
|
|
"where tu.admin_user_id is not null\n" +
|
|
|
"group by tu.user_id ")
|
|
|
- int insertPlatformBill(@Param("dayId") String dayId,@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("now") String now);
|
|
|
+ Integer insertPlatformBill(@Param("dayId") String dayId,@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("now") String now);
|
|
|
|
|
|
@Select("update platform_bill a join platform_bill b on a.user_id =b.user_id and a.type =b.type and TO_DAYS(a.day_id)-TO_DAYS(b.day_id)= 1 set a.start_money=b.end_money\n" +
|
|
|
"where a.day_id =#{dayId} ")
|
|
|
- int updateStartMoney(@Param("dayId") String dayId);
|
|
|
+ Integer updateStartMoney(@Param("dayId") String dayId);
|
|
|
|
|
|
@Select("INSERT INTO `tcwm2.5`.platform_bill \n" +
|
|
|
"(day_id, user_id, shop_name, `type`, start_money, revenue, revenue_count, \n" +
|
|
|
@@ -81,5 +81,5 @@ public interface PlatformBillMapper extends BaseMapper<PlatformBill> {
|
|
|
"sum(if(type=1, refund_money ,0)),sum(if(type=1, refund_count ,0)),sum(if(type=1, end_money ,0)),null,\n" +
|
|
|
"sum(if(type=1, platform_rates ,0)),null,null,max(create_time) ,max(update_time) \n" +
|
|
|
"from platform_bill pb where day_id =#{dayId}\n")
|
|
|
- int insertTotalPlatformBill(@Param("dayId") String dayId);
|
|
|
+ Integer insertTotalPlatformBill(@Param("dayId") String dayId);
|
|
|
}
|