123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793 |
- <?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.BaseMapper">
- <update id="updatePasswordByUserId">
- update user
- set password = #{password}
- where userID = #{userId}
- </update>
- <update id="updateMobileByUserId">
- update user
- set bindMobile = #{mobile}
- where userID = #{userId}
- </update>
- <update id="updateImageByUserId">
- update user
- <trim prefix="SET" suffixOverrides=",">
- <if test="image != null and image != ''">image = #{image},</if>
- </trim>
- where userId = #{userId}
- </update>
- <update id="updateShopMobileByShopId">
- update shop
- set contractMobile = #{mobile}
- where shopID = #{shopId}
- </update>
- <update id="updateClubMobileByClubId">
- update club
- set contractMobile = #{mobile}
- where clubID = #{clubId}
- </update>
- <select id="getUserIdByEmail" resultType="java.lang.Integer">
- select userID
- from user
- where email = #{email}
- and userIdentity in (1, 2, 3, 4)
- limit 1
- </select>
- <select id="getUserIdByUserId" resultType="java.lang.Integer">
- select userID
- from user
- where userID = #{userId}
- and userIdentity in (1, 2, 3, 4)
- limit 1
- </select>
- <select id="getUserIdByMobile" resultType="java.lang.Integer">
- SELECT u.userID
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE u.bindMobile = #{mobile}
- and u.userIdentity in (1, 2, 3, 4,7)
- UNION
- SELECT u.userID
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE cu.mobile = #{mobile}
- AND cu.delFlag != 1
- AND u.userIdentity IN (1, 2, 3, 4)
- LIMIT 1
- </select>
- <select id="getUserIdOrganizeByMobile" resultType="java.lang.Integer">
- SELECT u.userID
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE u.bindMobile = #{mobile} and u.userOrganizeID != 0
- and u.userIdentity in (1, 2, 3, 4)
- UNION
- SELECT u.userID
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE cu.mobile = #{mobile}
- AND cu.delFlag != 1
- AND u.userIdentity IN (1, 2, 3, 4) and u.userOrganizeID != 0
- LIMIT 1
- </select>
- <select id="getUserIdByOrganize" resultType="java.lang.Integer">
- SELECT u.userID
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE u.userOrganizeID = #{organizeId}
- and u.bindMobile = #{mobile}
- and u.userIdentity in (1, 2, 3, 4)
- UNION
- SELECT u.userID
- FROM USER u
- LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
- WHERE u.userOrganizeID = #{organizeId}
- AND cu.mobile = #{mobile}
- AND cu.delFlag != 1
- AND u.userIdentity IN (1, 2, 3, 4)
- LIMIT 1
- </select>
- <select id="getServiceProvider" resultType="com.caimei365.user.model.vo.UserLoginVo">
- SELECT serviceProviderID as serviceProviderId, status as operationStatus FROM serviceprovider WHERE contractMobile = #{mobile} and organizeId = 4 limit 1
- </select>
- <select id="getUserIdByOrganizeStatus" resultType="com.caimei365.user.model.vo.UserLoginVo">
- SELECT userId, userIdentity, (select status from club where userId = USER.userId limit 1) as clubStatus
- FROM USER
- WHERE userOrganizeID = #{organizeId}
- AND bindMobile = #{mobile}
- AND userIdentity IN (1, 2, 3, 4)
- LIMIT 1
- </select>
- <select id="getOperationUserIdByMobile" resultType="java.lang.Integer">
- select userID
- from cm_mall_operation_user
- where mobile = #{mobile}
- and delFlag = '0'
- limit 1
- </select>
- <select id="getClubStatusByUserId" resultType="java.lang.Integer">
- select status
- from club
- where userID = #{userId}
- </select>
- <select id="getShopStatusByUserId" resultType="java.lang.Integer">
- select manufacturerStatus
- from user
- where userID = #{userId}
- </select>
- <select id="getOperationIdByMobile" resultType="java.lang.Integer">
- select id
- from cm_mall_operation_user
- where mobile = #{mobile}
- and delFlag = '0'
- limit 1
- </select>
- <select id="getOrganizeOperationIdByMobile" resultType="java.lang.Integer">
- select id
- from cm_mall_operation_user
- where mobile = #{mobile} and userOrganizeID = #{organizeId}
- and delFlag = '0'
- limit 1
- </select>
- <select id="getProvince" resultType="com.caimei365.user.model.vo.ProvinceVo">
- select provinceID as provinceId, name, validFlag, deliveryFee, freeMinTotalPrice
- from province
- where provinceID = #{provinceId}
- </select>
- <select id="getCity" resultType="com.caimei365.user.model.vo.CityVo">
- select cityID as cityId, provinceID as provinceId, name, validFlag
- from city
- where cityID = #{cityId}
- </select>
- <select id="getTown" resultType="com.caimei365.user.model.vo.TownVo">
- select townID as townId, cityID as cityId, name, zip, telZip, validFlag
- from town
- where townID = #{townID}
- </select>
- <select id="getUserByUserId" resultType="com.caimei365.user.model.vo.UserVo">
- select userID as userId,
- registerUserTypeID as registerUserTypeId,
- source,
- clubID as clubId,
- shopID as shopId,
- serviceProviderID as serviceProviderId,
- name,
- userName,
- email,
- mobile,
- bindMobile,
- password,
- userIdentity,
- (select status from club where userId = user.userId limit 1) as clubStatus,
- manufacturerStatus,
- serviceProviderStatus,
- auditNote,
- auditStatus,
- agreeFlag,
- registerTime,
- registerIP as registerIp,
- guideFlag,
- validFlag,
- userBeans,
- ableUserMoney,
- image
- from user
- where userID = #{userId}
- </select>
- <select id="getUserNameByUserId" resultType="java.lang.String">
- select userName
- from user
- where userID = #{userId}
- </select>
- <select id="getAfterSalesPhone" resultType="java.lang.String">
- select contactNumber
- from cm_mall_organize
- where id = 0
- and delFlag = '0'
- </select>
- <select id="getSensitiveWords" resultType="java.lang.String">
- select words
- from cm_sensitive_words
- where id = 1 and status = 1
- <if test="checkPoint != null">
- and checkPoints like concat('%',#{checkPoint},'%')
- </if>
- </select>
- <select id="findLabelsByLableIds" resultType="java.lang.String">
- select keyword
- from cm_user_search_frequency
- where trueStatus = 1
- and delStatus = 1
- and id in (#{labelIds})
- </select>
- <select id="findBankByUserId" resultType="java.lang.Integer">
- SELECT COUNT(id)
- FROM cm_quickpay_info
- WHERE userId = #{userId}
- and delflag = 0
- </select>
- <select id="getByUserId" resultType="java.lang.Integer">
- <if test="userType != null">
- <if test="userType == 1">
- SELECT userID from club WHERE clubId = #{id}
- </if>
- <if test="userType == 2">
- SELECT userID from shop WHERE shopId = #{id}
- </if>
- <if test="userType == 3">
- SELECT userID from serviceprovider WHERE serviceProviderID = #{id}
- </if>
- </if>
- </select>
- <select id="getByMobile" resultType="String">
- select bindMobile from user where userIdentity=#{userIdentity} and userId=#{userId}
- </select>
- <select id="getByUserCount" resultType="java.lang.Integer">
- SELECT count(1) from user
- <where>
- <if test="userID != null and userID != ''">
- and user.userID
- <if test="userID.toUpperCase().indexOf('=')==-1">
- = #{userID}
- </if>
- <if test="userID.toUpperCase().indexOf('=')!=-1">
- <if test="userID.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="userID.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="userIDIn" collection="userID.substring(userID.toUpperCase().indexOf('=')+1,userID.length()).trim().split(',')" open="(" separator="," close=")">
- #{userIDIn}
- </foreach>
- </if>
- </if>
- <if test="userOrganizeID != null and userOrganizeID != ''">
- and user.userOrganizeID
- <if test="userOrganizeID.toUpperCase().indexOf('=')==-1">
- = #{userOrganizeID}
- </if>
- <if test="userOrganizeID.toUpperCase().indexOf('=')!=-1">
- <if test="userOrganizeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="userOrganizeID.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="userOrganizeID.substring(userOrganizeID.toUpperCase().indexOf('=')+1,userOrganizeID.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="account != null and account != ''"> and user.account = #{account}</if>
- <if test="mobile != null and mobile != ''"> and user.mobile = #{mobile}</if>
- <if test="bindMobile != null and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
- <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
- <if test="userIdentity != null and userIdentity != ''">
- and user.userIdentity
- <if test="userIdentity.toUpperCase().indexOf('=')==-1">
- = #{userIdentity}
- </if>
- <if test="userIdentity.toUpperCase().indexOf('=')!=-1">
- <if test="userIdentity.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="userIdentity.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="userIdentity.substring(userIdentity.toUpperCase().indexOf('=')+1,userIdentity.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="email != null and email != ''"> and user.email = #{email}</if>
- <if test="userName != null and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
- <if test="realName != null and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
- <if test="source != null and source != ''"> and user.source = #{source}</if>
- <if test="image != null and image != ''"> and user.image = #{image}</if>
- <if test="password != null and password != ''"> and user.password = #{password}</if>
- <if test="name != null and name != ''"> and user.name like concat('%', #{name}, '%')</if>
- <if test="registerUserTypeID != null and registerUserTypeID != ''">
- and user.registerUserTypeID
- <if test="registerUserTypeID.toUpperCase().indexOf('=')==-1">
- = #{registerUserTypeID}
- </if>
- <if test="registerUserTypeID.toUpperCase().indexOf('=')!=-1">
- <if test="registerUserTypeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="registerUserTypeID.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="registerUserTypeID.substring(registerUserTypeID.toUpperCase().indexOf('=')+1,registerUserTypeID.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
- <if test="shopID != null "> and user.shopID = #{shopID}</if>
- <if test="auditStatus != null and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
- <if test="auditTime != null and auditTime != ''"> and user.auditTime = #{auditTime}</if>
- <if test="auditNote != null and auditNote != ''"> and user.auditNote = #{auditNote}</if>
- <if test="registerTime != null and registerTime != ''"> and user.registerTime = #{registerTime}</if>
- <if test="registerIP != null and registerIP != ''"> and user.registerIP = #{registerIP}</if>
- <if test="ipAddress != null and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
- <if test="loginTime != null and loginTime != ''"> and user.loginTime = #{loginTime}</if>
- <if test="loginIP != null and loginIP != ''"> and user.loginIP = #{loginIP}</if>
- <if test="validFlag != null and validFlag != ''"> and user.validFlag = #{validFlag}</if>
- <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
- <if test="clubID != null "> and user.clubID = #{clubID}</if>
- <if test="agreeFlag != null and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
- <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
- <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
- <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
- <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
- <if test="logoffTime != null and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
- <if test="appKey != null and appKey != ''"> and user.appKey = #{appKey}</if>
- <if test="appSecret != null and appSecret != ''"> and user.appSecret = #{appSecret}</if>
- <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
- <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
- <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
- <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
- <if test="tipStatus != null and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
- <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
- </where>
- group by user.userID
- order by user.loginTime desc
- </select>
- <insert id="addUser" parameterType="CmUser" useGeneratedKeys="true" keyProperty="userID">
- insert into user
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userID != null and userID != ''">userID,</if>
- <if test="userOrganizeID != null">userOrganizeID,</if>
- <if test="account != null and account != ''">account,</if>
- <if test="mobile != null and mobile != ''">mobile,</if>
- <if test="bindMobile != null and bindMobile != ''">bindMobile,</if>
- <if test="userPermission != null">userPermission,</if>
- <if test="userIdentity != null">userIdentity,</if>
- <if test="email != null and email != ''">email,</if>
- <if test="userName != null and userName != ''">userName,</if>
- <if test="realName != null and realName != ''">realName,</if>
- <if test="source != null and source != ''">source,</if>
- <if test="image != null and image != ''">image,</if>
- <if test="password != null and password != ''">password,</if>
- <if test="name != null and name != ''">name,</if>
- <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID,</if>
- <if test="manufacturerStatus != null">manufacturerStatus,</if>
- <if test="shopID != null">shopID,</if>
- <if test="auditStatus != null and auditStatus != ''">auditStatus,</if>
- <if test="auditTime != null and auditTime != ''">auditTime,</if>
- <if test="auditNote != null and auditNote != ''">auditNote,</if>
- <if test="registerTime != null and registerTime != ''">registerTime,</if>
- <if test="registerIP != null and registerIP != ''">registerIP,</if>
- <if test="ipAddress != null and ipAddress != ''">ipAddress,</if>
- <if test="loginTime != null and loginTime != ''">loginTime,</if>
- <if test="loginIP != null and loginIP != ''">loginIP,</if>
- <if test="validFlag != null and validFlag != ''">validFlag,</if>
- <if test="clubStatus != null">clubStatus,</if>
- <if test="clubID != null">clubID,</if>
- <if test="agreeFlag != null and agreeFlag != ''">agreeFlag,</if>
- <if test="serviceProviderStatus != null">serviceProviderStatus,</if>
- <if test="serviceProviderID != null">serviceProviderID,</if>
- <if test="userMoney != null">userMoney,</if>
- <if test="ableUserMoney != null">ableUserMoney,</if>
- <if test="logoffTime != null and logoffTime != ''">logoffTime,</if>
- <if test="appKey != null and appKey != ''">appKey,</if>
- <if test="appSecret != null and appSecret != ''">appSecret,</if>
- <if test="scanFlag != null">scanFlag,</if>
- <if test="userBeans != null">userBeans,</if>
- <if test="guideFlag != null">guideFlag,</if>
- <if test="loginFailTime != null">loginFailTime,</if>
- <if test="tipStatus != null and tipStatus != ''">tipStatus,</if>
- <if test="onlineMoney != null">onlineMoney,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userID != null and userID != ''">#{userID},</if>
- <if test="userOrganizeID != null">#{userOrganizeID},</if>
- <if test="account != null and account != ''">#{account},</if>
- <if test="mobile != null and mobile != ''">#{mobile},</if>
- <if test="bindMobile != null and bindMobile != ''">#{bindMobile},</if>
- <if test="userPermission != null">#{userPermission},</if>
- <if test="userIdentity != null">#{userIdentity},</if>
- <if test="email != null and email != ''">#{email},</if>
- <if test="userName != null and userName != ''">#{userName},</if>
- <if test="realName != null and realName != ''">#{realName},</if>
- <if test="source != null and source != ''">#{source},</if>
- <if test="image != null and image != ''">#{image},</if>
- <if test="password != null and password != ''">#{password},</if>
- <if test="name != null and name != ''">#{name},</if>
- <if test="registerUserTypeID != null and registerUserTypeID != ''">#{registerUserTypeID},</if>
- <if test="manufacturerStatus != null">#{manufacturerStatus},</if>
- <if test="shopID != null">#{shopID},</if>
- <if test="auditStatus != null and auditStatus != ''">#{auditStatus},</if>
- <if test="auditTime != null and auditTime != ''">#{auditTime},</if>
- <if test="auditNote != null and auditNote != ''">#{auditNote},</if>
- <if test="registerTime != null and registerTime != ''">#{registerTime},</if>
- <if test="registerIP != null and registerIP != ''">#{registerIP},</if>
- <if test="ipAddress != null and ipAddress != ''">#{ipAddress},</if>
- <if test="loginTime != null and loginTime != ''">#{loginTime},</if>
- <if test="loginIP != null and loginIP != ''">#{loginIP},</if>
- <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
- <if test="clubStatus != null">#{clubStatus},</if>
- <if test="clubID != null">#{clubID},</if>
- <if test="agreeFlag != null and agreeFlag != ''">#{agreeFlag},</if>
- <if test="serviceProviderStatus != null">#{serviceProviderStatus},</if>
- <if test="serviceProviderID != null">#{serviceProviderID},</if>
- <if test="userMoney != null">#{userMoney},</if>
- <if test="ableUserMoney != null">#{ableUserMoney},</if>
- <if test="logoffTime != null and logoffTime != ''">#{logoffTime},</if>
- <if test="appKey != null and appKey != ''">#{appKey},</if>
- <if test="appSecret != null and appSecret != ''">#{appSecret},</if>
- <if test="scanFlag != null">#{scanFlag},</if>
- <if test="userBeans != null">#{userBeans},</if>
- <if test="guideFlag != null">#{guideFlag},</if>
- <if test="loginFailTime != null">#{loginFailTime},</if>
- <if test="tipStatus != null and tipStatus != ''">#{tipStatus},</if>
- <if test="onlineMoney != null">#{onlineMoney},</if>
- </trim>
- </insert>
- <update id="updateUser" parameterType="CmUser">
- update user
- <trim prefix="SET" suffixOverrides=",">
- <if test="userOrganizeID != null">userOrganizeID = #{userOrganizeID},</if>
- <if test="account != null and account != ''">account = #{account},</if>
- <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
- <if test="bindMobile != null and bindMobile != ''">bindMobile = #{bindMobile},</if>
- <if test="userPermission != null">userPermission = #{userPermission},</if>
- <if test="userIdentity != null">userIdentity = #{userIdentity},</if>
- <if test="email != null and email != ''">email = #{email},</if>
- <if test="userName != null and userName != ''">userName = #{userName},</if>
- <if test="realName != null and realName != ''">realName = #{realName},</if>
- <if test="source != null and source != ''">source = #{source},</if>
- <if test="image != null and image != ''">image = #{image},</if>
- <if test="password != null and password != ''">password = #{password},</if>
- <if test="name != null and name != ''">name = #{name},</if>
- <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID = #{registerUserTypeID},</if>
- <if test="manufacturerStatus != null">manufacturerStatus = #{manufacturerStatus},</if>
- <if test="shopID != null">shopID = #{shopID},</if>
- <if test="auditStatus != null and auditStatus != ''">auditStatus = #{auditStatus},</if>
- <if test="auditTime != null and auditTime != ''">auditTime = #{auditTime},</if>
- <if test="auditNote != null and auditNote != ''">auditNote = #{auditNote},</if>
- <if test="registerTime != null and registerTime != ''">registerTime = #{registerTime},</if>
- <if test="registerIP != null and registerIP != ''">registerIP = #{registerIP},</if>
- <if test="ipAddress != null and ipAddress != ''">ipAddress = #{ipAddress},</if>
- <if test="loginTime != null and loginTime != ''">loginTime = #{loginTime},</if>
- <if test="loginIP != null and loginIP != ''">loginIP = #{loginIP},</if>
- <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
- <if test="clubStatus != null">clubStatus = #{clubStatus},</if>
- <if test="clubID != null">clubID = #{clubID},</if>
- <if test="agreeFlag != null and agreeFlag != ''">agreeFlag = #{agreeFlag},</if>
- <if test="serviceProviderStatus != null">serviceProviderStatus = #{serviceProviderStatus},</if>
- <if test="serviceProviderID != null">serviceProviderID = #{serviceProviderID},</if>
- <if test="userMoney != null">userMoney = #{userMoney},</if>
- <if test="ableUserMoney != null">ableUserMoney = #{ableUserMoney},</if>
- <if test="logoffTime != null and logoffTime != ''">logoffTime = #{logoffTime},</if>
- <if test="appKey != null and appKey != ''">appKey = #{appKey},</if>
- <if test="appSecret != null and appSecret != ''">appSecret = #{appSecret},</if>
- <if test="scanFlag != null">scanFlag = #{scanFlag},</if>
- <if test="userBeans != null">userBeans = #{userBeans},</if>
- <if test="guideFlag != null">guideFlag = #{guideFlag},</if>
- <if test="loginFailTime != null">loginFailTime = #{loginFailTime},</if>
- <if test="tipStatus != null and tipStatus != ''">tipStatus = #{tipStatus},</if>
- <if test="onlineMoney != null">onlineMoney = #{onlineMoney},</if>
- </trim>
- where userID = #{userID}
- </update>
- <update id="updateClubStatus" parameterType="CmUser">
- update club
- <trim prefix="SET" suffixOverrides=",">
- <if test="status != null">status = #{status},</if>
- </trim>
- where userId = #{userId}
- </update>
- <resultMap type="CmUser" id="UserResult">
- <result property="userID" column="userID" />
- <result property="userOrganizeID" column="userOrganizeID" />
- <result property="account" column="account" />
- <result property="mobile" column="mobile" />
- <result property="bindMobile" column="bindMobile" />
- <result property="userPermission" column="userPermission" />
- <result property="userIdentity" column="userIdentity" />
- <result property="email" column="email" />
- <result property="userName" column="userName" />
- <result property="realName" column="realName" />
- <result property="source" column="source" />
- <result property="image" column="image" />
- <result property="password" column="password" />
- <result property="name" column="name" />
- <result property="registerUserTypeID" column="registerUserTypeID" />
- <result property="manufacturerStatus" column="manufacturerStatus" />
- <result property="shopID" column="shopID" />
- <result property="auditStatus" column="auditStatus" />
- <result property="auditTime" column="auditTime" />
- <result property="auditNote" column="auditNote" />
- <result property="registerTime" column="registerTime" />
- <result property="registerIP" column="registerIP" />
- <result property="ipAddress" column="ipAddress" />
- <result property="loginTime" column="loginTime" />
- <result property="loginIP" column="loginIP" />
- <result property="validFlag" column="validFlag" />
- <result property="clubStatus" column="clubStatus" />
- <result property="clubID" column="clubID" />
- <result property="agreeFlag" column="agreeFlag" />
- <result property="serviceProviderStatus" column="serviceProviderStatus" />
- <result property="serviceProviderID" column="serviceProviderID" />
- <result property="userMoney" column="userMoney" />
- <result property="ableUserMoney" column="ableUserMoney" />
- <result property="logoffTime" column="logoffTime" />
- <result property="appKey" column="appKey" />
- <result property="appSecret" column="appSecret" />
- <result property="scanFlag" column="scanFlag" />
- <result property="userBeans" column="userBeans" />
- <result property="guideFlag" column="guideFlag" />
- <result property="loginFailTime" column="loginFailTime" />
- <result property="tipStatus" column="tipStatus" />
- <result property="onlineMoney" column="onlineMoney" />
- </resultMap>
- <sql id="selectUserVo">
- select
- user.userID,
- user.userOrganizeID,
- user.account,
- user.mobile,
- user.bindMobile,
- user.userPermission,
- user.userIdentity,
- user.email,
- user.userName,
- user.realName,
- user.source,
- user.image,
- user.password,
- user.name,
- user.registerUserTypeID,
- user.manufacturerStatus,
- user.shopID,
- user.auditStatus,
- user.auditTime,
- user.auditNote,
- user.registerTime,
- user.registerIP,
- user.ipAddress,
- user.loginTime,
- user.loginIP,
- user.validFlag,
- user.clubStatus,
- user.clubID,
- user.agreeFlag,
- user.serviceProviderStatus,
- user.serviceProviderID,
- ifnull(user.userMoney,0) AS userMoney,
- ifnull(user.ableUserMoney,0) AS ableUserMoney,
- user.logoffTime,
- user.appKey,
- user.appSecret,
- user.scanFlag,
- user.userBeans,
- user.guideFlag,
- user.loginFailTime,
- user.tipStatus,
- ifnull(user.onlineMoney,0) AS onlineMoney
- </sql>
- <select id="getByUser" parameterType="CmUser" resultMap="UserResult">
- <include refid="selectUserVo"/>
- from user AS user
- <where>
- <if test="userID != null and userID != ''">
- and user.userID
- <if test="userID.toUpperCase().indexOf('=')==-1">
- = #{userID}
- </if>
- <if test="userID.toUpperCase().indexOf('=')!=-1">
- <if test="userID.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="userID.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="userIDIn" collection="userID.substring(userID.toUpperCase().indexOf('=')+1,userID.length()).trim().split(',')" open="(" separator="," close=")">
- #{userIDIn}
- </foreach>
- </if>
- </if>
- <if test="userOrganizeID != null and userOrganizeID != ''">
- and user.userOrganizeID
- <if test="userOrganizeID.toUpperCase().indexOf('=')==-1">
- = #{userOrganizeID}
- </if>
- <if test="userOrganizeID.toUpperCase().indexOf('=')!=-1">
- <if test="userOrganizeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="userOrganizeID.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="userOrganizeID.substring(userOrganizeID.toUpperCase().indexOf('=')+1,userOrganizeID.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="account != null and account != ''"> and user.account = #{account}</if>
- <if test="mobile != null and mobile != ''"> and user.mobile = #{mobile}</if>
- <if test="bindMobile != null and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
- <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
- <if test="userIdentity != null and userIdentity != ''">
- and user.userIdentity
- <if test="userIdentity.toUpperCase().indexOf('=')==-1">
- = #{userIdentity}
- </if>
- <if test="userIdentity.toUpperCase().indexOf('=')!=-1">
- <if test="userIdentity.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="userIdentity.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="userIdentity.substring(userIdentity.toUpperCase().indexOf('=')+1,userIdentity.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="email != null and email != ''"> and user.email = #{email}</if>
- <if test="userName != null and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
- <if test="realName != null and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
- <if test="source != null and source != ''"> and user.source = #{source}</if>
- <if test="image != null and image != ''"> and user.image = #{image}</if>
- <if test="password != null and password != ''"> and user.password = #{password}</if>
- <if test="name != null and name != ''"> and user.name like concat('%', #{name}, '%')</if>
- <if test="registerUserTypeID != null and registerUserTypeID != ''">
- and user.registerUserTypeID
- <if test="registerUserTypeID.toUpperCase().indexOf('=')==-1">
- = #{registerUserTypeID}
- </if>
- <if test="registerUserTypeID.toUpperCase().indexOf('=')!=-1">
- <if test="registerUserTypeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="registerUserTypeID.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="registerUserTypeID.substring(registerUserTypeID.toUpperCase().indexOf('=')+1,registerUserTypeID.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
- <if test="shopID != null "> and user.shopID = #{shopID}</if>
- <if test="auditStatus != null and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
- <if test="auditTime != null and auditTime != ''"> and user.auditTime = #{auditTime}</if>
- <if test="auditNote != null and auditNote != ''"> and user.auditNote = #{auditNote}</if>
- <if test="registerTime != null and registerTime != ''"> and user.registerTime = #{registerTime}</if>
- <if test="registerIP != null and registerIP != ''"> and user.registerIP = #{registerIP}</if>
- <if test="ipAddress != null and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
- <if test="loginTime != null and loginTime != ''"> and user.loginTime = #{loginTime}</if>
- <if test="loginIP != null and loginIP != ''"> and user.loginIP = #{loginIP}</if>
- <if test="validFlag != null and validFlag != ''"> and user.validFlag = #{validFlag}</if>
- <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
- <if test="clubID != null "> and user.clubID = #{clubID}</if>
- <if test="agreeFlag != null and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
- <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
- <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
- <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
- <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
- <if test="logoffTime != null and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
- <if test="appKey != null and appKey != ''"> and user.appKey = #{appKey}</if>
- <if test="appSecret != null and appSecret != ''"> and user.appSecret = #{appSecret}</if>
- <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
- <if test="userBeans != null ">and user.userBeans = #{userBeans}</if>
- <if test="guideFlag != null ">and user.guideFlag = #{guideFlag}</if>
- <if test="loginFailTime != null ">and user.loginFailTime = #{loginFailTime}</if>
- <if test="tipStatus != null and tipStatus != ''">and user.tipStatus = #{tipStatus}</if>
- <if test="onlineMoney != null ">and user.onlineMoney = #{onlineMoney}</if>
- </where>
- group by user.userID
- order by user.loginTime desc
- limit 0,1
- </select>
- <select id="getUserType" resultType="int">
- select user.userIdentity
- FROM user user
- WHERE user.userId = #{userId}
- </select>
- <select id="findUserByMobile" resultMap="UserResult">
- <include refid="selectUserVo"/>
- FROM user user
- WHERE user.bindMobile=#{mobile}
- <if test="oldUserId !=null and oldUserId !=''">
- and user.userId!=#{oldUserId}
- </if>
- <if test="userIdentity !=null">
- and user.userIdentity=#{userIdentity}
- </if>
- limit 0,1
- </select>
- <select id="findAdminMobileList" parameterType="String" resultType="String">
- select
- cm_admin_mobile.mobile
- from cm_admin_mobile AS cm_admin_mobile
- <where>cm_admin_mobile.delFlag = 0 and cm_admin_mobile.enabledStatus = 1
- <if test="type != null and type != ''">and cm_admin_mobile.type = #{type}</if>
- </where>
- group by cm_admin_mobile.id
- order by cm_admin_mobile.createTime desc
- </select>
- <insert id="addWxUnion" parameterType="WxUnion">
- insert into wx_union
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="unionId != null and unionId != ''">unionId,</if>
- <if test="type != null and type == 1">
- appOpenid,
- </if>
- <if test="type != null and type == 2">
- heheOpenid,
- </if>
- <if test="type != null and type == 3">
- crmOpenid,
- </if>
- <if test="type != null and type == 4">
- miniProgramOpenId,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="unionId != null and unionId != ''">#{unionId},</if>
- <if test="type != null">
- #{openid},
- </if>
- </trim>
- </insert>
- <update id="updateWxUnion" parameterType="WxUnion">
- update wx_union
- <trim prefix="SET" suffixOverrides=",">
- <if test="type != null and type == 1">
- appOpenid = #{openid},
- </if>
- <if test="type != null and type == 2">
- heheOpenid = #{openid},
- </if>
- <if test="type != null and type == 3">
- crmOpenid = #{openid},
- </if>
- <if test="type != null and type == 4">
- miniProgramOpenId = #{openid},
- </if>
- </trim>
- where unionId = #{unionId}
- </update>
- <select id="getByWxUnion" parameterType="WxUnion" resultType="WxUnion">
- select
- wx_union.unionId,
- wx_union.userId,
- wx_union.crmOpenid,
- wx_union.appOpenid,
- wx_union.miniProgramOpenId,
- wx_union.heheOpenid
- from wx_union AS wx_union
- <where>
- <if test="unionId != null and unionId != ''">
- and wx_union.unionId = #{unionId}
- </if>
- <if test="type != null and type == 1">
- and wx_union.appOpenid = #{openid}
- </if>
- <if test="type != null and type == 2">
- and wx_union.heheOpenid = #{openid}
- </if>
- <if test="type != null and type == 3">
- and wx_union.crmOpenid = #{openid}
- </if>
- <if test="type != null and type == 4">
- and wx_union.miniProgramOpenId = #{openid}
- </if>
- </where>
- limit 1
- </select>
- <select id="getRelatedImageList" parameterType="CmRelatedImage" resultType="String">
- select
- cm_related_image.image
- from cm_related_image AS cm_related_image
- <where> cm_related_image.delFlag = 0
- <if test="id != null and id != ''"> and cm_related_image.id = #{id}</if>
- <if test="type != null and type != ''">
- and cm_related_image.type
- <if test="type.toUpperCase().indexOf('=')==-1">
- = #{type}
- </if>
- <if test="type.toUpperCase().indexOf('=')!=-1">
- <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
- <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
- <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
- #{typeIn}
- </foreach>
- </if>
- </if>
- <if test="authorId != null and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
- <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
- </where>
- group by cm_related_image.id
- order by cm_related_image.createTime desc
- </select>
- </mapper>
|