Selaa lähdekoodia

二手小程序

zhijiezhao 1 viikko sitten
vanhempi
commit
6d087326de

+ 43 - 34
src/main/java/com/caimei365/user/components/CommonService.java

@@ -3,7 +3,6 @@ package com.caimei365.user.components;
 import com.caimei365.user.mapper.BaseMapper;
 import com.caimei365.user.mapper.LoginMapper;
 import com.caimei365.user.mapper.OperationMapper;
-import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.po.OperationPo;
 import com.caimei365.user.model.vo.UserLoginVo;
 import com.caimei365.user.utils.ValidateUtil;
@@ -34,34 +33,40 @@ public class CommonService {
     private OperationMapper operationMapper;
     @Value("${spring.cloud.config.profile}")
     private String profile;
+
     /**
      * 校验邮箱
+     *
      * @param email 邮箱
      * @return errorMsg
      */
     public String emailValidate(String email) {
         if (!ValidateUtil.validateEmail(email)) {
-            return  "邮箱格式不正确";
+            return "邮箱格式不正确";
         }
         Integer userIdByEmail = baseMapper.getUserIdByEmail(email);
-        if (null != userIdByEmail && userIdByEmail > 0 ) {
+        if (null != userIdByEmail && userIdByEmail > 0) {
             return "该邮箱已被使用";
         }
         return null;
     }
+
     /**
      * 校验手机号与验证码
-     * @param mobile 手机号
+     *
+     * @param mobile  手机号
      * @param smsCode 验证码
      * @return errorMsg
      */
     public String mobileAndCodeValidate(String mobile, String smsCode) {
         String result = ValidateUtil.validateMobile(mobile);
-        if (result != null) {return result;}
-        if (StringUtils.isNotBlank(smsCode)){
+        if (result != null) {
+            return result;
+        }
+        if (StringUtils.isNotBlank(smsCode)) {
             String redisSmsCode = (String) redisService.get("code:" + mobile);
             // 开发 和 测试环境 固定短信验证码 666666
-            if ("dev".equals(profile) || "beta".equals(profile)){
+            if ("dev".equals(profile) || "beta".equals(profile)) {
                 redisSmsCode = (null != redisSmsCode && !"null".equals(redisSmsCode) ? redisSmsCode : "666666");
             }
             log.info("手机验证码校验" + smsCode.equals(redisSmsCode));
@@ -71,17 +76,17 @@ public class CommonService {
         }
         boolean flag = false;
         // 查找用户表是否存在
-        Integer dbUserId = baseMapper.getUserIdByMobile(mobile);
-        if (null != dbUserId && dbUserId > 0) {
-            UserLoginVo user = loginMapper.getLoginUserByUserId(dbUserId);
-            String showName = ValidateUtil.nameConversion(user.getUserName());
-            if (2 == user.getUserIdentity() || 4 == user.getUserIdentity()) {
-                return "该手机号已绑定机构(" + showName + ")联系人,请重新填写手机号";
-            } else if (3 == user.getUserIdentity()) {
-                return "该手机号已绑定供应商(" + showName + ")联系人,请重新填写手机号";
-            }
-            flag = true;
-        }
+//        Integer dbUserId = baseMapper.getUserIdByMobile(mobile);
+//        if (null != dbUserId && dbUserId > 0) {
+//            UserLoginVo user = loginMapper.getLoginUserByUserId(dbUserId);
+//            String showName = ValidateUtil.nameConversion(user.getUserName());
+//            if (2 == user.getUserIdentity() || 4 == user.getUserIdentity()) {
+//                return "该手机号已绑定机构(" + showName + ")联系人,请重新填写手机号";
+//            } else if (3 == user.getUserIdentity()) {
+//                return "该手机号已绑定供应商(" + showName + ")联系人,请重新填写手机号";
+//            }
+//            flag = true;
+//        }
         // 查找运营人员表是否存在
         Integer dbOperationId = baseMapper.getOperationIdByMobile(mobile);
         if (null != dbOperationId && dbOperationId > 0) {
@@ -102,15 +107,18 @@ public class CommonService {
 
     /**
      * 校验手机号与验证码 -- 组织
-     * @param mobile 手机号
-     * @param smsCode 验证码
+     *
+     * @param mobile     手机号
+     * @param smsCode    验证码
      * @param organizeId 组织Id
      * @return errorMsg
      */
     public String organizeMobileValidate(String mobile, String smsCode, Integer organizeId) {
         String result = ValidateUtil.validateMobile(mobile);
-        if (result != null) {return result;}
-        if (StringUtils.isNotBlank(smsCode)){
+        if (result != null) {
+            return result;
+        }
+        if (StringUtils.isNotBlank(smsCode)) {
             // 校验验证码是否过期
             long expireTime = redisService.getExpireTime("code:" + mobile);
             if (expireTime < 0) {
@@ -118,7 +126,7 @@ public class CommonService {
             }
             String redisSmsCode = (String) redisService.get("code:" + mobile);
             // 开发 和 测试环境 固定短信验证码 666666
-            if ("dev".equals(profile) || "beta".equals(profile)){
+            if ("dev".equals(profile) || "beta".equals(profile)) {
                 redisSmsCode = (null != redisSmsCode && !"null".equals(redisSmsCode) ? redisSmsCode : "666666");
             }
             log.info("手机验证码校验" + smsCode.equals(redisSmsCode));
@@ -128,19 +136,20 @@ public class CommonService {
         }
         boolean flag = false;
         // 查找用户表是否存在
-        Integer dbUserId = baseMapper.getUserIdByOrganize(organizeId,mobile);
-        if (null != dbUserId && dbUserId > 0) {
-            UserLoginVo user = loginMapper.getLoginUserByUserId(dbUserId);
-            String showName = ValidateUtil.nameConversion(user.getUserName());
-            if (2 == user.getUserIdentity() || 4 == user.getUserIdentity()) {
-                return "该手机号已绑定机构(" + showName + ")联系人,请重新填写手机号";
-            } else if (3 == user.getUserIdentity()) {
-                return "该手机号已绑定供应商(" + showName + ")联系人,请重新填写手机号";
-            }
-            flag = true;
-        }
+//        Integer dbUserId = baseMapper.getUserIdByOrganize(organizeId,mobile);
+//        if (null != dbUserId && dbUserId > 0) {
+//            UserLoginVo user = loginMapper.getLoginUserByUserId(dbUserId);
+//            String showName = ValidateUtil.nameConversion(user.getUserName());
+//            if (2 == user.getUserIdentity() || 4 == user.getUserIdentity()) {
+//                return "该手机号已绑定机构(" + showName + ")联系人,请重新填写手机号";
+//            } else if (3 == user.getUserIdentity()) {
+//                return "该手机号已绑定供应商(" + showName + ")联系人,请重新填写手机号";
+//            }
+//            flag = true;
+//        }
         // 查找运营人员表是否存在
         Integer dbOperationId = baseMapper.getOrganizeOperationIdByMobile(mobile, organizeId);
+        log.info("dbOperationId----->" + dbOperationId);
         if (null != dbOperationId && dbOperationId > 0) {
             UserLoginVo operation = loginMapper.getOrganizeByOperationId(dbOperationId, organizeId);
             String showName = ValidateUtil.nameConversion(operation.getUserName());

+ 14 - 6
src/main/java/com/caimei365/user/components/WeChatService.java

@@ -193,20 +193,27 @@ public class WeChatService {
         String requestUrl = "https://api.weixin.qq.com/sns/jscode2session";
         Map<String, String> requestUrlParam = new HashMap<String, String>(4);
         Integer type;
-        if (mode == 1) {
+        if (mode == 0) {
             // 小程序appId
             requestUrlParam.put("appid", miniAppId);
             log.info("采美小程序appId: ---" + miniAppId);
             // 小程序appSecret
             requestUrlParam.put("secret", miniAppSecret);
             type = 1;
-        } else if(mode == 2) {
+        } else if (mode == 2) {
             // 颜选美学商城小程序appId
             requestUrlParam.put("appid", heHeAppId);
             log.info("颜选美学商城appId: ---" + heHeAppId);
             // 颜选美学商城小程序appSecret
             requestUrlParam.put("secret", heHeAppSecret);
             type = 2;
+        } else if (mode == 5) {
+            // 二手商城小程序appId
+            requestUrlParam.put("appid", "wx3122abbfea989c49");
+            log.info("二手appId: ---" + heHeAppId);
+            // 二手商城小程序appSecret
+            requestUrlParam.put("secret", "a04496eacf388779c2eab14f78abba21");
+            type = 5;
         } else {
             // 联合丽格小程序appId
             requestUrlParam.put("appid", mcareAppId);
@@ -222,8 +229,8 @@ public class WeChatService {
         // 发送post请求读取调用微信接口获取openid用户唯一标识
         String infos;
         try {
-            log.info("requestUrl--------------------------"+requestUrl);
-            log.info("requestUrlParam--------------------------"+requestUrlParam);
+            log.info("requestUrl--------------------------" + requestUrl);
+            log.info("requestUrlParam--------------------------" + requestUrlParam);
             infos = RequestUtil.sendPost(requestUrl, requestUrlParam);
         } catch (Exception e) {
             return ResponseJson.error("服务器内部异常", returnMap);
@@ -236,8 +243,9 @@ public class WeChatService {
         String errCode = jsonObject.getString("errcode");
         String errMsg = jsonObject.getString("errmsg");
         log.info("openId----->" + openId + ", unionId------>" + unionId);
-        WxUnion byWxUnion = baseMapper.getByWxUnion(type, openId, null); //保存unionId和openId
-        if (null !=unionId&&(null == byWxUnion||null ==byWxUnion.getUnionId())) {
+        //保存unionId和openId
+        WxUnion byWxUnion = baseMapper.getByWxUnion(type, openId, null);
+        if (null != unionId && (null == byWxUnion || null == byWxUnion.getUnionId())) {
             byWxUnion = baseMapper.getByWxUnion(null, null, unionId);
             if (null == byWxUnion) {
                 baseMapper.addWxUnion(type, openId, unionId);

+ 2 - 1
src/main/java/com/caimei365/user/controller/LoginApi.java

@@ -256,7 +256,8 @@ public class LoginApi {
         String code = authAppletsDto.getCode();
         String encryptedData = authAppletsDto.getEncryptedData();
         String iv = authAppletsDto.getIv();
-        return loginService.appletsAuthorization(code, encryptedData, iv, headers);
+        Integer organizeId = authAppletsDto.getOrganizeId();
+        return loginService.appletsAuthorization(organizeId, code, encryptedData, iv, headers);
     }
 
     /**

+ 10 - 0
src/main/java/com/caimei365/user/controller/ShopApi.java

@@ -321,6 +321,16 @@ public class ShopApi {
         return shopService.getShopPersonalData(userId, productOrganize);
     }
 
+    @ApiOperation("二手小程序区域经理信息")
+    @GetMapping("/second/data")
+    public ResponseJson getSecondShopData(Integer shopId) {
+        if (null == shopId) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return shopService.getSecondShopData(shopId);
+    }
+
+
     @ApiOperation("供应商文章表单")
     @ApiImplicitParam(required = true, name = "articleId", value = "文章id")
     @GetMapping("/article/form")

+ 2 - 0
src/main/java/com/caimei365/user/model/dto/AuthAppletsDto.java

@@ -31,4 +31,6 @@ public class AuthAppletsDto implements Serializable {
      */
     @ApiModelProperty("加密算法的初始向量")
     private String iv;
+
+    private Integer organizeId;
 }

+ 2 - 0
src/main/java/com/caimei365/user/model/dto/AuthBindDto.java

@@ -59,4 +59,6 @@ public class AuthBindDto implements Serializable {
      */
     @ApiModelProperty("微信头像(headimgurl)")
     private String avatarUrl;
+
+    private Integer organizeId;
 }

+ 1 - 2
src/main/java/com/caimei365/user/service/LoginService.java

@@ -11,7 +11,6 @@ import com.caimei365.user.model.vo.MessageCenter;
 import com.caimei365.user.model.vo.UserLoginVo;
 import com.github.pagehelper.PageInfo;
 import org.springframework.http.HttpHeaders;
-import org.springframework.web.bind.annotation.RequestHeader;
 
 import java.text.ParseException;
 import java.util.List;
@@ -78,7 +77,7 @@ public interface LoginService {
      * @param iv            加密算法的初始向量
      * @return BaseUser
      */
-    ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers) throws ParseException;
+    ResponseJson<UserLoginVo> appletsAuthorization(Integer organizeId, String code, String encryptedData, String iv, HttpHeaders headers) throws ParseException;
 
     /**
      * 微信授权登录(小程序) 组织

+ 2 - 0
src/main/java/com/caimei365/user/service/ShopService.java

@@ -313,4 +313,6 @@ public interface ShopService {
      * @return
      */
     ResponseJson<Map<String, Object>> preview(Integer type, Integer marketReportId, Integer shopId, String startTime, String endTime);
+
+    ResponseJson getSecondShopData(Integer shopId);
 }

+ 9 - 12
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -15,10 +15,6 @@ import com.caimei365.user.model.vo.UserLoginVo;
 import com.caimei365.user.service.LoginService;
 import com.caimei365.user.service.RemoteCallService;
 import com.caimei365.user.utils.*;
-import com.caimei365.user.utils.message.InsideMessage;
-import com.caimei365.user.utils.message.MessageModel;
-import com.caimei365.user.utils.message.MessageType;
-import com.caimei365.user.utils.message.MqInfo;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
@@ -27,8 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.RequestHeader;
-import sun.security.krb5.internal.Ticket;
 
 import javax.annotation.Resource;
 import java.io.IOException;
@@ -118,7 +112,7 @@ public class LoginServiceImpl implements LoginService {
             // 如果前端传入unionId,则存入返回前端
             baseUser.setUnionId(unionId);
             // 不是采美组织下
-            if (0 != baseUser.getOrganizeId()) {
+            if (0 != baseUser.getOrganizeId() && baseUser.getUserIdentity() != 3 && baseUser.getUserIdentity() != 1) {
                 if (1 == baseUser.getClubStatus()) {
                     return ResponseJson.error(-1, "账号待审核,请耐心等待审核结果", null);
                 }
@@ -423,12 +417,12 @@ public class LoginServiceImpl implements LoginService {
      * @param headers       HttpHeaders
      */
     @Override
-    public ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers) {
+    public ResponseJson<UserLoginVo> appletsAuthorization(Integer organizeId, String code, String encryptedData, String iv, HttpHeaders headers) {
         if (StringUtils.isBlank(code)) {
             return ResponseJson.error("没有获取到微信授权code", null);
         }
         // 小程序微信授权获取登录信息
-        ResponseJson<Map<String, Object>> appletsInfo = weChatService.getInfoMapByApplets(code, headers, 1);
+        ResponseJson<Map<String, Object>> appletsInfo = weChatService.getInfoMapByApplets(code, headers, organizeId);
         if (appletsInfo.getCode() == -1) {
             return ResponseJson.error(appletsInfo.getMsg(), null);
         }
@@ -1457,6 +1451,7 @@ public class LoginServiceImpl implements LoginService {
         String nickName = authBindDto.getNickName();
         String avatarUrl = authBindDto.getAvatarUrl();
         String isCheckSmsCode = authBindDto.getIsCheckSmsCode();
+        Integer organizeId = authBindDto.getOrganizeId();
         // 参数校验
         if (null == userId) {
             return ResponseJson.error("参数异常:用户Id不能为空!", null);
@@ -1465,14 +1460,15 @@ public class LoginServiceImpl implements LoginService {
             return ResponseJson.error("参数异常:手机号不能为空!", null);
         }
         boolean b = StringUtils.isBlank(isCheckSmsCode) || "0".equals(isCheckSmsCode);
-        if (b && StringUtils.isBlank(smsCode)) {
+        // 采美走验证码
+        if (0 == organizeId && b && StringUtils.isBlank(smsCode)) {
             return ResponseJson.error("参数异常:短信验证码不能为空!", null);
         }
         if (StringUtils.isBlank(unionId)) {
             return ResponseJson.error("参数异常:unionId不能为空!", null);
         }
         // 查询使用该手机号的运营人员或用户
-        String checkRust = commonService.operationBindCheck(mobile, smsCode, 0);
+        String checkRust = commonService.operationBindCheck(mobile, smsCode, organizeId);
         if (checkRust != null) {
             return ResponseJson.error(checkRust, null);
         }
@@ -1480,7 +1476,8 @@ public class LoginServiceImpl implements LoginService {
         log.info("绑定微信bindingWx,获取unionId>>>>>>" + unionId);
         String openId = (String) infoData.get(WeChatService.Keys.OPEN_ID);
         // 判断微信是否已经绑定
-        UserLoginVo operationByUnionId = loginMapper.getLoginUserByUnionId(unionId, "mini");
+        String source = 0 == organizeId ? "mini" : 5 == organizeId ? "second" : "";
+        UserLoginVo operationByUnionId = loginMapper.getLoginUserByUnionId(unionId, source);
         if (operationByUnionId != null) {
             return ResponseJson.error("该微信已绑定,请重新刷新首页", null);
         }

+ 5 - 0
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -1535,6 +1535,11 @@ public class ShopServiceImpl implements ShopService {
         return ResponseJson.success(map);
     }
 
+    @Override
+    public ResponseJson getSecondShopData(Integer shopId) {
+        return ResponseJson.success(shopMapper.getShopHomeData(shopId));
+    }
+
     /**
      * 获取该月份首日日期
      *

+ 243 - 203
src/main/resources/mapper/BaseMapper.xml

@@ -48,7 +48,7 @@
         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)
+          and u.userIdentity in (1, 2, 3, 4, 7)
         UNION
         SELECT u.userID
         FROM USER u
@@ -62,7 +62,8 @@
         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
+        WHERE u.bindMobile = #{mobile}
+          and u.userOrganizeID != 0
           and u.userIdentity in (1, 2, 3, 4)
         UNION
         SELECT u.userID
@@ -70,7 +71,8 @@
                  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
+          AND u.userIdentity IN (1, 2, 3, 4)
+          and u.userOrganizeID != 0
         LIMIT 1
     </select>
     <select id="getUserIdByOrganize" resultType="java.lang.Integer">
@@ -78,7 +80,7 @@
         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.bindMobile = #{mobile}
           and u.userIdentity in (1, 2, 3, 4)
         UNION
         SELECT u.userID
@@ -91,7 +93,11 @@
         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 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
@@ -128,7 +134,8 @@
     <select id="getOrganizeOperationIdByMobile" resultType="java.lang.Integer">
         select id
         from cm_mall_operation_user
-        where mobile = #{mobile} and userOrganizeID = #{organizeId}
+        where mobile = #{mobile}
+          and userOrganizeID = #{organizeId}
           and delFlag = '0'
         limit 1
     </select>
@@ -148,12 +155,12 @@
         where townID = #{townID}
     </select>
     <select id="getUserByUserId" resultType="com.caimei365.user.model.vo.UserVo">
-        select userID             as userId,
-               registerUserTypeID as registerUserTypeId,
+        select userID                                                       as userId,
+               registerUserTypeID                                           as registerUserTypeId,
                source,
-               clubID             as clubId,
-               shopID             as shopId,
-               serviceProviderID  as serviceProviderId,
+               clubID                                                       as clubId,
+               shopID                                                       as shopId,
+               serviceProviderID                                            as serviceProviderId,
                name,
                userName,
                email,
@@ -168,7 +175,7 @@
                auditStatus,
                agreeFlag,
                registerTime,
-               registerIP         as registerIp,
+               registerIP                                                   as registerIp,
                guideFlag,
                validFlag,
                userBeans,
@@ -224,7 +231,10 @@
         </if>
     </select>
     <select id="getByMobile" resultType="String">
-       select bindMobile from user where  userIdentity=#{userIdentity} and  userId=#{userId}
+        select bindMobile
+        from user
+        where userIdentity = #{userIdentity}
+          and userId = #{userId}
     </select>
     <select id="getByUserCount" resultType="java.lang.Integer">
         SELECT count(1) from user
@@ -235,9 +245,11 @@
                     = #{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=")">
+                    <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>
@@ -248,77 +260,83 @@
                     = #{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=")">
+                    <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="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=")">
+                    <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="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=")">
+                    <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>
+            <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
@@ -432,7 +450,9 @@
             <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="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>
@@ -473,94 +493,93 @@
 
 
     <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"    />
+        <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
+        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">
@@ -573,9 +592,11 @@
                     = #{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=")">
+                    <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>
@@ -586,72 +607,78 @@
                     = #{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=")">
+                    <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="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=")">
+                    <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="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=")">
+                    <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="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>
@@ -708,6 +735,9 @@
             <if test="type != null  and type == 4">
                 miniProgramOpenId,
             </if>
+            <if test="type != null  and type == 5">
+                secondOpenid,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="unionId != null and unionId != ''">#{unionId},</if>
@@ -717,7 +747,8 @@
         </trim>
     </insert>
     <insert id="insertTicket">
-        INSERT INTO cm_zyl_ticket (ticketId) values(#{s})
+        INSERT INTO cm_zyl_ticket (ticketId)
+        values (#{s})
     </insert>
 
     <update id="updateWxUnion" parameterType="WxUnion">
@@ -735,6 +766,9 @@
             <if test="type != null  and type == 4">
                 miniProgramOpenId = #{openid},
             </if>
+            <if test="type != null  and type == 5">
+                secondOpenid = #{openid},
+            </if>
         </trim>
         where unionId = #{unionId}
     </update>
@@ -763,6 +797,9 @@
             <if test="type != null  and type == 4">
                 and wx_union.miniProgramOpenId = #{openid}
             </if>
+            <if test="type != null  and type == 5">
+                and wx_union.secondOpenid = #{openid}
+            </if>
         </where>
         limit 1
     </select>
@@ -771,30 +808,33 @@
         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>
+        <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=")">
+                    <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>
+            <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>
 
     <select id="findTicket" resultType="java.lang.Integer">
-        select id from cm_zyl_ticket
+        select id
+        from cm_zyl_ticket
         where ticketId = #{s}
     </select>
 

+ 14 - 4
src/main/resources/mapper/LoginMapper.xml

@@ -5,6 +5,7 @@
         select u.userID                                                  as userId,
                u.clubID                                                  as clubId,
                u.shopID                                                  as shopId,
+               u.userOrganizeID                                          as organizeId,
                u.serviceProviderId                                       as serviceProviderId,
                u.userName                                                as userName,
                u.name                                                    as name,
@@ -45,7 +46,7 @@
         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
+          and u.userOrganizeID in(0,5)
         union
         SELECT u.userID                                                  AS userId,
                u.userOrganizeID                                          as organizeId,
@@ -72,7 +73,7 @@
           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
+          and u.userOrganizeID in(0,5)
         limit 1
     </select>
     <select id="getLoginOrganizeUserByMobileOrEmail" resultType="com.caimei365.user.model.vo.UserLoginVo">
@@ -224,10 +225,13 @@
         <if test="source=='mini'">
             o.openid as openId
         </if>
+        <if test="source=='second'">
+            o.secondOpenid 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)
+        and (u.userIdentity in (1,2,3,4) and u.userOrganizeID in (0,5))
         limit 1
     </select>
     <select id="getOrganizeLoginUserByUnionId" resultType="com.caimei365.user.model.vo.UserLoginVo">
@@ -286,6 +290,9 @@
         <if test="source=='mini'">
             o.openid as openId
         </if>
+        <if test="source=='second'">
+            o.secondOpenid as openId
+        </if>
         from user u
         left join cm_mall_operation_user o on o.userID = u.userID
         where (
@@ -298,8 +305,11 @@
         <if test="source=='mini'">
             o.openid = #{openId}
         </if>
+        <if test="source=='second'">
+            o.secondOpenid = #{openId}
+        </if>
         and o.delFlag = '0')
-        and (u.userIdentity in (1,2,3,4) and u.userOrganizeID = 0)
+        and (u.userIdentity in (1,2,3,4) and u.userOrganizeID in (0,5))
         limit 1
     </select>
     <select id="getOrganizeLoginUserByOpenId" resultType="com.caimei365.user.model.vo.UserLoginVo">

+ 3 - 1
src/main/resources/mapper/RegisterMapper.xml

@@ -53,7 +53,9 @@
         insert into cm_mall_operation_user(`userID`, `clubID`, `shopID`, `userOrganizeID`, `linkName`, `nickName`,
                                            `headimgurl`, `userType`, `mobile`, `status`, `unionId`, `openid`,
                                            `pcOpenid`, `addTime`, `updateTime`, `bindTime`, `delFlag`)
-        values (#{userId}, #{clubId}, #{shopId}, #{organizeId}, #{linkName}, #{nickName}, #{avatarUrl}, #{userType},
+        values (#{userId}, #{clubId}, #{shopId}, #{organizeId},
+                ifnull(#{linkName}, (select linkname from user where userId = #{userId})), #{nickName}, #{avatarUrl},
+                #{userType},
                 #{mobile}, #{status}, #{unionId}, #{openId}, #{pcOpenId}, #{addTime}, #{updateTime}, #{bindTime},
                 #{delFlag})
     </insert>

+ 1 - 1
src/main/resources/mapper/ShopMapper.xml

@@ -144,7 +144,7 @@
             s.productDesc,
             count(*) as normalNum
         from shop s
-        where s.shopID = #{supplierId}
+        where s.shopID = #{shopId}
         group by s.shopID
     </select>
     <select id="getShopCertById" resultType="java.lang.String">