123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <?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.caimei365.user.mapper.LoginMapper">
- <select id="getLoginUserByUserId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.userName as userName,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userPermission as userPermission,
- u.userIdentity as userIdentity,
- u.password as password
- from user u
- where u.userID = #{userId}
- limit 1
- </select>
- <select id="getLoginUserByMobileOrEmail" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.userName as userName,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userPermission as userPermission,
- u.userIdentity as userIdentity,
- u.password as password,
- case
- when u.userIdentity = 3 then u.manufacturerStatus
- when (u.userIdentity = 2 or u.userIdentity = 4) then u.clubStatus
- else 0
- end as status
- from user u
- left join cm_mall_operation_user cu on cu.userID = u.userID
- where (u.bindMobile = #{mobileOrEmail}
- or u.email = #{mobileOrEmail}
- or (cu.mobile = #{mobileOrEmail} and cu.delFlag != 1)
- ) and u.userIdentity in (1,2,3,4)
- limit 1
- </select>
- <select id="getOperationByMobile" resultType="com.caimei365.user.model.po.OperationPo">
- select o.userID as userId,
- o.mobile as mobile,
- o.clubID as clubId,
- o.shopID as shopId,
- o.unionId as unionId
- from cm_mall_operation_user o
- where o.mobile = #{mobile} and o.delFlag = '0'
- limit 1
- </select>
- <select id="getServiceProviderByOpenId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.userName as userName,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userPermission as userPermission,
- u.userIdentity as userIdentity,
- u.password as password
- from serviceprovider s
- left join user u on s.userID = u.userID
- where s.openid = #{openid} and u.validFlag = 1
- limit 1
- </select>
- <select id="getOperationUserByUnionId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select o.userID as userId,
- o.mobile as mobile,
- o.clubID as clubId,
- o.shopID as shopId,
- o.unionId as unionId,
- <if test="source=='www'">
- o.pcOpenid as openId
- </if>
- <if test="source=='crm'">
- o.crmOpenid as openId
- </if>
- <if test="source=='mini'">
- o.openid as openId
- </if>
- from
- cm_mall_operation_user o
- where unionId = #{unionId} and delFlag = '0'
- and (userOrganizeID='2' or userOrganizeID is null)
- limit 1
- </select>
- <select id="getOperationUserByOpenId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select o.userID as userId,
- o.mobile as mobile,
- o.clubID as clubId,
- o.shopID as shopId,
- o.unionId as unionId,
- <if test="source=='www'">
- o.pcOpenid as openId
- </if>
- <if test="source=='crm'">
- o.crmOpenid as openId
- </if>
- <if test="source=='mini'">
- o.openid as openId
- </if>
- from
- cm_mall_operation_user o
- where
- <if test="source=='www'">
- pcOpenid = #{openId}
- </if>
- <if test="source=='crm'">
- crmOpenid = #{openId}
- </if>
- <if test="source=='mini'">
- openid = #{openId}
- </if>
- and delFlag = '0'
- and (userOrganizeID='2' or userOrganizeID is null)
- limit 1
- </select>
- <update id="updateServiceProviderUnionId">
- update serviceprovider
- set unionId = #{unionId}
- where userID = #{userId}
- </update>
- <update id="updateOperationOpenId">
- update cm_mall_operation_user
- set openid = #{openId}
- where userID = #{userId}
- </update>
- <update id="updateOperationUnionId">
- update cm_mall_operation_user
- set unionId = #{unionId}
- where userID = #{userId}
- </update>
- <update id="updateOperationByInvitation">
- update cm_mall_operation_user
- set unionId = #{unionId},
- openId = #{openId},
- nickName = #{nickName},
- headimgurl = #{avatarUrl},
- status = #{status},
- <if test="clubId != null">
- clubId = #{clubId},
- shopId = null,
- </if>
- <if test="shopId != null">
- shopId = #{shopId},
- clubId = null,
- </if>
- userType = #{userType},
- where id = #{id}
- </update>
- <update id="updateOperationByUnbind">
- update cm_mall_operation_user
- set unionId = #{unionId},
- openId = #{openId},
- nickName = #{nickName},
- bindTime = #{bindTime},
- updateTime = #{updateTime},
- status = #{status},
- userType = #{userType},
- <if test="clubId != null">
- clubId = #{clubId},
- shopId = null,
- </if>
- <if test="shopId != null">
- shopId = #{shopId},
- clubId = null,
- </if>
- delFlag = #{delFlag}
- where id = #{id}
- </update>
- <select id="getUserIdByOpenId" resultType="java.lang.Integer">
- select o.userID as userId
- from
- cm_mall_operation_user o
- where
- <if test="source=='www'">
- pcOpenid = #{openId}
- </if>
- <if test="source=='crm'">
- crmOpenid = #{openId}
- </if>
- <if test="source=='mini'">
- openid = #{openId}
- </if>
- and delFlag = '0'
- and (userOrganizeID='2' or userOrganizeID is null)
- limit 1
- </select>
- <select id="getOperationUserByInvitationCode" resultType="com.caimei365.user.model.vo.UserLoginVo">
- SELECT
- cou.id as operationId,
- u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- cou.invitationCodeTime,
- cou.status as operationStatus,
- cou.delFlag,
- u.userIdentity,
- case
- when u.userIdentity = 3 then u.manufacturerStatus
- when (u.userIdentity = 2 or u.userIdentity = 4) then u.clubStatus
- else 0
- end as status
- FROM
- cm_mall_operation_user cou
- LEFT JOIN user u ON u.userID = cou.userID
- WHERE
- cou.invitationCode = #{invitationCode}
- AND (cou.userOrganizeID = '2' OR cou.userOrganizeID IS NULL)
- AND u.userIdentity in (2,3,4)
- </select>
- </mapper>
|