| | |
| | | a.VIP_NAME vipName, |
| | | a.PHONE phone, |
| | | a.photo photo, |
| | | b.arriveCnt arriveCnt |
| | | b.arriveCnt arriveCnt, |
| | | g.shop_short_name shopName |
| | | from sys_vip_info a |
| | | left join ( |
| | | select x.vip_id, count(1) arriveCnt from ( |
| | |
| | | select n.VIP_LEVEL vipLevel, n.ID from sys_vip_level n |
| | | ) f on a.LEVEL_ID = f.ID |
| | | </if> |
| | | left join sys_shop_info g on a.shop_id = g.id |
| | | left join sys_vip_level h on a.level_id=h.id |
| | | where 1=1 |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(PHONE,#{record.queryKey}) |
| | |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id=#{record.shopId} |
| | | </if> |
| | | <if test='record.birthType=="1"'> |
| | | and a.BIRTHDAY1 between curdate() and DATE_ADD(CURDATE(), INTERVAL 3 DAY) |
| | | </if> |
| | | <if test='record.birthType=="2"'> |
| | | and date_format(a.BIRTHDAY1, '%Y-%m') = date_format(CURDATE(), '%Y-%m') |
| | | </if> |
| | | <if test='record.birthType=="3"'> |
| | | and PERIOD_DIFF(date_format(now() ,'%Y-%m') , date_format(a.BIRTHDAY1, '%Y-%m')) =1 |
| | | </if> |
| | | <if test="record.vipType != null"> |
| | | and a.level_id=#{record.vipType} |
| | | </if> |
| | | <if test="record.other != null and record.other!=''"> |
| | | and a.is_deal=#{record.other} |
| | | </if> |
| | | |
| | | <if test="record.sort == 'monthArrived' or record.sort == 'yearArrived'"> |
| | | order by arriveCnt ${record.order} |