| | |
| | | <result property="meiliao" column="meiliao" /> |
| | | <result property="zkTotal" column="zk_total" /> |
| | | |
| | | <result property="arriveCnt" column="arrive_cnt" /> |
| | | |
| | | |
| | | |
| | | </resultMap> |
| | |
| | | where 1=1 |
| | | <include refid="where_sql"></include> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectVipConsumeStatisticsList" resultMap="AchieveNewMap"> |
| | | select |
| | | a.VIP_NAME, |
| | | d.cnt, |
| | | b.buyConsume, |
| | | b.freeConsume, |
| | | b.hisConsume |
| | | from sys_vip_info a |
| | | inner join ( |
| | | select vip_id, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id |
| | | ) b on a.ID = b.vip_id |
| | | inner join ( |
| | | select vip_id, count(1) cnt from ( |
| | | select vip_id, date_format(datatime, '%Y-%m-%d') |
| | | from achieve_new |
| | | group by date_format(datatime, '%Y-%m-%d'), vip_id |
| | | ) c group by vip_id |
| | | ) d on a.ID=d.vip_id |
| | | where 1=1 |
| | | <if test="record.vipName != null and record.vipName !=''"> |
| | | and (a.vip_name like CONCAT(CONCAT('%', #{record.vipName}), '%') or a.vip_no=#{record.vipName}) |
| | | </if> |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id=#{shopId} |
| | | </if> |
| | | <if test="record.beginTime != null and record.endTime!=null"> |
| | | and date_format(datatime, '%Y-%m-%d') between #{record.beginTime} and #{record.endTime} |
| | | </if> |
| | | |
| | | <if test="record.meiliao != null and record.meiliao!=''"> |
| | | and FIND_IN_SET(#{record.meiliao}, a.BEATUY_ID) |
| | | </if> |
| | | <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> |
| | | <if test="pageVo.sort !=null and pageVo.order !=null"> |
| | | order by |
| | | ${pageVo.sort} ${pageVo.order} |
| | | </if> |
| | | <if test="pageVo.offset >=0 and pageVo.limit >0"> |
| | | limit |
| | | #{pageVo.offset},#{pageVo.limit} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectVipConsumeStatisticsTotal" resultMap="AchieveNewMap"> |
| | | select count(1) |
| | | from sys_vip_info a |
| | | inner join ( |
| | | select vip_id, sum(a.free_consume) freeConsume, sum(a.his_consume) hisConsume, sum(IFNULL(goods_cash, 0) + IFNULL(card_cash, 0)) buyConsume from achieve_new a group by vip_id |
| | | ) b on a.ID = b.vip_id |
| | | inner join ( |
| | | select vip_id, count(1) cnt from ( |
| | | select vip_id, date_format(datatime, '%Y-%m-%d') |
| | | from achieve_new |
| | | group by date_format(datatime, '%Y-%m-%d'), vip_id |
| | | ) c group by vip_id |
| | | ) d on a.ID=d.vip_id |
| | | where 1=1 |
| | | <if test="record.vipName != null and record.vipName !=''"> |
| | | and (a.vip_name like CONCAT(CONCAT('%', #{record.vipName}), '%') or a.vip_no=#{record.vipName}) |
| | | </if> |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id=#{shopId} |
| | | </if> |
| | | <if test="record.beginTime != null and record.endTime!=null"> |
| | | and date_format(datatime, '%Y-%m-%d') between #{record.beginTime} and #{record.endTime} |
| | | </if> |
| | | |
| | | <if test="record.meiliao != null and record.meiliao!=''"> |
| | | and FIND_IN_SET(#{record.meiliao}, a.BEATUY_ID) |
| | | </if> |
| | | </select> |
| | | </mapper> |