| | |
| | | <result property="disease" column="disease"/> |
| | | <result property="zjm" column="zjm"/> |
| | | <result property="companyId" column="company_id"/> |
| | | <result property="province" column="province"/> |
| | | <result property="city" column="city"/> |
| | | <result property="area" column="area"/> |
| | | <result property="recommendId" column="recommend_id"/> |
| | | |
| | | <result property="statu" column="statu"/> |
| | | <result property="birthdayType" column="birthdayType"/> |
| | |
| | | <result property="isDeal" column="is_deal"/> |
| | | <result property="createDistributionTime" column="create_distribution_time"/> |
| | | |
| | | <result property="isSales" column="is_sales" /> |
| | | <result property="withdrawalCash" column="withdrawal_cash" /> |
| | | <result property="salesmanGrade" column="salesman_grade" /> |
| | | <result property="nickName" column="nick_name" /> |
| | | <result property="avatarUrl" column="avatar_url" /> |
| | | <result property="gender" column="gender" /> |
| | | <result property="country" column="country" /> |
| | | <result property="sessionKey" column="session_key" /> |
| | | <result property="userIsAuthorize" column="user_is_authorize" /> |
| | | <result property="validFlag" column="valid_flag" /> |
| | | |
| | | <!-- 扩展属性 --> |
| | | <result property="staffName" column="STAFF_NAME"/> |
| | |
| | | <result property="createDistributionTime" column="create_distribution_time"/> |
| | | <result property="disease" column="disease"/> |
| | | <result property="companyId" column="company_id"/> |
| | | |
| | | <result property="isSales" column="is_sales" /> |
| | | <result property="withdrawalCash" column="withdrawal_cash" /> |
| | | <result property="salesmanGrade" column="salesman_grade" /> |
| | | <result property="nickName" column="nick_name" /> |
| | | <result property="avatarUrl" column="avatar_url" /> |
| | | <result property="gender" column="gender" /> |
| | | <result property="country" column="country" /> |
| | | <result property="sessionKey" column="session_key" /> |
| | | <result property="userIsAuthorize" column="user_is_authorize" /> |
| | | <result property="validFlag" column="valid_flag" /> |
| | | |
| | | <!-- 扩展属性 --> |
| | | <result property="staffName" column="STAFF_NAME"/> |
| | | <result property="shopName" column="SHOP_NAME"/> |
| | | <association property="vipLevel" javaType="com.matrix.system.hive.bean.SysVipLevel" > |
| | | <result property="levelName" column="levelName"/> |
| | | <result property="vipLevel" column="vipLevel"/> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <!-- 查询几天内过生日的会员 --> |
| | |
| | | COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, |
| | | EMAIL,CREATE_TIME,UUID,BALANCE,blood,sfCard,link,marry,vocation,handleTime from |
| | | sys_vip_info |
| | | WHERE company_id=#{companyId} |
| | | WHERE company_id=#{companyId} and IS_DELETE = 'N' |
| | | and (STAFF_ID = #{staffId} or BEATUY_ID = #{staffId}) |
| | | AND datediff(date_add(concat( |
| | | date_format(BIRTHDAY1, "%Y"), |
| | |
| | | select count(*) from |
| | | sys_vip_info |
| | | WHERE |
| | | company_id=#{companyId} |
| | | company_id=#{companyId} and IS_DELETE = 'N' |
| | | AND (STAFF_ID = #{staffId} or BEATUY_ID = #{staffId}) |
| | | AND datediff(date_add(concat( |
| | | date_format(BIRTHDAY1, "%Y"), |
| | |
| | | sys_vip_info a |
| | | LEFT JOIN service_record b ON a.ID |
| | | = b.vip_id |
| | | WHERE company_id=#{companyId} |
| | | WHERE company_id=#{companyId} and a.IS_DELETE = 'N' |
| | | and (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.follow_time BETWEEN curdate() |
| | | AND |
| | |
| | | = b.vip_id |
| | | WHERE |
| | | company_id=#{companyId} |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.follow_time BETWEEN curdate() |
| | |
| | | LEFT JOIN sys_proj_services b ON a.ID = b.VIP_ID |
| | | WHERE |
| | | company_id=#{companyId} |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.YY_TIME BETWEEN curdate() |
| | |
| | | LEFT JOIN sys_proj_services b ON a.ID = b.VIP_ID |
| | | WHERE |
| | | company_id=#{companyId} |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.YY_TIME BETWEEN curdate() |
| | |
| | | disease, |
| | | is_deal, |
| | | zjm, |
| | | company_id |
| | | company_id, |
| | | province, |
| | | city, |
| | | area, |
| | | recommend_id, |
| | | is_sales, |
| | | withdrawal_cash, |
| | | salesman_grade, |
| | | nick_name, |
| | | avatar_url, |
| | | gender, |
| | | country, |
| | | session_key, |
| | | user_is_authorize |
| | | ) |
| | | |
| | | |
| | |
| | | #{disease}, |
| | | #{isDeal}, |
| | | #{zjm}, |
| | | #{companyId} |
| | | #{companyId}, |
| | | #{province}, |
| | | #{city}, |
| | | #{area}, |
| | | #{recommendId}, |
| | | #{isSales}, |
| | | #{withdrawalCash}, |
| | | #{salesmanGrade}, |
| | | #{nickName}, |
| | | #{avatarUrl}, |
| | | #{gender}, |
| | | #{country}, |
| | | #{sessionKey}, |
| | | #{userIsAuthorize} |
| | | ) |
| | | |
| | | </insert> |
| | |
| | | is_deal = #{isDeal}, |
| | | </if> |
| | | |
| | | <if test="province != null and province !='' "> |
| | | province = #{province}, |
| | | </if> |
| | | <if test="city != null and city !='' "> |
| | | city = #{city}, |
| | | </if> |
| | | <if test="area != null and area !='' "> |
| | | area = #{area}, |
| | | </if> |
| | | <if test="isSales != null "> |
| | | is_sales = #{isSales}, |
| | | </if> |
| | | <if test="withdrawalCash != null "> |
| | | withdrawal_cash = #{withdrawalCash}, |
| | | </if> |
| | | <if test="salesmanGrade != null "> |
| | | salesman_grade = #{salesmanGrade}, |
| | | </if> |
| | | |
| | | <if test="gender != null and gender != '' "> |
| | | gender = #{gender}, |
| | | </if> |
| | | <if test="country != null and country != '' "> |
| | | country = #{country}, |
| | | </if> |
| | | <if test="sessionKey != null and sessionKey != '' "> |
| | | session_key = #{sessionKey}, |
| | | </if> |
| | | <if test="userIsAuthorize != null "> |
| | | user_is_authorize = #{userIsAuthorize}, |
| | | </if> |
| | | <if test="nickName != null and nickName != '' "> |
| | | nick_name = #{nickName}, |
| | | </if> |
| | | <if test="avatarUrl != null and avatarUrl != '' "> |
| | | avatar_url = #{avatarUrl}, |
| | | </if> |
| | | <if test="validFlag != null and validFlag != '' "> |
| | | valid_flag = #{validFlag}, |
| | | </if> |
| | | |
| | | |
| | | </set> |
| | | WHERE ID=#{id} |
| | |
| | | UPDATE sys_vip_info set POINT_ALL = 0 |
| | | </update> |
| | | |
| | | <update id="unbundlingSaleMan"> |
| | | UPDATE sys_vip_info set recommend_id = NULL where id=#{userId}; |
| | | </update> |
| | | <update id="bindingRecommend"> |
| | | UPDATE sys_vip_info set recommend_id = #{recommendId} where id=#{userId}; |
| | | </update> |
| | | |
| | | <!-- 批量删除 --> |
| | | <delete id="deleteByIds" parameterType="java.util.List"> |
| | | delete from sys_vip_info where ID in |
| | |
| | | #{item} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="deleteLogicByIds" parameterType="java.util.List"> |
| | | UPDATE sys_vip_info set IS_DELETE = 'Y' where ID in |
| | | <foreach collection="list" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | |
| | | <!-- 根据id删除 --> |
| | | <delete id="deleteById"> |
| | |
| | | where a.ID=#{id} |
| | | </select> |
| | | |
| | | <select id="findByOpenId" resultMap="SysVipInfoMap"> |
| | | select * |
| | | from sys_vip_info where openid=#{openId} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <!-- 根据手机和密码查询 --> |
| | | <select id="selectVipByPhonePassWord" resultMap="SysVipInfoMap"> |
| | | <include refid="select"></include> |
| | |
| | | <!-- 判断是否为唯一 --> |
| | | <select id="selectTotalByField" resultType="java.lang.Integer"> |
| | | select count(*) from |
| | | sys_vip_info where ${field} = #{value} |
| | | sys_vip_info where ${field} = #{value} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <!-- 根据对象查询 --> |
| | |
| | | COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, |
| | | EMAIL,CREATE_TIME,UUID,BALANCE |
| | | from sys_vip_info where |
| | | company_id=#{companyId} |
| | | company_id=#{companyId} and IS_DELETE = 'N' |
| | | and PHONE like concat('%',#{keyWord},'%') limit 0,10 |
| | | |
| | | </select> |
| | |
| | | COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, |
| | | EMAIL,CREATE_TIME,UUID,BALANCE,blood,sfCard,link,marry,vocation |
| | | from sys_vip_info |
| | | where |
| | | SHOP_ID=#{shopId} |
| | | and ( |
| | | instr(PHONE,#{keyWord}) |
| | | where company_id=#{companyId} and IS_DELETE = 'N' |
| | | and (instr(PHONE,#{keyWord}) |
| | | or instr(VIP_NAME ,#{keyWord}) |
| | | or instr(zjm ,#{keyWord}) |
| | | or instr(VIP_NO ,#{keyWord}) |
| | | ) |
| | | or instr(VIP_NO ,#{keyWord})) |
| | | limit 0,15 |
| | | </select> |
| | | |
| | |
| | | <include refid="select"></include> |
| | | <include refid="from"></include> |
| | | where 1=1 |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.VIP_NO =#{key} or |
| | | a.VIP_NAME =#{key} or |
| | | a.PHONE =#{key}) and a.shop_id=#{shopId} |
| | | a.PHONE =#{key}) |
| | | </select> |
| | | |
| | | <select id="getLevelIdByMoney" resultMap="SysVipInfoMap"> |
| | |
| | | |
| | | <sql id="whereVo"> |
| | | <where> |
| | | a.IS_DELETE = 'N' |
| | | <if test="record!=null"> |
| | | <if test="record.keyWord != null and record.keyWord !='' "> |
| | | and (a.VIP_NO like CONCAT('%',#{record.keyWord},'%') or |
| | |
| | | </sql> |
| | | |
| | | <sql id="where"> |
| | | where 1=1 |
| | | where 1=1 and a.IS_DELETE = 'N' |
| | | <if test="record!=null"> |
| | | <if test="record.id != null and record.id !='' "> |
| | | and a.ID = #{record.id} |
| | |
| | | <if test="(record.companyId!=null and record.companyId!='') "> |
| | | and a.company_id = #{record.companyId} |
| | | </if> |
| | | |
| | | <if test="(record.nickName!=null and record.nickName!='') or (record.nickName!='' and record.nickName==0) "> |
| | | and a.nick_name like concat('%',#{record.nickName},'%') |
| | | </if> |
| | | <if test="(record.avatarUrl!=null and record.avatarUrl!='') or (record.avatarUrl!='' and record.avatarUrl==0) "> |
| | | and a.avatar_url = #{record.avatarUrl} |
| | | </if> |
| | | <if test="record.isSales != null and record.isSales !='' "> |
| | | and a.is_sales = #{record.isSales} |
| | | </if> |
| | | |
| | | <if test="record.withdrawalCash != null and record.withdrawalCash !='' "> |
| | | and a.withdrawal_cash = #{record.withdrawalCash} |
| | | </if> |
| | | |
| | | <if test="record.salesmanGrade != null and record.salesmanGrade !='' "> |
| | | and a.salesman_grade = #{record.salesmanGrade} |
| | | </if> |
| | | <if test="(record.userIsAuthorize!=null and record.userIsAuthorize!='') or (record.userIsAuthorize!='' and record.userIsAuthorize==0) "> |
| | | and a.user_is_authorize = #{record.userIsAuthorize} |
| | | </if> |
| | | |
| | | </if> |
| | | </sql> |
| | | |
| | |
| | | <if test="record.isDeal != null and record.isDeal !='' "> |
| | | and a.is_deal = #{record.isDeal} |
| | | </if> |
| | | <if test="(record.nickName!=null and record.nickName!='') or (record.nickName!='' and record.nickName==0) "> |
| | | and a.nick_name like concat('%',#{record.nickName},'%') |
| | | </if> |
| | | <if test="(record.avatarUrl!=null and record.avatarUrl!='') or (record.avatarUrl!='' and record.avatarUrl==0) "> |
| | | and a.avatar_url = #{record.avatarUrl} |
| | | </if> |
| | | <if test="record.isSales != null and record.isSales !='' "> |
| | | and a.is_sales = #{record.isSales} |
| | | </if> |
| | | |
| | | <if test="record.withdrawalCash != null and record.withdrawalCash !='' "> |
| | | and a.withdrawal_cash = #{record.withdrawalCash} |
| | | </if> |
| | | |
| | | <if test="record.salesmanGrade != null and record.salesmanGrade !='' "> |
| | | and a.salesman_grade = #{record.salesmanGrade} |
| | | </if> |
| | | <if test="(record.userIsAuthorize!=null and record.userIsAuthorize!='') or (record.userIsAuthorize!='' and record.userIsAuthorize==0) "> |
| | | and a.user_is_authorize = #{record.userIsAuthorize} |
| | | </if> |
| | | </if> |
| | | </sql> |
| | | |
| | | <sql id="select"> |
| | | select |
| | | a.ID, |
| | | a.VIP_NO, |
| | | a.VIP_NAME, |
| | | a.PHONE, |
| | | a.SEX, |
| | | a.BIRTHDAY1, |
| | | a.photo, |
| | | a.ADDR, |
| | | a.CONSTELL, |
| | | a.ANIMAL_SIGN, |
| | | a.ARRIVAL_WAY, |
| | | a.VIP_TYPE, |
| | | a.VIP_STATE, |
| | | a.POINT_ALL, |
| | | a.COMMISSION_ALL, |
| | | a.IN_DATE, |
| | | a.REMARK, |
| | | a.SHOP_ID, |
| | | a.IS_DELETE, |
| | | a.EMAIL, |
| | | a.STAFF_ID, |
| | | a.CREATE_TIME, |
| | | a.LEVEL_ID, |
| | | a.UUID, |
| | | a.BALANCE, |
| | | a.BEATUY_ID, |
| | | a.PASSWORD, |
| | | a.*, |
| | | c.su_name as STAFF_NAME, |
| | | d.SHOP_NAME, |
| | | a.blood, |
| | | a.sfCard, |
| | | a.link, |
| | | a.marry, |
| | | a.vocation, |
| | | a.handle_time, |
| | | a.statu, |
| | | a.openid, |
| | | a.parent_id, |
| | | a.create_distribution_time, |
| | | a.birthdayType, |
| | | a.disease, |
| | | a.is_deal |
| | | e.level_name levelName, |
| | | e.vip_level vipLevel |
| | | </sql> |
| | | <sql id="from"> |
| | | from sys_vip_info a |
| | | left join sys_users c on c.su_id =a.STAFF_ID |
| | | left join sys_shop_info d ON d.ID=a.SHOP_ID |
| | | left join sys_vip_level e on a.level_id=e.id |
| | | |
| | | </sql> |
| | | |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 |
| | | where 1=1 and a.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | f.vip_name as name |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 |
| | | where 1=1 and a.IS_DELETE = 'N') |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | f.vip_name as name |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if>)k |
| | |
| | | f.vip_name as name |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | count(*) |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 |
| | | where 1=1 and a.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 |
| | | where a.IS_DELETE = 'N') |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | <select id="selectByPhone" resultMap="SysVipInfoMapSimple"> |
| | | |
| | | select * from sys_vip_info where PHONE = #{phone} |
| | | select * from sys_vip_info where PHONE = #{phone} and company_id=#{companyId} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | |
| | | <select id="selectVipTelphoneByIds" resultType="java.lang.String"> |
| | | select phone from sys_vip_info |
| | | where phone is not null and id in |
| | | where phone is not null and IS_DELETE = 'N' and id in |
| | | <foreach collection="list" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | |
| | | <select id="selectAllVipPhone" resultType="java.lang.String"> |
| | | select phone from sys_vip_info |
| | | where |
| | | company_id=#{companyId} |
| | | company_id=#{companyId} and IS_DELETE = 'N' |
| | | and phone is not null |
| | | |
| | | </select> |
| | | |
| | | <select id="selectVipPhoneWithShop" resultType="java.lang.String"> |
| | | select phone from sys_vip_info |
| | | where phone is not null and shop_id=#{shopId} |
| | | where phone is not null and shop_id=#{shopId} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <select id="selectOldUserByTelphone" resultMap="SysVipInfoMap"> |
| | | select * from sys_vip_info where phone=#{telphone} and is_deal=1 |
| | | select * from sys_vip_info where phone=#{telphone} and is_deal=1 and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | |
| | |
| | | create_distribution_time, |
| | | birthdayType, |
| | | disease, |
| | | is_deal |
| | | is_deal, |
| | | zjm, |
| | | company_id, |
| | | province, |
| | | city, |
| | | area, |
| | | recommend_id, |
| | | is_sales, |
| | | withdrawal_cash, |
| | | salesman_grade, |
| | | nick_name, |
| | | avatar_url, |
| | | gender, |
| | | country, |
| | | session_key, |
| | | user_is_authorize |
| | | ) |
| | | VALUES |
| | | <foreach collection="list" item="item" index="index" separator=",">( |
| | |
| | | #{item.createDistributionTime}, |
| | | #{item.birthdayType}, |
| | | #{item.disease}, |
| | | #{item.isDeal} |
| | | #{item.isDeal}, |
| | | #{zjm}, |
| | | #{companyId}, |
| | | #{province}, |
| | | #{city}, |
| | | #{area}, |
| | | #{recommendId}, |
| | | #{isSales}, |
| | | #{withdrawalCash}, |
| | | #{salesmanGrade}, |
| | | #{nickName}, |
| | | #{avatarUrl}, |
| | | #{gender}, |
| | | #{country}, |
| | | #{sessionKey}, |
| | | #{userIsAuthorize} |
| | | )</foreach> |
| | | </insert> |
| | | |
| | | <select id="selectVipInfoByVipNo" resultMap="SysVipInfoMapSimple"> |
| | | select * from sys_vip_info where company_id=#{companyId} and vip_no=#{vipNo} |
| | | select * from sys_vip_info where company_id=#{companyId} and vip_no=#{vipNo} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <select id="selectVipAddressBookByList" resultType="com.matrix.system.app.vo.VipInfoListVo"> |
| | | select |
| | | a.ID id, |
| | | a.VIP_NAME vipName, |
| | | a.VIP_NO vipNo, |
| | | a.PHONE phone, |
| | | a.photo photo, |
| | | b.arriveCnt arriveCnt |
| | | b.arriveCnt arriveCnt, |
| | | g.shop_short_name shopName, |
| | | z.level_name vipLevel |
| | | from sys_vip_info a |
| | | left join ( |
| | | select x.vip_id, count(1) arriveCnt from ( |
| | |
| | | group by date_format(datatime, '%Y-%m-%d'), vip_id |
| | | ) x group by x.vip_id |
| | | ) b on a.ID=b.vip_id |
| | | left join sys_vip_level z on a.level_id=z.id |
| | | <!-- 本月消费 --> |
| | | <if test="record.sort == 'used'"> |
| | | left join ( |
| | |
| | | select n.VIP_LEVEL vipLevel, n.ID from sys_vip_level n |
| | | ) f on a.LEVEL_ID = f.ID |
| | | </if> |
| | | where 1=1 |
| | | 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 and a.IS_DELETE = 'N' |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(PHONE,#{record.queryKey}) |
| | | or instr(VIP_NAME ,#{record.queryKey}) |
| | |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id=#{record.shopId} |
| | | </if> |
| | | <if test="record.companyId != null"> |
| | | and a.company_id=#{record.companyId} |
| | | </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} |
| | |
| | | <if test="record.sort != 'monthArrived' and record.sort != 'yearArrived'"> |
| | | order by ${record.sort} ${record.order} |
| | | </if> |
| | | <if test="record.offset >=0 and record.limit >0"> |
| | | limit #{record.offset},#{record.limit} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectVipInfoById" resultType="com.matrix.system.app.vo.VipInfoVo"> |
| | | select |
| | | a.ID id, |
| | | a.photo photo, |
| | | a.PHONE phone, |
| | | a.VIP_NAME vipName, |
| | | a.VIP_NO vipNo, |
| | | c.LEVEL_NAME vipLevel, |
| | | a.POINT_ALL integral, |
| | | e.shop_short_name shopName, |
| | | sum(IFNULL(b.real_money, 0)) totalBalance, |
| | | sum(IFNULL(b.gift_money, 0)) giftBalance, |
| | | (select sum(IFNULL(d.goods_cash, 0) + IFNULL(d.proj_cash, 0) + IFNULL(d.card_cash, 0)) from achieve_new d where d.vip_id=a.id) totalShopping |
| | | from sys_vip_info a |
| | | left join money_card_use b on a.ID = b.vip_id and b.status='有效' |
| | | left join sys_vip_level c on a.LEVEL_ID = c.ID |
| | | left join sys_shop_info e on a.SHOP_ID=e.ID |
| | | where a.ID=#{id} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="selectVipArrearsStatistics" resultType="java.util.Map"> |
| | | select |
| | | a.VIP_NAME vipName, |
| | | a.PHONE phone, |
| | | c.shop_short_name shopName, |
| | | sum(b.arrears) arrears, |
| | | count(1) cnt, |
| | | d.su_name staffName |
| | | from sys_vip_info a |
| | | inner join sys_order b on a.ID=b.VIP_ID |
| | | inner join sys_shop_info c on a.SHOP_ID=c.ID |
| | | left join sys_users d on a.STAFF_ID=d.su_id |
| | | where b.STATU='欠款' and b.arrears!=0 and a.IS_DELETE = 'N' |
| | | <if test="record.companyId!=null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | | <if test="record.shopId!=null"> |
| | | and a.shop_id=#{record.shopId} |
| | | </if> |
| | | <if test='record.vipName!=null and record.vipName!="" '> |
| | | and (a.vip_name like concat('%', #{record.vipName}, '%') or a.vip_no like concat('%', #{record.vipName}, '%') or a.phone like concat('%', #{record.vipName}, '%')) |
| | | </if> |
| | | group by a.id |
| | | <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="selectVipArrearsStatisticsTotal" resultType="java.lang.Integer"> |
| | | select count(1) from ( |
| | | select |
| | | a.VIP_NAME vipName, |
| | | a.PHONE phone, |
| | | c.shop_short_name shopName, |
| | | sum(b.arrears) arrears, |
| | | count(1) cnt, |
| | | d.su_name staffName |
| | | from sys_vip_info a |
| | | inner join sys_order b on a.ID=b.VIP_ID |
| | | inner join sys_shop_info c on a.SHOP_ID=c.ID |
| | | left join sys_users d on a.STAFF_ID=d.su_id |
| | | where b.STATU='欠款' and b.arrears!=0 and a.IS_DELETE = 'N' |
| | | <if test="record.companyId!=null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | | <if test="record.shopId!=null"> |
| | | and a.shop_id=#{record.shopId} |
| | | </if> |
| | | |
| | | <if test='record.vipName!=null and record.vipName!="" '> |
| | | and (a.vip_name like concat('%', #{record.vipName}, '%') or a.vip_no like concat('%', #{record.vipName}, '%') or a.phone like concat('%', #{record.vipName}, '%')) |
| | | </if> |
| | | group by a.id |
| | | ) a |
| | | </select> |
| | | </mapper> |
| | | |