| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?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.cyksj.mapper.shop.YhShopDistributeWaitingSendPointsMapper">
- <select id="getWMoneyStatisticsDataView"
- resultType="com.cyksj.model.views.YhShopBrokenLineCpsUserWMoneyView">
- select min(curdate) as firstDate,
- max(curdate) as lastDate from (select
- <if test="today">
- date_format(send_time, '%H') as `curdate`
- </if>
- <if test="!today">
- date_format(send_time, '%Y-%m-%d') `curdate`
- </if>
- from `yh_shop_distribute_waiting_send_points`
- where shop_user_id = #{yhShopUserId}
- and send_status = 'waiting'
- <choose>
- <when test="today">
- <if test="first != null">
- and send_time >= #{first}
- </if>
- <if test="end != null">
- and send_time <= #{end}
- </if>
- group by date_format(send_time, '%H')
- </when>
- <otherwise>
- <if test="first != null">
- and date_format(send_time, '%Y-%m-%d') >= #{first}
- </if>
- <if test="end != null">
- and date_format(send_time, '%Y-%m-%d') < #{end}
- </if>
- group by date_format(send_time, '%Y-%m-%d')
- </otherwise>
- </choose>
- )s
- </select>
-
- <select id="getWMoneyStatisticsDate" resultType="com.cyksj.model.views.YhShopUserWMoneyStatisticsDataView">
- select
- <if test="today">
- date_format(send_time, '%H') as `hour`,
- </if>
- <if test="!today">
- date_format(send_time, '%Y-%m-%d') `date`,
- </if>
- TRUNCATE(sum(money)/ 100,2) money
- from `yh_shop_distribute_waiting_send_points`
- where shop_user_id = #{yhShopUserId}
- and send_status = 'waiting'
- <choose>
- <when test="today">
- <if test="first != null">
- and send_time >= #{first}
- </if>
- <if test="end != null">
- and send_time <= #{end}
- </if>
- group by date_format(send_time, '%H')
- order by date_format(send_time, '%H')
- </when>
- <otherwise>
- <if test="first != null">
- and date_format(send_time, '%Y-%m-%d') >= #{first}
- </if>
- <if test="end != null">
- and date_format(send_time, '%Y-%m-%d') < #{end}
- </if>
- group by date_format(send_time, '%Y-%m-%d')
- order by date_format(send_time, '%Y-%m-%d')
- </otherwise>
- </choose>
- </select>
- </mapper>
|