123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553 |
- <?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.serviceProviderId as serviceProviderId,
- u.userName as userName,
- u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.password as password,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus
- 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.userOrganizeID as organizeId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,
- u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.password as password,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus,
- u.partnerId as partnerId,
- cu.id as operationId,
- cu.status as operationStatus,
- cu.mobile as operationMobile
- from user u
- left join cm_mall_operation_user cu on cu.userID = u.userID
- where (u.bindMobile = #{mobileOrEmail} or u.email = #{mobileOrEmail})
- and IF(u.userIdentity = 3, u.manufacturerStatus = 90, 1 = 1)
- and u.userIdentity in (1, 2, 3, 4)
- and u.userOrganizeID = 0
- union
- SELECT u.userID AS userId,
- u.userOrganizeID as organizeId,
- u.clubID AS clubId,
- u.shopID AS shopId,
- u.serviceProviderId AS serviceProviderId,
- u.userName AS userName,
- u.name AS NAME,
- u.mobile AS mobile,
- u.bindMobile AS bindMobile,
- u.email AS email,
- u.userIdentity AS userIdentity,
- u.password AS PASSWORD,
- u.guideFlag AS guideFlag,
- u.partnerId as partnerId,
- (select status from club where userId = u.userId limit 1) AS clubStatus,
- u.manufacturerStatus AS shopStatus,
- cu.id AS operationId,
- cu.status AS operationStatus,
- cu.mobile AS operationMobile
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE cu.mobile = #{mobileOrEmail}
- and IF(u.userIdentity = 3, u.manufacturerStatus = 90, 1 = 1)
- and cu.delFlag != 1
- AND u.userIdentity IN (1, 2, 3, 4)
- AND u.userOrganizeID = 0
- limit 1
- </select>
- <select id="getLoginOrganizeUserByMobileOrEmail" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.userOrganizeID as organizeId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,
- u.name as name,
- (SELECT linkMan FROM club WHERE userId = u.userID) as clubLinkMan,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.password as password,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus,
- u.serviceProviderStatus as serviceStatus,
- cu.id as operationId,
- cu.status as operationStatus,
- cu.mobile as operationMobile
- from user u
- left join cm_mall_operation_user cu on cu.userID = u.userID
- where (u.bindMobile = #{mobileOrEmail} or u.email = #{mobileOrEmail})
- and u.userIdentity in (1, 2, 3, 4)
- and u.userOrganizeID = 4
- union
- SELECT u.userID AS userId,
- u.userOrganizeID as organizeId,
- u.clubID AS clubId,
- u.shopID AS shopId,
- u.serviceProviderId AS serviceProviderId,
- u.userName AS userName,
- u.name AS NAME,
- (SELECT linkMan FROM club WHERE userId = u.userID) as clubLinkMan,
- u.mobile AS mobile,
- u.bindMobile AS bindMobile,
- u.email AS email,
- u.userIdentity AS userIdentity,
- u.password AS PASSWORD,
- u.guideFlag AS guideFlag,
- (select status from club where userId = u.userId limit 1) AS clubStatus,
- u.manufacturerStatus AS shopStatus,
- u.serviceProviderStatus as serviceStatus,
- cu.id AS operationId,
- cu.status AS operationStatus,
- cu.mobile AS operationMobile
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE cu.mobile = #{mobileOrEmail}
- and cu.delFlag != 1
- AND u.userIdentity IN (1, 2, 3, 4)
- AND u.userOrganizeID = 4
- limit 1
- </select>
- <select id="getOperationUser" resultType="java.lang.Integer">
- select id
- from cm_mall_operation_user
- where mobile = #{mobileOrEmail}
- and delFlag = 0
- and userOrganizeID = 4
- limit 1
- </select>
- <insert id="insertOperation">
- INSERT INTO cm_mall_operation_user (userOrganizeID, userType, userID, clubID, mobile, linkName, STATUS, unionId,
- bindTime, addTime, delFlag)
- values (#{organizeId}, #{userType}, #{userId}, #{clubId}, #{mobile}, #{linkName}, #{status}, #{unionId},
- #{bindTime}, #{addTime}, #{delFlag})
- </insert>
- <select id="getLoginUserByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,
- u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.password as password,
- u.guideFlag as guideFlag,
- u.manufacturerStatus as shopStatus,
- cu.id as operationId,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- cu.mobile as operationMobile
- from user u
- left join cm_mall_operation_user cu on cu.userID = u.userID
- where (u.bindMobile = #{mobile} or (cu.mobile = #{mobile} and cu.delFlag != 1))
- and u.userOrganizeID = #{organizeId}
- and u.userIdentity in (1, 2, 3, 4)
- limit 1
- </select>
- <select id="getServiceProviderUserByOpenId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select s.serviceProviderId as serviceProviderId,
- s.userID as userId,
- u.userName as userName,
- u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.guideFlag as guideFlag,
- u.password as password,
- s.insiderFlag as insideFlag
- from serviceprovider s
- left join user u on s.userID = u.userID
- where s.openid = #{openId}
- and s.organizeId = #{organizeId}
- and u.validFlag = 1
- limit 1
- </select>
- <update id="updateUserInfo">
- update user
- set openId = #{openId},
- unionId = #{unionId}
- where userId = #{userId}
- </update>
- <select id="getServiceProviderByUserId" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
- select s.serviceProviderId as serviceProviderId,
- s.status as status,
- s.userID as userId
- from serviceprovider s
- where s.userID = #{userId}
- limit 1
- </select>
- <select id="getLoginUserByUnionId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.password as password,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus,
- o.unionId as unionId,
- o.status as operationStatus,
- o.mobile as operationMobile,
- <if test="source=='www'">
- o.pcOpenid as openId
- </if>
- <if test="source=='mini'">
- o.openid as openId
- </if>
- from user u
- left join cm_mall_operation_user o on o.userID = u.userID
- where (o.unionId = #{unionId} and o.delFlag = '0')
- and (u.userIdentity in (1,2,3,4) and u.userOrganizeID = 0)
- limit 1
- </select>
- <select id="getOrganizeLoginUserByUnionId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.serviceProviderID as serviceProviderId,
- u.password as password,
- u.guideFlag as guideFlag,
- c.status as clubStatus,
- u.manufacturerStatus as shopStatus,
- u.serviceProviderStatus as serviceStatus,
- o.unionId as unionId,
- o.status as operationStatus,
- o.mobile as operationMobile,
- c.headpic AS shopPhoto,
- <if test="source=='www'">
- o.pcOpenid as openId
- </if>
- <if test="source=='mini'">
- o.openid as openId
- </if>
- from user u
- left join cm_mall_operation_user o on o.userID = u.userID
- LEFT JOIN club c ON c.userID = u.userID
- where (o.unionId = #{unionId} and o.delFlag = '0')
- and (u.userIdentity in (1,2,3,4) and u.userOrganizeID != 0)
- limit 1
- </select>
- <select id="getLoginUserByOpenId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.password as password,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus,
- o.unionId as unionId,
- o.status as operationStatus,
- o.mobile as operationMobile,
- <if test="source=='www'">
- o.pcOpenid as openId
- </if>
- <if test="source=='mini'">
- o.openid as openId
- </if>
- from user u
- left join cm_mall_operation_user o on o.userID = u.userID
- where (
- <if test="source=='www'">
- o.pcOpenid = #{openId}
- </if>
- <if test="source=='crm'">
- o.crmOpenid = #{openId}
- </if>
- <if test="source=='mini'">
- o.openid = #{openId}
- </if>
- and o.delFlag = '0')
- and (u.userIdentity in (1,2,3,4) and u.userOrganizeID = 0)
- limit 1
- </select>
- <select id="getOrganizeLoginUserByOpenId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userIdentity as userIdentity,
- u.serviceProviderID as serviceProviderId,
- u.password as password,
- u.guideFlag as guideFlag,
- c.status as clubStatus,
- u.manufacturerStatus as shopStatus,
- o.unionId as unionId,
- o.status as operationStatus,
- o.mobile as operationMobile,
- c.headpic AS shopPhoto,
- <if test="source=='www'">
- o.pcOpenid as openId
- </if>
- <if test="source=='mini'">
- o.openid as openId
- </if>
- from user u
- left join cm_mall_operation_user o on o.userID = u.userID
- LEFT JOIN club c ON c.userID = u.userID
- where (
- <if test="source=='www'">
- o.pcOpenid = #{openId}
- </if>
- <if test="source=='crm'">
- o.crmOpenid = #{openId}
- </if>
- <if test="source=='mini'">
- o.openid = #{openId}
- </if>
- and o.delFlag = '0')
- and (u.userIdentity in (1,2,3,4) and u.userOrganizeID != 0)
- limit 1
- </select>
- <update id="updateServiceProviderUnionId">
- update serviceprovider
- set unionId = #{unionId}
- where userID = #{userId}
- </update>
- <update id="updateLogin">
- update user
- set loginTime = now()
- where userID = #{userId}
- </update>
- <select id="getShopProductGroudMall" resultType="java.lang.String">
- select p.groundMall AS groundMall
- from product p
- left join cm_organize_product_info copi on copi.productId = p.productID
- where p.shopId = #{shopId}
- and copi.validFlag = 2
- </select>
- <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=='mini'">
- openid = #{openId}
- </if>
- and delFlag = '0'
- and userOrganizeID=0
- 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,
- u.userName as userName,
- u.name as name,
- ifnull(cou.userOrganizeID, 0) as organizeId,
- u.userIdentity,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus,
- cou.invitationCodeTime,
- cou.mobile as operationMobile,
- cou.status as operationStatus,
- cou.delFlag
- FROM cm_mall_operation_user cou
- LEFT JOIN user u ON u.userID = cou.userID
- WHERE cou.invitationCode = #{invitationCode}
- AND cou.userOrganizeID = #{organizeId}
- AND u.userIdentity in (2, 3, 4)
- </select>
- <select id="getOperationOrganizeUserByInvitationCode" resultType="com.caimei365.user.model.vo.UserLoginVo">
- SELECT cou.id as operationId,
- u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.userName as userName,
- u.name as name,
- ifnull(cou.userOrganizeID, 0) as organizeId,
- u.userIdentity,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus,
- cou.invitationCodeTime,
- cou.mobile as operationMobile,
- cou.status as operationStatus,
- cou.delFlag
- FROM cm_mall_operation_user cou
- LEFT JOIN user u ON u.userID = cou.userID
- WHERE cou.invitationCode = #{invitationCode}
- AND cou.userOrganizeID = #{organizeId}
- AND u.userIdentity in (2, 3, 4)
- </select>
- <select id="getOperationUserByOperationId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- SELECT cou.id as operationId,
- u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.userName as userName,
- u.name as name,
- u.userIdentity,
- u.guideFlag as guideFlag,
- (select status from club where userId = u.userId limit 1) as clubStatus,
- u.manufacturerStatus as shopStatus,
- cou.invitationCodeTime,
- cou.mobile as operationMobile,
- cou.status as operationStatus,
- cou.delFlag
- FROM cm_mall_operation_user cou
- LEFT JOIN user u ON u.userID = cou.userID
- WHERE cou.id = #{operationId}
- AND cou.userOrganizeID = 0
- AND u.userIdentity in (2, 3, 4)
- </select>
- <select id="getOrganizeByOperationId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- SELECT cou.id as operationId,
- u.userID as userId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.userName as userName,
- u.name as name,
- u.userIdentity,
- u.guideFlag as guideFlag,
- u.clubStatus as clubStatus,
- u.manufacturerStatus as shopStatus,
- cou.invitationCodeTime,
- cou.mobile as operationMobile,
- cou.status as operationStatus,
- cou.delFlag
- FROM cm_mall_operation_user cou
- LEFT JOIN user u ON u.userID = cou.userID
- WHERE cou.id = #{operationId}
- AND cou.userOrganizeID = #{organizeId}
- AND u.userIdentity in (2, 3, 4)
- </select>
- <select id="getClubCountByClubName" resultType="java.lang.Integer">
- SELECT count(*)
- FROM club
- WHERE name = #{name}
- AND status NOT IN (2, 20, 21, 3, 30)
- </select>
- <select id="getMaxClubId" resultType="java.lang.Integer">
- SELECT MAX(clubID)
- FROM club
- </select>
- <select id="getMaxUserId" resultType="java.lang.Integer">
- SELECT MAX(userID)
- FROM user
- </select>
- <select id="getClubTypeById" resultType="java.lang.Integer">
- SELECT firstClubType
- FROM club
- WHERE userID = #{userId}
- limit 1
- </select>
- <select id="getClubSpUserId" resultType="java.lang.Integer">
- SELECT s.userID
- from serviceprovider s
- left join club c on c.spId = s.serviceProviderID
- WHERE c.clubId = #{clubId}
- limit 1
- </select>
- <update id="updateTourist">
- update cm_behavior_tourist_info
- set userId = #{userId}
- where touristId = #{touristId}
- </update>
- <select id="findTemPass" resultType="java.lang.String">
- select password
- from cm_temporary_user
- where addtime >= NOW() - INTERVAL 10 MINUTE
- and userId = #{userId}
- </select>
- <select id="findTicket" resultType="com.caimei365.user.model.po.TicketPo">
- select userId, ticketId, idCard, name, mobile, work
- from cm_zyl_ticket
- where ticketId = #{ticket}
- </select>
- <update id="updateTicket">
- update cm_zyl_ticket
- set userId = #{userId},
- idCard = #{idCard},
- name = #{name},
- mobile = #{mobile},
- work = #{work},
- bindTime = now()
- where ticketId = #{ticket}
- </update>
- <select id="findTicketUser" resultType="com.caimei365.user.model.po.TicketPo">
- select userId, ticketId, idCard
- from cm_zyl_ticket
- where userId = #{userId}
- </select>
- <select id="findShopSign" resultType="java.lang.String">
- select shopIds
- from cm_zyl_ticket
- where userId = #{userId}
- </select>
- <update id="updateShopSign">
- update cm_zyl_ticket
- set shopIds = #{shopSign}
- where userId = #{userId}
- </update>
- <select id="findShopSignPos" resultType="com.caimei365.user.model.po.ShopSignPo">
- SELECT id, shopName, shopLogo, (SELECT shopIds FROM cm_zyl_ticket where userId = #{userId}) as shopIds
- FROM cm_zyl_shop
- </select>
- <select id="findShopDetail" resultType="com.caimei365.user.model.po.ShopSignPo">
- SELECT id, shopName, shopLogo, showNum, (SELECT shopIds FROM cm_zyl_ticket where userId = #{userId}) as shopIds
- FROM cm_zyl_shop
- where id = #{shopId}
- </select>
- </mapper>
|