| | |
| | | <?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.yeshi.fanli.dao.mybatis.UserInfoMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="identifycode" property="openid" jdbcType="VARCHAR" /> |
| | | <result column="login_type" property="loginType" jdbcType="INTEGER" /> |
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" /> |
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" /> |
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" /> |
| | | <result column="tbName" property="tbName" jdbcType="VARCHAR" /> |
| | | <result column="tbPic" property="tbPic" jdbcType="VARCHAR" /> |
| | | <result column="wxName" property="wxName" jdbcType="VARCHAR" /> |
| | | <result column="wxPic" property="wxPic" jdbcType="VARCHAR" /> |
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR" /> |
| | | <result column="createtime" property="createtime" jdbcType="BIGINT" /> |
| | | <result column="last_logintime" property="lastLoginTime" |
| | | jdbcType="BIGINT" /> |
| | | <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" /> |
| | | <result column="tuiguang_code" property="tuiGuangCode" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="appid" property="appId" jdbcType="VARCHAR" /> |
| | | <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" /> |
| | | <result column="pay_password" property="payPassword" jdbcType="VARCHAR" /> |
| | | <result column="rank" property="rank" jdbcType="INTEGER" /> |
| | | <result column="phone" property="phone" jdbcType="VARCHAR" /> |
| | | <result column="state" property="state" jdbcType="INTEGER" /> |
| | | <result column="state_desc" property="stateDesc" jdbcType="VARCHAR" /> |
| | | <!-- <association property="system" column="sid" resultMap="com.yeshi.fanli.dao.mybatis.SystemMapper.BaseResultMap" |
| | | /> --> |
| | | </resultMap> |
| | | |
| | | <resultMap id="BaseResultMapVO" type="com.yeshi.fanli.vo.user.UserInfoVO"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="identifycode" property="openid" jdbcType="VARCHAR" /> |
| | | <result column="login_type" property="loginType" jdbcType="INTEGER" /> |
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" /> |
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" /> |
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" /> |
| | | <result column="tbName" property="tbName" jdbcType="VARCHAR" /> |
| | | <result column="tbPic" property="tbPic" jdbcType="VARCHAR" /> |
| | | <result column="wxName" property="wxName" jdbcType="VARCHAR" /> |
| | | <result column="wxPic" property="wxPic" jdbcType="VARCHAR" /> |
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR" /> |
| | | <result column="createtime" property="createtime" jdbcType="BIGINT" /> |
| | | <result column="last_logintime" property="lastLoginTime" |
| | | jdbcType="BIGINT" /> |
| | | <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" /> |
| | | <result column="tuiguang_code" property="tuiGuangCode" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="appid" property="appId" jdbcType="VARCHAR" /> |
| | | <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" /> |
| | | <result column="pay_password" property="payPassword" jdbcType="VARCHAR" /> |
| | | <result column="rank" property="rank" jdbcType="INTEGER" /> |
| | | <result column="phone" property="phone" jdbcType="VARCHAR" /> |
| | | <result column="state" property="state" jdbcType="INTEGER" /> |
| | | <result column="state_desc" property="stateDesc" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="ur_id" property="rankId" jdbcType="BIGINT" /> |
| | | <result column="ur_name" property="rankName" jdbcType="VARCHAR" /> |
| | | <result column="ur_picture" property="rankPicture" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="totalOrder" property="totalOrder" jdbcType="BIGINT" /> |
| | | <result column="monthOrder" property="monthOrder" jdbcType="BIGINT" /> |
| | | |
| | | <result column="taoBaoUid" property="taoBaoUid" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="wxUnionIdInvalid" property="wxUnionIdInvalid" jdbcType="VARCHAR" /> |
| | | <result column="taobaoUidInvalid" property="taobaoUidInvalid" jdbcType="VARCHAR" /> |
| | | <result column="phoneInvalid" property="phoneInvalid" jdbcType="VARCHAR" /> |
| | | <result column="alipayAccountInvalid" property="alipayAccountInvalid" jdbcType="VARCHAR" /> |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where id = #{id,jdbcType=BIGINT} and `state`=0 |
| | | </select> |
| | | |
| | | <select id="selectByPKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where id = #{id,jdbcType=BIGINT} for update |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_user where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user |
| | | (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{tuiGuangCode,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system.id,jdbcType=BIGINT},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_user |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="openid != null">identifycode,</if> |
| | | <if test="loginType != null">login_type,</if> |
| | | <if test="wxOpenId != null">wx_open_id,</if> |
| | | <if test="wxUnionId != null">wx_union_id,</if> |
| | | <if test="nickName != null">nick_name,</if> |
| | | <if test="tbName != null">tbName,</if> |
| | | <if test="tbPic != null">tbPic,</if> |
| | | <if test="wxName != null">wxName,</if> |
| | | <if test="wxPic != null">wxPic,</if> |
| | | <if test="portrait != null">portrait,</if> |
| | | <if test="createtime != null">createtime,</if> |
| | | <if test="lastLoginTime != null">last_logintime,</if> |
| | | <if test="lastLoginIp != null">loginip,</if> |
| | | <if test="tuiGuangCode != null">tuiguang_code,</if> |
| | | <if test="appId != null">appid,</if> |
| | | <if test="myHongBao != null">my_hongBao,</if> |
| | | <if test="payPassword != null">pay_password,</if> |
| | | <if test="system != null">sid,</if> |
| | | <if test="rank != null">rank,</if> |
| | | <if test="phone != null">phone,</if> |
| | | <if test="state != null">state,</if> |
| | | <if test="stateDesc != null">state_desc,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="openid != null">#{openid,jdbcType=VARCHAR},</if> |
| | | <if test="loginType != null">#{loginType,jdbcType=INTEGER},</if> |
| | | <if test="wxOpenId != null">#{wxOpenId,jdbcType=VARCHAR},</if> |
| | | <if test="wxUnionId != null">#{wxUnionId,jdbcType=VARCHAR},</if> |
| | | <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="tbName != null">#{tbName,jdbcType=VARCHAR},</if> |
| | | <if test="tbPic != null">#{tbPic,jdbcType=VARCHAR},</if> |
| | | <if test="wxName != null">#{wxName,jdbcType=VARCHAR},</if> |
| | | <if test="wxPic != null">#{wxPic,jdbcType=VARCHAR},</if> |
| | | <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if> |
| | | <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if> |
| | | <if test="lastLoginTime != null">#{lastLoginTime,jdbcType=BIGINT},</if> |
| | | <if test="lastLoginIp != null">#{lastLoginIp,jdbcType=VARCHAR},</if> |
| | | <if test="tuiGuangCode != null">#{tuiGuangCode,jdbcType=VARCHAR},</if> |
| | | <if test="appId != null">#{appId,jdbcType=VARCHAR},</if> |
| | | <if test="myHongBao != null">#{myHongBao,jdbcType=DECIMAL},</if> |
| | | <if test="payPassword != null">#{payPassword,jdbcType=VARCHAR},</if> |
| | | <if test="system != null">#{system.id,jdbcType=BIGINT},</if> |
| | | <if test="rank != null">#{rank,jdbcType=INTEGER},</if> |
| | | <if test="phone != null">#{phone,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">update |
| | | yeshi_ec_user set identifycode = #{openid,jdbcType=VARCHAR},login_type |
| | | = #{loginType,jdbcType=INTEGER},wx_open_id = |
| | | #{wxOpenId,jdbcType=VARCHAR},wx_union_id = |
| | | #{wxUnionId,jdbcType=VARCHAR},nick_name = |
| | | #{nickName,jdbcType=VARCHAR},tbName = #{tbName,jdbcType=VARCHAR},tbPic |
| | | = #{tbPic,jdbcType=VARCHAR},wxName = #{wxName,jdbcType=VARCHAR},wxPic |
| | | = #{wxPic,jdbcType=VARCHAR},portrait = |
| | | #{portrait,jdbcType=VARCHAR},createtime = |
| | | #{createtime,jdbcType=BIGINT},last_logintime = |
| | | #{lastLoginTime,jdbcType=BIGINT},loginip = |
| | | #{lastLoginIp,jdbcType=VARCHAR},tuiguang_code = |
| | | #{tuiGuangCode,jdbcType=VARCHAR},appid = |
| | | #{appId,jdbcType=VARCHAR},my_hongBao = |
| | | #{myHongBao,jdbcType=DECIMAL},pay_password = |
| | | #{payPassword,jdbcType=VARCHAR},sid = |
| | | #{system.id,jdbcType=BIGINT},rank = #{rank,jdbcType=INTEGER} ,phone |
| | | =#{phone,jdbcType=VARCHAR} ,state =#{state,jdbcType=INTEGER} |
| | | ,state_desc =#{stateDesc,jdbcType=VARCHAR} where id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | update yeshi_ec_user |
| | | <set> |
| | | <if test="openid != null">identifycode=#{openid,jdbcType=VARCHAR},</if> |
| | | <if test="loginType != null">login_type=#{loginType,jdbcType=INTEGER},</if> |
| | | <if test="wxOpenId != null">wx_open_id=#{wxOpenId,jdbcType=VARCHAR},</if> |
| | | <if test="wxUnionId != null">wx_union_id=#{wxUnionId,jdbcType=VARCHAR},</if> |
| | | <if test="nickName != null">nick_name=#{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="tbName != null">tbName=#{tbName,jdbcType=VARCHAR},</if> |
| | | <if test="tbPic != null">tbPic=#{tbPic,jdbcType=VARCHAR},</if> |
| | | <if test="wxName != null">wxName=#{wxName,jdbcType=VARCHAR},</if> |
| | | <if test="wxPic != null">wxPic=#{wxPic,jdbcType=VARCHAR},</if> |
| | | <if test="portrait != null">portrait=#{portrait,jdbcType=VARCHAR},</if> |
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if> |
| | | <if test="lastLoginTime != null">last_logintime=#{lastLoginTime,jdbcType=BIGINT},</if> |
| | | <if test="lastLoginIp != null">loginip=#{lastLoginIp,jdbcType=VARCHAR},</if> |
| | | <if test="tuiGuangCode != null">tuiguang_code=#{tuiGuangCode,jdbcType=VARCHAR},</if> |
| | | <if test="appId != null">appid=#{appId,jdbcType=VARCHAR},</if> |
| | | <if test="myHongBao != null">my_hongBao=#{myHongBao,jdbcType=DECIMAL},</if> |
| | | <if test="payPassword != null">pay_password=#{payPassword,jdbcType=VARCHAR},</if> |
| | | <if test="system != null">sid=#{system.id,jdbcType=BIGINT},</if> |
| | | <if test="rank != null">rank=#{rank,jdbcType=INTEGER},</if> |
| | | <if test="phone !=null">phone =#{phone,jdbcType=VARCHAR},</if> |
| | | <if test="state !=null">state =#{state,jdbcType=INTEGER},</if> |
| | | <if test="stateDesc !=null">state_desc =#{stateDesc,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="subHongBaoByUid">update yeshi_ec_user set my_hongBao= |
| | | my_hongBao-#{money,jdbcType=DECIMAL} where id = #{uid,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="addHongBaoByUid">update yeshi_ec_user set my_hongBao= |
| | | my_hongBao+#{money,jdbcType=DECIMAL} where id = #{uid,jdbcType=BIGINT} |
| | | </update> |
| | | <!-- 清除手势密码 --> |
| | | <delete id="cleanPassword">DELETE FROM `yeshi_ec_extract_record` WHERE uid = |
| | | #{id}; |
| | | </delete> |
| | | <!-- 查询新人红包 --> |
| | | <select id="getNewPeopleHB" resultType="BigDecimal">SELECT sum(hb.`money`) |
| | | FROM `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id} AND hb.`type` = '4'; |
| | | </select> |
| | | <!-- 查询我的红包 --> |
| | | <select id="getMyHB" resultType="BigDecimal">SELECT SUM(hb.`money`) FROM |
| | | `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id}; |
| | | </select> |
| | | <!-- 根据AppId与微信unionID获取用户 --> |
| | | <select id="listByAppIdAndWXUnionId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where appid=#{appId} and wx_union_id=#{unionId} |
| | | </select> |
| | | <!-- 根据AppId与淘宝OpenId获取用户 --> |
| | | <select id="listByAppIdAndTaoBaoOpenId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where appid=#{appId} and identifycode=#{openId} |
| | | </select> |
| | | <!-- 根据AppId与电话号码获取用户 --> |
| | | <select id="listByAppIdAndPhone" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where appid=#{appId} and phone=#{phone} |
| | | </select> |
| | | |
| | | <!-- 根据AppId与电话号码获取用户 --> |
| | | <select id="getEffectiveUserInfoByPhone" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List" /> from yeshi_ec_user |
| | | where phone=#{phone} AND state = 0 |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <!-- 根据AppId与电话号码获取用户 --> |
| | | <select id="getEffectiveUserInfoByWXUnionId" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List" /> from yeshi_ec_user |
| | | where wx_union_id=#{unionId} AND state = 0 |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getMaxUid" resultType="java.lang.Long">select max(id) from |
| | | yeshi_ec_user |
| | | </select> |
| | | <!-- 两个账号的业务融合 --> |
| | | <select id="connectUser" > |
| | | call procedure_connect_user(#{mainUid},#{lessUid}) |
| | | </select> |
| | | |
| | | <select id="query" resultMap="BaseResultMapVO"> |
| | | SELECT * |
| | | ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb |
| | | WHERE hb.hb_uid = u.id AND hb.hb_type = 1 )AS totalOrder <!-- 累计订单 --> |
| | | ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb |
| | | WHERE hb.hb_uid = u.id AND hb.hb_type = 1 |
| | | AND DATE_FORMAT(hb.`hb_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m'))AS monthOrder <!-- 累计本月订单 --> |
| | | ,(SELECT COUNT(tr.`id`) FROM `yeshi_ec_threesale` tr <!-- 队员 --> |
| | | WHERE tr.`boss_id`=u.id AND tr.state = 1) AS totalPlayers |
| | | FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` |
| | | LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid |
| | | LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id |
| | | LEFT JOIN yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id |
| | | |
| | | <if test="userState == 2"> |
| | | LEFT JOIN |
| | | (SELECT A.uid AS buid,MAX(A.f_wxUnionId) AS wxUnionIdInvalid ,MAX(A.f_taobaoUid) AS taobaoUidInvalid,MAX(A.f_phone) AS phoneInvalid,MAX(A.f_alipayAccount) AS alipayAccountInvalid FROM |
| | | (SELECT u.`id`AS uid,b.account AS alipayAccount,b.name AS alipayAccountName,fu.* FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON b.`uid` = u.`id` |
| | | LEFT JOIN yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id |
| | | LEFT JOIN (SELECT fc.fuc_effective,IF(fc.`fuc_type` = 'wxUnionId',fc.`fuc_identify_code`,NULL)AS f_wxUnionId, |
| | | IF(fc.`fuc_type` = 'taobaoUid',fc.`fuc_identify_code`,NULL)AS f_taobaoUid, |
| | | IF(fc.`fuc_type` = 'phone',fc.`fuc_identify_code`,NULL)AS f_phone, |
| | | IF(fc.`fuc_type` = 'alipayAccount',fc.`fuc_identify_code`,NULL)AS f_alipayAccount |
| | | FROM yeshi_ec_forbidden_user_identify_code fc WHERE fc.fuc_effective = 1 )fu ON (fu.f_wxUnionId = u.`wx_union_id` OR fu.f_taobaoUid = tb.`uiet_taobao_uid` OR fu.f_phone = u.`phone` OR fu.f_alipayAccount = b.`account`) |
| | | WHERE u.`state` =2 |
| | | )A GROUP BY A.uid) B ON u.id= B.buid |
| | | </if> |
| | | |
| | | where 1=1 |
| | | <if test="userState == 1"> |
| | | AND u.`state` <![CDATA[<>]]> 2 <!-- 正常用户 --> |
| | | </if> |
| | | <if test="userState == 2"> |
| | | AND u.`state` =2 <!-- 封禁用户 --> |
| | | </if> |
| | | <if test="startTime != null and startTime !='' "> |
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]> DATE_FORMAT(#{startTime},'%Y%m%d') |
| | | </if> |
| | | <if test="endTime != null and endTime !=''"> |
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]> DATE_FORMAT(#{endTime},'%Y%m%d') |
| | | </if> |
| | | <if test="userRank != null"> |
| | | AND rak.ur_name = #{userRank} |
| | | </if> |
| | | <if test="days != null"> |
| | | <!-- 注册时间 --> |
| | | AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]> |
| | | </if> |
| | | <if test="key != null and key !='' "> |
| | | <if test="keyType == 1"> |
| | | AND u.id = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND u.`nick_name` LIKE '%${key}%' |
| | | </if> |
| | | <if test="keyType == 3"> |
| | | AND u.`phone` = #{key} |
| | | </if> |
| | | <if test="keyType == 4"> |
| | | AND b.`account` = #{key} |
| | | </if> |
| | | </if> |
| | | |
| | | ORDER BY |
| | | <if test="orderField == 1"> |
| | | totalOrder, |
| | | </if> |
| | | <if test="orderField == 2"> |
| | | totalOrder DESC, |
| | | </if> |
| | | <if test="orderField == 3"> |
| | | monthOrder, |
| | | </if> |
| | | <if test="orderField == 4"> |
| | | monthOrder DESC, |
| | | </if> |
| | | <if test="orderField == 5"> |
| | | totalPlayers, |
| | | </if> |
| | | <if test="orderField == 6"> |
| | | totalPlayers DESC, |
| | | </if> |
| | | u.createtime DESC |
| | | |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="queryCount" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` |
| | | LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid |
| | | LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id |
| | | where 1=1 |
| | | |
| | | <if test="userState == 1"> |
| | | AND u.`state` <![CDATA[<>]]> 2 <!-- 正常用户 --> |
| | | </if> |
| | | <if test="userState == 2"> |
| | | AND u.`state` =2 <!-- 封禁用户 --> |
| | | </if> |
| | | <if test="startTime != null and startTime !='' "> |
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]> DATE_FORMAT(#{startTime},'%Y%m%d') |
| | | </if> |
| | | <if test="endTime != null and endTime !=''"> |
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]> DATE_FORMAT(#{endTime},'%Y%m%d') |
| | | </if> |
| | | <if test="userRank != null"> |
| | | AND rak.ur_name = #{userRank} |
| | | </if> |
| | | <if test="days != null"> <!-- 注册时间 --> |
| | | AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]> |
| | | </if> |
| | | |
| | | <if test="key != null and key !='' "> |
| | | <if test="keyType == 1"> |
| | | AND u.id = #{key} |
| | | </if> |
| | | <if test="keyType == 2"> |
| | | AND u.`nick_name` LIKE '%${key}%' |
| | | </if> |
| | | <if test="keyType == 3"> |
| | | AND u.`phone` = #{key} |
| | | </if> |
| | | <if test="keyType == 4"> |
| | | AND b.`account` = #{key} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="querySumMoney" resultType="java.lang.Double"> |
| | | SELECT COALESCE(sum(u.my_hongBao),0) FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` |
| | | where <![CDATA[ 1>0 ]]> |
| | | <if test="key != null and key !='' "> |
| | | AND (u.id LIKE '%${key}%' OR u.`phone` LIKE '%${key}%' OR u.`wxName` LIKE '%${key}%' |
| | | OR u.`nick_name` LIKE '%${key}%' OR u.`tbName` LIKE '%${key}%' OR b.`account` LIKE '%${key}%') |
| | | </if> |
| | | <if test="startTime != null and startTime !='' "> |
| | | <![CDATA[ AND FROM_UNIXTIME(createtime/1000) >= '${startTime}' ]]> |
| | | </if> |
| | | <if test="endTime != null and endTime !=''"> |
| | | <![CDATA[ AND FROM_UNIXTIME(createtime/1000) < '${endTime}' ]]> |
| | | </if> |
| | | <if test="userType != null"> |
| | | AND u.rank = #{userType} |
| | | </if> |
| | | <if test="days != null"> |
| | | <!-- 时间 --> |
| | | AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(createtime/1000)]]> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="countNewUser" resultType="java.lang.Long"> |
| | | SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` |
| | | WHERE 1=1 |
| | | <if test="isToday != null and isToday == 1"> |
| | | AND TO_DAYS(FROM_UNIXTIME(createtime/1000)) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="isMonth != null and isMonth == 1"> |
| | | AND DATE_FORMAT( FROM_UNIXTIME(createtime/1000), '%Y%m' ) = DATE_FORMAT(CURDATE() , '%Y%m' ) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countRank" resultType="java.lang.Long"> |
| | | <!-- 等级统计 --> |
| | | SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` WHERE rank = #{rank} |
| | | </select> |
| | | |
| | | <select id="countAllMoney" resultType="java.math.BigDecimal"> |
| | | <!-- 金额统计 --> |
| | | SELECT CAST(SUM(my_hongBao)AS DECIMAL(19,2)) FROM `yeshi_ec_user` |
| | | WHERE 1=1 |
| | | <if test="minMoney != null"> |
| | | AND <![CDATA[ my_hongBao >= #{minMoney}]]> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countShareAndInviteMoney" resultMap="BaseResultMap"> |
| | | SELECT IFNULL(SUM(h.`money`),0),h.`uid` FROM `yeshi_ec_hongbao` h |
| | | WHERE DATE_FORMAT(FROM_UNIXTIME(h.`createtime`/1000), '%Y-%m-%d' )= '2018-08-02' |
| | | <![CDATA[AND h.state <>4]]> |
| | | AND ( h.`type` =5 OR h.`type` =6 OR h.`type` =7 OR h.`type` =20 OR h.`type` =21 OR h.`type` =22 ) |
| | | GROUP BY h.`uid` |
| | | ORDER BY SUM(h.`money`) DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="longTimeNoLogin" resultType="java.lang.Long"> |
| | | |
| | | SELECT u.`id` FROM `yeshi_ec_user` u |
| | | WHERE u.`id` IN <foreach item="item" collection="list" open="(" separator="," |
| | | close=")">#{item}</foreach> |
| | | AND <![CDATA[ (DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`last_logintime`/1000)) |
| | | OR (u.`last_logintime` IS NULL |
| | | AND DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`createTime`/1000)))) ]]> |
| | | </select> |
| | | |
| | | |
| | | <select id="countLoseUser" resultType="java.lang.Long"> |
| | | SELECT COUNT(DISTINCT t.`id` ) FROM `yeshi_ec_user` t |
| | | LEFT JOIN `yeshi_ec_user_money_detail` d ON d.`umd_uid` = t.`id` |
| | | WHERE DATE_SUB(CURDATE(), INTERVAL ${num} DAY)<![CDATA[> ]]> DATE(FROM_UNIXTIME( t.`last_logintime`/1000)) |
| | | AND DATE_SUB(CURDATE(), INTERVAL ${num} DAY) <![CDATA[> ]]> DATE(d.`umd_createtime`) |
| | | </select> |
| | | |
| | | <select id="countHasOrderUser" resultType="java.lang.Long"> |
| | | SELECT COUNT(DISTINCT h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE (h.`hb_type`=1 or h.`hb_type`=2 or h.`hb_type`= 20) |
| | | </select> |
| | | |
| | | |
| | | <select id="countNewUserByDate" resultType="java.util.HashMap"> |
| | | SELECT COUNT(DISTINCT h.`id`) AS showValue, |
| | | <if test="type == 1"> |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'showDate' |
| | | </if> |
| | | <if test="type == 2"> |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate' |
| | | </if> |
| | | <if test="type == 3"> |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate' |
| | | </if> |
| | | FROM yeshi_ec_user h |
| | | <if test="channel != null and channel != 'all' "> |
| | | left join (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`)a ON h.`id`=a.uid |
| | | </if> |
| | | WHERE 1=1 |
| | | <if test="channel != null and channel != 'all' "> |
| | | AND a.uid is not null |
| | | </if> |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}' |
| | | </if> |
| | | <if test="years != null and years != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}' |
| | | </if> |
| | | <if test="type == 1"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') |
| | | </if> |
| | | <if test="type == 2"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m') |
| | | </if> |
| | | <if test="type == 3"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y') |
| | | </if> |
| | | ORDER BY h.`createtime` |
| | | </select> |
| | | |
| | | <select id="getTodayHasOrder" resultType="java.util.HashMap"> |
| | | SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue', |
| | | <if test="type == 1"> |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate' |
| | | </if> |
| | | <if test="type == 2"> |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate' |
| | | </if> |
| | | <if test="type == 3"> |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate' |
| | | </if> |
| | | |
| | | FROM yeshi_ec_user u |
| | | <if test="channel != null and channel != 'all' "> |
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid |
| | | </if> |
| | | LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id` |
| | | WHERE (h.`hb_type`=1 OR h.`hb_type`=20) |
| | | <if test="channel != null and channel != 'all' "> |
| | | AND a.uid is not null |
| | | </if> |
| | | <!-- 当日下单 --> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = DATE_FORMAT(h.hb_create_time,'%Y-%m-%d') |
| | | |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}' |
| | | </if> |
| | | <if test="years != null and years != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}' |
| | | </if> |
| | | <if test="type == 1"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') |
| | | </if> |
| | | <if test="type == 2"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m') |
| | | </if> |
| | | <if test="type == 3"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y') |
| | | </if> |
| | | ORDER BY u.`createtime` |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getWeekHasOrder" resultType="java.util.HashMap"> |
| | | SELECT COUNT(DISTINCT hb.uid) AS showValue,FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate' |
| | | FROM (SELECT COUNT(v2.`hb_id`) AS num,v2.hb_uid AS uid |
| | | FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE (v2.`hb_type`=1 OR v2.`hb_type`=20) |
| | | AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ >= ]]>'${startTime}' |
| | | AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' |
| | | GROUP BY v2.hb_uid HAVING num >= ${orderNum})hb |
| | | LEFT JOIN yeshi_ec_user u ON u.id = hb.uid |
| | | <if test="channel != null and channel != 'all' "> |
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid |
| | | </if> |
| | | WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}' |
| | | <if test="channel != null and channel != 'all' "> |
| | | AND a.uid is not null |
| | | </if> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') |
| | | ORDER BY u.`createtime` |
| | | </select> |
| | | |
| | | <select id="getInfoByPhoneOrInviteCode" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` = u.`id` |
| | | WHERE uf.`uie_invite_code` IS NOT NULL |
| | | AND (u.`phone` =#{phone} OR uf.`uie_invite_code` = #{inviteCode}) |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | | <?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.yeshi.fanli.dao.mybatis.UserInfoMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="id" property="id" jdbcType="BIGINT" />
|
| | | <result column="identifycode" property="openid" jdbcType="VARCHAR" />
|
| | | <result column="login_type" property="loginType" jdbcType="INTEGER" />
|
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" />
|
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" />
|
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
|
| | | <result column="tbName" property="tbName" jdbcType="VARCHAR" />
|
| | | <result column="tbPic" property="tbPic" jdbcType="VARCHAR" />
|
| | | <result column="wxName" property="wxName" jdbcType="VARCHAR" />
|
| | | <result column="wxPic" property="wxPic" jdbcType="VARCHAR" />
|
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR" />
|
| | | <result column="createtime" property="createtime" jdbcType="BIGINT" />
|
| | | <result column="last_logintime" property="lastLoginTime"
|
| | | jdbcType="BIGINT" />
|
| | | <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
|
| | | <result column="tuiguang_code" property="tuiGuangCode"
|
| | | jdbcType="VARCHAR" />
|
| | | <result column="appid" property="appId" jdbcType="VARCHAR" />
|
| | | <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
|
| | | <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
|
| | | <result column="rank" property="rank" jdbcType="INTEGER" />
|
| | | <result column="phone" property="phone" jdbcType="VARCHAR" />
|
| | | <result column="state" property="state" jdbcType="INTEGER" />
|
| | | <result column="state_desc" property="stateDesc" jdbcType="VARCHAR" />
|
| | | <!-- <association property="system" column="sid" resultMap="com.yeshi.fanli.dao.mybatis.SystemMapper.BaseResultMap" |
| | | /> -->
|
| | | </resultMap>
|
| | | |
| | | <resultMap id="BaseResultMapVO" type="com.yeshi.fanli.vo.user.UserInfoVO">
|
| | | <id column="id" property="id" jdbcType="BIGINT" />
|
| | | <result column="identifycode" property="openid" jdbcType="VARCHAR" />
|
| | | <result column="login_type" property="loginType" jdbcType="INTEGER" />
|
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" />
|
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" />
|
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
|
| | | <result column="uiet_taobao_nick_name" property="tbName" jdbcType="VARCHAR" />
|
| | | <result column="tbPic" property="tbPic" jdbcType="VARCHAR" />
|
| | | <result column="wxName" property="wxName" jdbcType="VARCHAR" />
|
| | | <result column="wxPic" property="wxPic" jdbcType="VARCHAR" />
|
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR" />
|
| | | <result column="createtime" property="createtime" jdbcType="BIGINT" />
|
| | | <result column="last_logintime" property="lastLoginTime"
|
| | | jdbcType="BIGINT" />
|
| | | <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
|
| | | <result column="tuiguang_code" property="tuiGuangCode"
|
| | | jdbcType="VARCHAR" />
|
| | | <result column="appid" property="appId" jdbcType="VARCHAR" />
|
| | | <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
|
| | | <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
|
| | | <result column="rank" property="rank" jdbcType="INTEGER" />
|
| | | <result column="phone" property="phone" jdbcType="VARCHAR" />
|
| | | <result column="state" property="state" jdbcType="INTEGER" />
|
| | | <result column="state_desc" property="stateDesc" jdbcType="VARCHAR" />
|
| | | |
| | | <result column="ur_id" property="rankId" jdbcType="BIGINT" />
|
| | | <result column="ur_name" property="rankName" jdbcType="VARCHAR" />
|
| | | <result column="ur_picture" property="rankPicture" jdbcType="VARCHAR" />
|
| | | |
| | | <result column="totalOrder" property="totalOrder" jdbcType="BIGINT" />
|
| | | <result column="monthOrder" property="monthOrder" jdbcType="BIGINT" />
|
| | | |
| | | <result column="uiet_special_id" property="tbSpecialId" jdbcType="VARCHAR" />
|
| | | <result column="uiet_relation_id" property="tbRelationId" jdbcType="VARCHAR" />
|
| | | <result column="uiet_taobao_uid" property="taoBaoUid" jdbcType="VARCHAR" />
|
| | | |
| | | <result column="wxUnionIdInvalid" property="wxUnionIdInvalid" jdbcType="VARCHAR" />
|
| | | <result column="taobaoUidInvalid" property="taobaoUidInvalid" jdbcType="VARCHAR" />
|
| | | <result column="phoneInvalid" property="phoneInvalid" jdbcType="VARCHAR" />
|
| | | <result column="alipayAccountInvalid" property="alipayAccountInvalid" jdbcType="VARCHAR" />
|
| | | |
| | | </resultMap>
|
| | | |
| | | <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user where id = #{id,jdbcType=BIGINT} and `state`=0
|
| | | </select>
|
| | | |
| | | <select id="selectByPKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user where id = #{id,jdbcType=BIGINT} |
| | | </select>
|
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user where id = #{id,jdbcType=BIGINT} for update
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_user where id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user
|
| | | (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{tuiGuangCode,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system.id,jdbcType=BIGINT},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_user
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">id,</if>
|
| | | <if test="openid != null">identifycode,</if>
|
| | | <if test="loginType != null">login_type,</if>
|
| | | <if test="wxOpenId != null">wx_open_id,</if>
|
| | | <if test="wxUnionId != null">wx_union_id,</if>
|
| | | <if test="nickName != null">nick_name,</if>
|
| | | <if test="tbName != null">tbName,</if>
|
| | | <if test="tbPic != null">tbPic,</if>
|
| | | <if test="wxName != null">wxName,</if>
|
| | | <if test="wxPic != null">wxPic,</if>
|
| | | <if test="portrait != null">portrait,</if>
|
| | | <if test="createtime != null">createtime,</if>
|
| | | <if test="lastLoginTime != null">last_logintime,</if>
|
| | | <if test="lastLoginIp != null">loginip,</if>
|
| | | <if test="tuiGuangCode != null">tuiguang_code,</if>
|
| | | <if test="appId != null">appid,</if>
|
| | | <if test="myHongBao != null">my_hongBao,</if>
|
| | | <if test="payPassword != null">pay_password,</if>
|
| | | <if test="system != null">sid,</if>
|
| | | <if test="rank != null">rank,</if>
|
| | | <if test="phone != null">phone,</if>
|
| | | <if test="state != null">state,</if>
|
| | | <if test="stateDesc != null">state_desc,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="openid != null">#{openid,jdbcType=VARCHAR},</if>
|
| | | <if test="loginType != null">#{loginType,jdbcType=INTEGER},</if>
|
| | | <if test="wxOpenId != null">#{wxOpenId,jdbcType=VARCHAR},</if>
|
| | | <if test="wxUnionId != null">#{wxUnionId,jdbcType=VARCHAR},</if>
|
| | | <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="tbName != null">#{tbName,jdbcType=VARCHAR},</if>
|
| | | <if test="tbPic != null">#{tbPic,jdbcType=VARCHAR},</if>
|
| | | <if test="wxName != null">#{wxName,jdbcType=VARCHAR},</if>
|
| | | <if test="wxPic != null">#{wxPic,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginTime != null">#{lastLoginTime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginIp != null">#{lastLoginIp,jdbcType=VARCHAR},</if>
|
| | | <if test="tuiGuangCode != null">#{tuiGuangCode,jdbcType=VARCHAR},</if>
|
| | | <if test="appId != null">#{appId,jdbcType=VARCHAR},</if>
|
| | | <if test="myHongBao != null">#{myHongBao,jdbcType=DECIMAL},</if>
|
| | | <if test="payPassword != null">#{payPassword,jdbcType=VARCHAR},</if>
|
| | | <if test="system != null">#{system.id,jdbcType=BIGINT},</if>
|
| | | <if test="rank != null">#{rank,jdbcType=INTEGER},</if>
|
| | | <if test="phone != null">#{phone,jdbcType=VARCHAR},</if>
|
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if>
|
| | | <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR}</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">update
|
| | | yeshi_ec_user set identifycode = #{openid,jdbcType=VARCHAR},login_type
|
| | | = #{loginType,jdbcType=INTEGER},wx_open_id =
|
| | | #{wxOpenId,jdbcType=VARCHAR},wx_union_id =
|
| | | #{wxUnionId,jdbcType=VARCHAR},nick_name =
|
| | | #{nickName,jdbcType=VARCHAR},tbName = #{tbName,jdbcType=VARCHAR},tbPic
|
| | | = #{tbPic,jdbcType=VARCHAR},wxName = #{wxName,jdbcType=VARCHAR},wxPic
|
| | | = #{wxPic,jdbcType=VARCHAR},portrait =
|
| | | #{portrait,jdbcType=VARCHAR},createtime =
|
| | | #{createtime,jdbcType=BIGINT},last_logintime =
|
| | | #{lastLoginTime,jdbcType=BIGINT},loginip =
|
| | | #{lastLoginIp,jdbcType=VARCHAR},tuiguang_code =
|
| | | #{tuiGuangCode,jdbcType=VARCHAR},appid =
|
| | | #{appId,jdbcType=VARCHAR},my_hongBao =
|
| | | #{myHongBao,jdbcType=DECIMAL},pay_password =
|
| | | #{payPassword,jdbcType=VARCHAR},sid =
|
| | | #{system.id,jdbcType=BIGINT},rank = #{rank,jdbcType=INTEGER} ,phone
|
| | | =#{phone,jdbcType=VARCHAR} ,state =#{state,jdbcType=INTEGER}
|
| | | ,state_desc =#{stateDesc,jdbcType=VARCHAR} where id =
|
| | | #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | update yeshi_ec_user
|
| | | <set>
|
| | | <if test="openid != null">identifycode=#{openid,jdbcType=VARCHAR},</if>
|
| | | <if test="loginType != null">login_type=#{loginType,jdbcType=INTEGER},</if>
|
| | | <if test="wxOpenId != null">wx_open_id=#{wxOpenId,jdbcType=VARCHAR},</if>
|
| | | <if test="wxUnionId != null">wx_union_id=#{wxUnionId,jdbcType=VARCHAR},</if>
|
| | | <if test="nickName != null">nick_name=#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="tbName != null">tbName=#{tbName,jdbcType=VARCHAR},</if>
|
| | | <if test="tbPic != null">tbPic=#{tbPic,jdbcType=VARCHAR},</if>
|
| | | <if test="wxName != null">wxName=#{wxName,jdbcType=VARCHAR},</if>
|
| | | <if test="wxPic != null">wxPic=#{wxPic,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">portrait=#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginTime != null">last_logintime=#{lastLoginTime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginIp != null">loginip=#{lastLoginIp,jdbcType=VARCHAR},</if>
|
| | | <if test="tuiGuangCode != null">tuiguang_code=#{tuiGuangCode,jdbcType=VARCHAR},</if>
|
| | | <if test="appId != null">appid=#{appId,jdbcType=VARCHAR},</if>
|
| | | <if test="myHongBao != null">my_hongBao=#{myHongBao,jdbcType=DECIMAL},</if>
|
| | | <if test="payPassword != null">pay_password=#{payPassword,jdbcType=VARCHAR},</if>
|
| | | <if test="system != null">sid=#{system.id,jdbcType=BIGINT},</if>
|
| | | <if test="rank != null">rank=#{rank,jdbcType=INTEGER},</if>
|
| | | <if test="phone !=null">phone =#{phone,jdbcType=VARCHAR},</if>
|
| | | <if test="state !=null">state =#{state,jdbcType=INTEGER},</if>
|
| | | <if test="stateDesc !=null">state_desc =#{stateDesc,jdbcType=VARCHAR},</if>
|
| | | </set>
|
| | | where id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="subHongBaoByUid">update yeshi_ec_user set my_hongBao=
|
| | | my_hongBao-#{money,jdbcType=DECIMAL} where id = #{uid,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="addHongBaoByUid">update yeshi_ec_user set my_hongBao=
|
| | | my_hongBao+#{money,jdbcType=DECIMAL} where id = #{uid,jdbcType=BIGINT}
|
| | | </update>
|
| | | <!-- 清除手势密码 -->
|
| | | <delete id="cleanPassword">DELETE FROM `yeshi_ec_extract_record` WHERE uid =
|
| | | #{id};
|
| | | </delete>
|
| | | <!-- 查询新人红包 -->
|
| | | <select id="getNewPeopleHB" resultType="BigDecimal">SELECT sum(hb.`money`)
|
| | | FROM `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id} AND hb.`type` = '4';
|
| | | </select>
|
| | | <!-- 查询我的红包 -->
|
| | | <select id="getMyHB" resultType="BigDecimal">SELECT SUM(hb.`money`) FROM
|
| | | `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id};
|
| | | </select>
|
| | | <!-- 根据AppId与微信unionID获取用户 -->
|
| | | <select id="listByAppIdAndWXUnionId" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user where appid=#{appId} and wx_union_id=#{unionId}
|
| | | </select>
|
| | | <!-- 根据AppId与淘宝OpenId获取用户 -->
|
| | | <select id="listByAppIdAndTaoBaoOpenId" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user where appid=#{appId} and identifycode=#{openId}
|
| | | </select>
|
| | | <!-- 根据AppId与电话号码获取用户 -->
|
| | | <select id="listByAppIdAndPhone" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user where appid=#{appId} and phone=#{phone} |
| | | </select>
|
| | | |
| | | <!-- 根据AppId与电话号码获取用户 -->
|
| | | <select id="getEffectiveUserInfoByPhone" resultMap="BaseResultMap">
|
| | | select <include refid="Base_Column_List" /> from yeshi_ec_user |
| | | where phone=#{phone} AND state = 0 |
| | | LIMIT 1 |
| | | </select>
|
| | | |
| | | <!-- 根据AppId与电话号码获取用户 -->
|
| | | <select id="getEffectiveUserInfoByWXUnionId" resultMap="BaseResultMap">
|
| | | select <include refid="Base_Column_List" /> from yeshi_ec_user |
| | | where wx_union_id=#{unionId} AND state = 0 |
| | | LIMIT 1 |
| | | </select>
|
| | | |
| | | <select id="getMaxUid" resultType="java.lang.Long">select max(id) from
|
| | | yeshi_ec_user
|
| | | </select>
|
| | | <!-- 两个账号的业务融合 -->
|
| | | <select id="connectUser" >
|
| | | call procedure_connect_user(#{mainUid},#{lessUid})
|
| | | </select>
|
| | | |
| | | <select id="query" resultMap="BaseResultMapVO">
|
| | | SELECT *
|
| | | ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb |
| | | WHERE hb.hb_uid = u.id AND hb.hb_type = 1 )AS totalOrder <!-- 累计订单 -->
|
| | | ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb |
| | | WHERE hb.hb_uid = u.id AND hb.hb_type = 1
|
| | | AND DATE_FORMAT(hb.`hb_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m'))AS monthOrder <!-- 累计本月订单 -->
|
| | | ,(SELECT COUNT(tr.`id`) FROM `yeshi_ec_threesale` tr <!-- 队员 -->
|
| | | WHERE tr.`boss_id`=u.id AND tr.state = 1) AS totalPlayers |
| | | FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` |
| | | LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
|
| | | LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
|
| | | LEFT JOIN yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
|
| | | |
| | | <if test="userState == 2">
|
| | | LEFT JOIN |
| | | (SELECT A.uid AS buid,MAX(A.f_wxUnionId) AS wxUnionIdInvalid ,MAX(A.f_taobaoUid) AS taobaoUidInvalid,MAX(A.f_phone) AS phoneInvalid,MAX(A.f_alipayAccount) AS alipayAccountInvalid FROM |
| | | (SELECT u.`id`AS uid,b.account AS alipayAccount,b.name AS alipayAccountName,fu.* FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON b.`uid` = u.`id`
|
| | | LEFT JOIN yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
|
| | | LEFT JOIN (SELECT fc.fuc_effective,IF(fc.`fuc_type` = 'wxUnionId',fc.`fuc_identify_code`,NULL)AS f_wxUnionId,
|
| | | IF(fc.`fuc_type` = 'taobaoUid',fc.`fuc_identify_code`,NULL)AS f_taobaoUid,
|
| | | IF(fc.`fuc_type` = 'phone',fc.`fuc_identify_code`,NULL)AS f_phone,
|
| | | IF(fc.`fuc_type` = 'alipayAccount',fc.`fuc_identify_code`,NULL)AS f_alipayAccount
|
| | | FROM yeshi_ec_forbidden_user_identify_code fc WHERE fc.fuc_effective = 1 )fu ON (fu.f_wxUnionId = u.`wx_union_id` OR fu.f_taobaoUid = tb.`uiet_taobao_uid` OR fu.f_phone = u.`phone` OR fu.f_alipayAccount = b.`account`)
|
| | | WHERE u.`state` =2 |
| | | )A GROUP BY A.uid) B ON u.id= B.buid |
| | | </if>
|
| | | |
| | | where 1=1
|
| | | <if test="userState == 1">
|
| | | AND u.`state` <![CDATA[<>]]> 2 <!-- 正常用户 -->
|
| | | </if>
|
| | | <if test="userState == 2">
|
| | | AND u.`state` =2 <!-- 封禁用户 -->
|
| | | </if>
|
| | | <if test="startTime != null and startTime !='' ">
|
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]> DATE_FORMAT(#{startTime},'%Y%m%d')
|
| | | </if>
|
| | | <if test="endTime != null and endTime !=''">
|
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]> DATE_FORMAT(#{endTime},'%Y%m%d') |
| | | </if>
|
| | | <if test="userRank != null">
|
| | | AND rak.ur_name = #{userRank}
|
| | | </if>
|
| | | <if test="days != null">
|
| | | <!-- 注册时间 -->
|
| | | AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]> |
| | | </if>
|
| | | <if test="key != null and key !='' ">
|
| | | <if test="keyType == 1">
|
| | | AND u.id = #{key}
|
| | | </if>
|
| | | <if test="keyType == 2">
|
| | | AND u.`nick_name` LIKE '%${key}%'
|
| | | </if>
|
| | | <if test="keyType == 3">
|
| | | AND u.`phone` = #{key}
|
| | | </if>
|
| | | <if test="keyType == 4">
|
| | | AND b.`account` = #{key}
|
| | | </if>
|
| | | </if>
|
| | | |
| | | ORDER BY |
| | | <if test="orderField == 1">
|
| | | totalOrder,
|
| | | </if>
|
| | | <if test="orderField == 2">
|
| | | totalOrder DESC,
|
| | | </if>
|
| | | <if test="orderField == 3">
|
| | | monthOrder,
|
| | | </if>
|
| | | <if test="orderField == 4">
|
| | | monthOrder DESC,
|
| | | </if>
|
| | | <if test="orderField == 5">
|
| | | totalPlayers,
|
| | | </if>
|
| | | <if test="orderField == 6">
|
| | | totalPlayers DESC,
|
| | | </if>
|
| | | u.createtime DESC |
| | | |
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | | |
| | | <select id="queryCount" resultType="java.lang.Long">
|
| | | SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` |
| | | LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
|
| | | LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
|
| | | where 1=1
|
| | | |
| | | <if test="userState == 1">
|
| | | AND u.`state` <![CDATA[<>]]> 2 <!-- 正常用户 -->
|
| | | </if>
|
| | | <if test="userState == 2">
|
| | | AND u.`state` =2 <!-- 封禁用户 -->
|
| | | </if>
|
| | | <if test="startTime != null and startTime !='' ">
|
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]> DATE_FORMAT(#{startTime},'%Y%m%d')
|
| | | </if>
|
| | | <if test="endTime != null and endTime !=''">
|
| | | AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]> DATE_FORMAT(#{endTime},'%Y%m%d') |
| | | </if>
|
| | | <if test="userRank != null">
|
| | | AND rak.ur_name = #{userRank}
|
| | | </if>
|
| | | <if test="days != null"> <!-- 注册时间 -->
|
| | | AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]> |
| | | </if>
|
| | | |
| | | <if test="key != null and key !='' ">
|
| | | <if test="keyType == 1">
|
| | | AND u.id = #{key}
|
| | | </if>
|
| | | <if test="keyType == 2">
|
| | | AND u.`nick_name` LIKE '%${key}%'
|
| | | </if>
|
| | | <if test="keyType == 3">
|
| | | AND u.`phone` = #{key}
|
| | | </if>
|
| | | <if test="keyType == 4">
|
| | | AND b.`account` = #{key}
|
| | | </if>
|
| | | </if>
|
| | | </select>
|
| | | |
| | | <select id="querySumMoney" resultType="java.lang.Double">
|
| | | SELECT COALESCE(sum(u.my_hongBao),0) FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` |
| | | where <![CDATA[ 1>0 ]]> |
| | | <if test="key != null and key !='' ">
|
| | | AND (u.id LIKE '%${key}%' OR u.`phone` LIKE '%${key}%' OR u.`wxName` LIKE '%${key}%'
|
| | | OR u.`nick_name` LIKE '%${key}%' OR u.`tbName` LIKE '%${key}%' OR b.`account` LIKE '%${key}%')
|
| | | </if>
|
| | | <if test="startTime != null and startTime !='' ">
|
| | | <![CDATA[ AND FROM_UNIXTIME(createtime/1000) >= '${startTime}' ]]> |
| | | </if>
|
| | | <if test="endTime != null and endTime !=''">
|
| | | <![CDATA[ AND FROM_UNIXTIME(createtime/1000) < '${endTime}' ]]> |
| | | </if>
|
| | | <if test="userType != null">
|
| | | AND u.rank = #{userType}
|
| | | </if>
|
| | | <if test="days != null">
|
| | | <!-- 时间 -->
|
| | | AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(createtime/1000)]]> |
| | | </if>
|
| | | </select>
|
| | | |
| | | |
| | | <select id="countNewUser" resultType="java.lang.Long">
|
| | | SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` |
| | | WHERE 1=1
|
| | | <if test="isToday != null and isToday == 1">
|
| | | AND TO_DAYS(FROM_UNIXTIME(createtime/1000)) = TO_DAYS(NOW())
|
| | | </if>
|
| | | <if test="isMonth != null and isMonth == 1">
|
| | | AND DATE_FORMAT( FROM_UNIXTIME(createtime/1000), '%Y%m' ) = DATE_FORMAT(CURDATE() , '%Y%m' )
|
| | | </if>
|
| | | </select>
|
| | | |
| | | <select id="countRank" resultType="java.lang.Long">
|
| | | <!-- 等级统计 -->
|
| | | SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` WHERE rank = #{rank}
|
| | | </select>
|
| | | |
| | | <select id="countAllMoney" resultType="java.math.BigDecimal">
|
| | | <!-- 金额统计 -->
|
| | | SELECT CAST(SUM(my_hongBao)AS DECIMAL(19,2)) FROM `yeshi_ec_user` |
| | | WHERE 1=1 |
| | | <if test="minMoney != null">
|
| | | AND <![CDATA[ my_hongBao >= #{minMoney}]]> |
| | | </if>
|
| | | </select>
|
| | | |
| | | <select id="countShareAndInviteMoney" resultMap="BaseResultMap">
|
| | | SELECT IFNULL(SUM(h.`money`),0),h.`uid` FROM `yeshi_ec_hongbao` h |
| | | WHERE DATE_FORMAT(FROM_UNIXTIME(h.`createtime`/1000), '%Y-%m-%d' )= '2018-08-02'
|
| | | <![CDATA[AND h.state <>4]]> |
| | | AND ( h.`type` =5 OR h.`type` =6 OR h.`type` =7 OR h.`type` =20 OR h.`type` =21 OR h.`type` =22 )
|
| | | GROUP BY h.`uid` |
| | | ORDER BY SUM(h.`money`) DESC
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | | |
| | | <select id="longTimeNoLogin" resultType="java.lang.Long">
|
| | | |
| | | SELECT u.`id` FROM `yeshi_ec_user` u |
| | | WHERE u.`id` IN <foreach item="item" collection="list" open="(" separator=","
|
| | | close=")">#{item}</foreach>
|
| | | AND <![CDATA[ (DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`last_logintime`/1000)) |
| | | OR (u.`last_logintime` IS NULL |
| | | AND DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`createTime`/1000)))) ]]>
|
| | | </select>
|
| | | |
| | | |
| | | <select id="countLoseUser" resultType="java.lang.Long">
|
| | | SELECT COUNT(DISTINCT t.`id` ) FROM `yeshi_ec_user` t |
| | | LEFT JOIN `yeshi_ec_user_money_detail` d ON d.`umd_uid` = t.`id` |
| | | WHERE DATE_SUB(CURDATE(), INTERVAL ${num} DAY)<![CDATA[> ]]> DATE(FROM_UNIXTIME( t.`last_logintime`/1000)) |
| | | AND DATE_SUB(CURDATE(), INTERVAL ${num} DAY) <![CDATA[> ]]> DATE(d.`umd_createtime`)
|
| | | </select>
|
| | | |
| | | <select id="countHasOrderUser" resultType="java.lang.Long">
|
| | | SELECT COUNT(DISTINCT h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE (h.`hb_type`=1 or h.`hb_type`=2 or h.`hb_type`= 20)
|
| | | </select>
|
| | | |
| | | |
| | | <select id="countNewUserByDate" resultType="java.util.HashMap">
|
| | | SELECT COUNT(DISTINCT h.`id`) AS showValue,
|
| | | <if test="type == 1">
|
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate'
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate'
|
| | | </if>
|
| | | FROM yeshi_ec_user h |
| | | <if test="channel != null and channel != 'all' ">
|
| | | left join (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`)a ON h.`id`=a.uid |
| | | </if>
|
| | | WHERE 1=1
|
| | | <if test="channel != null and channel != 'all' ">
|
| | | AND a.uid is not null
|
| | | </if>
|
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
|
| | | </if>
|
| | | <if test="years != null and years != '' ">
|
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}'
|
| | | </if>
|
| | | <if test="type == 1">
|
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') |
| | | </if>
|
| | | <if test="type == 2">
|
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m') |
| | | </if>
|
| | | <if test="type == 3">
|
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y') |
| | | </if> |
| | | ORDER BY h.`createtime`
|
| | | </select>
|
| | | |
| | | <select id="getTodayHasOrder" resultType="java.util.HashMap">
|
| | | SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue', |
| | | <if test="type == 1">
|
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
|
| | | </if>
|
| | | <if test="type == 2">
|
| | | FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
|
| | | </if>
|
| | | <if test="type == 3">
|
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
|
| | | </if>
|
| | | |
| | | FROM yeshi_ec_user u |
| | | <if test="channel != null and channel != 'all' ">
|
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid
|
| | | </if>
|
| | | LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id`
|
| | | WHERE (h.`hb_type`=1 OR h.`hb_type`=20) |
| | | <if test="channel != null and channel != 'all' ">
|
| | | AND a.uid is not null
|
| | | </if>
|
| | | <!-- 当日下单 -->
|
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = DATE_FORMAT(h.hb_create_time,'%Y-%m-%d')
|
| | | |
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
|
| | | </if>
|
| | | <if test="years != null and years != '' ">
|
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
|
| | | </if>
|
| | | <if test="type == 1">
|
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') |
| | | </if>
|
| | | <if test="type == 2">
|
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m') |
| | | </if>
|
| | | <if test="type == 3">
|
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y') |
| | | </if> |
| | | ORDER BY u.`createtime`
|
| | | </select>
|
| | | |
| | | |
| | | |
| | | <select id="getWeekHasOrder" resultType="java.util.HashMap">
|
| | | SELECT COUNT(DISTINCT hb.uid) AS showValue,FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
|
| | | FROM (SELECT COUNT(v2.`hb_id`) AS num,v2.hb_uid AS uid
|
| | | FROM yeshi_ec_hongbao_v2 v2
|
| | | WHERE (v2.`hb_type`=1 OR v2.`hb_type`=20) |
| | | AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ >= ]]>'${startTime}'
|
| | | AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
|
| | | GROUP BY v2.hb_uid HAVING num >= ${orderNum})hb
|
| | | LEFT JOIN yeshi_ec_user u ON u.id = hb.uid |
| | | <if test="channel != null and channel != 'all' ">
|
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid
|
| | | </if>
|
| | | WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}'
|
| | | <if test="channel != null and channel != 'all' ">
|
| | | AND a.uid is not null
|
| | | </if>
|
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') |
| | | ORDER BY u.`createtime`
|
| | | </select>
|
| | | |
| | | <select id="getInfoByPhoneOrInviteCode" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_user u |
| | | LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` = u.`id`
|
| | | WHERE uf.`uie_invite_code` IS NOT NULL |
| | | AND (u.`phone` =#{phone} OR uf.`uie_invite_code` = #{inviteCode})
|
| | | LIMIT 1
|
| | | </select>
|
| | |
|
| | | </mapper>
|