Преглед на файлове

Merge remote-tracking branch 'origin/developer' into developerD

huangzhiguo преди 1 година
родител
ревизия
b244f694af
променени са 21 файла, в които са добавени 2768 реда и са изтрити 16 реда
  1. 4 1
      src/main/java/com/caimei365/user/config/ApiConfig.java
  2. 14 1
      src/main/java/com/caimei365/user/controller/BaseApi.java
  3. 151 0
      src/main/java/com/caimei365/user/controller/DistributionApi.java
  4. 43 0
      src/main/java/com/caimei365/user/controller/LoginApi.java
  5. 21 0
      src/main/java/com/caimei365/user/controller/RegisterApi.java
  6. 3 0
      src/main/java/com/caimei365/user/controller/SellerApi.java
  7. 47 1
      src/main/java/com/caimei365/user/mapper/BaseMapper.java
  8. 122 0
      src/main/java/com/caimei365/user/mapper/CmDistributionMapper.java
  9. 6 0
      src/main/java/com/caimei365/user/model/dto/ClubRegisterDto.java
  10. 227 0
      src/main/java/com/caimei365/user/model/po/CmDistribution.java
  11. 488 0
      src/main/java/com/caimei365/user/model/po/CmUser.java
  12. 116 0
      src/main/java/com/caimei365/user/model/vo/CmDistributionVO.java
  13. 12 1
      src/main/java/com/caimei365/user/service/BaseService.java
  14. 70 0
      src/main/java/com/caimei365/user/service/CmDistributionService.java
  15. 1 0
      src/main/java/com/caimei365/user/service/RegisterService.java
  16. 41 4
      src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java
  17. 389 0
      src/main/java/com/caimei365/user/service/impl/CmDistributionServiceImpl.java
  18. 157 3
      src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java
  19. 1 1
      src/main/resources/bootstrap.yml
  20. 464 4
      src/main/resources/mapper/BaseMapper.xml
  21. 391 0
      src/main/resources/mapper/CmDistributionMapper.xml

+ 4 - 1
src/main/java/com/caimei365/user/config/ApiConfig.java

@@ -22,9 +22,12 @@ public class ApiConfig implements WebMvcConfigurer {
         //addPathPatterns 用于添加拦截规则
         //excludePathPatterns 用于排除拦截
         registry.addInterceptor(apiInterceptor)
+                .addPathPatterns("/user/distribution/**")
                 .addPathPatterns("/user/club/info/update")
                 .addPathPatterns("/user/shop/info/update")
-                .addPathPatterns("/user/club/archive/deduction");
+                .addPathPatterns("/user/club/archive/deduction")
+                .excludePathPatterns("/user/distribution/setPassword")
+                .excludePathPatterns("/user/distribution/home");
 //                .excludePathPatterns("/order/detail");
     }
 }

+ 14 - 1
src/main/java/com/caimei365/user/controller/BaseApi.java

@@ -7,6 +7,7 @@ import com.caimei365.user.idempotent.IpSave;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
+import com.caimei365.user.model.po.CmUser;
 import com.caimei365.user.model.po.SysDict;
 import com.caimei365.user.model.vo.SysDictVO;
 import com.caimei365.user.service.BaseService;
@@ -273,6 +274,18 @@ public class BaseApi {
     @ApiOperation("获取userId")
     @GetMapping("/getFindUserId")
     public ResponseJson getFindUserId(Integer userType, Integer id) {
-        return ResponseJson.success(baseService.getByUserId(userType, id));
+        return baseService.getByUserId(userType, id);
+    }
+
+    @ApiOperation("获取Mobile")
+    @GetMapping("/getByDistributionClubMobile")
+    public ResponseJson getByMobile(Integer userId) {
+        return ResponseJson.success(baseService.getByMobile(8, userId));
+    }
+
+    @ApiOperation("获取user数量")
+    @GetMapping("/getByUserCount")
+    public Integer getByUserCount(CmUser user) {
+        return baseService.getByUserCount(user);
     }
 }

+ 151 - 0
src/main/java/com/caimei365/user/controller/DistributionApi.java

@@ -0,0 +1,151 @@
+package com.caimei365.user.controller;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.dto.OnlineDto;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.po.CmUser;
+import com.caimei365.user.model.po.ServiceProviderPo;
+import com.caimei365.user.model.vo.*;
+import com.caimei365.user.service.BaseService;
+import com.caimei365.user.service.CmDistributionService;
+import com.caimei365.user.service.SellerService;
+import com.caimei365.user.utils.RequestUtil;
+import com.caimei365.user.utils.ValidateUtil;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/3/24
+ */
+@Api(tags = "分销人员API")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/user/distribution")
+public class DistributionApi {
+
+    private final CmDistributionService cmDistributionService;
+    private final BaseService baseService;
+
+
+    /**
+     * 团队成员列表
+     */
+    @GetMapping("/getDistributionList")
+    public ResponseJson<List<CmDistributionVO>> getDistributionList(CmDistribution cmDistribution) {
+        if (null == cmDistribution.parentId()) {
+            return ResponseJson.error("参数异常!", null);
+        }
+        List<CmDistribution> cmDistributionList = cmDistributionService.getCmDistributionList(new CmDistribution()
+                .parentId(cmDistribution.parentId())
+        );
+        return ResponseJson.success(CmDistributionVO.setValues(cmDistributionList));
+    }
+
+
+    /**
+     * 协销个人中心
+     */
+    @GetMapping("/home")
+    public ResponseJson<CmDistributionVO> getHome(CmDistribution cmDistribution) {
+        if (null == cmDistribution.userId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return ResponseJson.success(CmDistributionVO.setValue(cmDistributionService.getByCmDistribution(new CmDistribution()
+                .id(cmDistribution.id())
+                .userId(cmDistribution.userId())
+        )));
+    }
+
+    /**
+     * 更新协销信息
+     */
+    @PostMapping("/setHome")
+    public ResponseJson setHome(CmDistribution cmDistribution) {
+        if (null == cmDistribution.userId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        cmDistributionService.updateCmDistribution(new CmDistribution()
+                .userId(cmDistribution.userId())
+                .image(cmDistribution.image())
+                .qrCode(cmDistribution.qrCode())
+        );
+        return ResponseJson.success();
+    }
+
+    /**
+     * 更新协销信息
+     */
+    @PostMapping("/setPassword")
+    public ResponseJson setPassword(CmDistribution cmDistribution, String oldPassword,  String code) {
+        if (!oldPassword.equals(cmDistribution.password())) {
+            return ResponseJson.error("两次输入的密码不一致!", null);
+        }
+        return cmDistributionService.setPassword(new CmDistribution()
+                        .userId(cmDistribution.userId())
+                        .mobile(cmDistribution.mobile())
+                        .password(cmDistribution.password())
+                , code);
+    }
+
+    /**
+     * 更新协销信息
+     */
+    @PostMapping("/updateStatus")
+    public ResponseJson updateStatus(CmDistribution cmDistribution) {
+        if (null == cmDistribution.userId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!!", null);
+        }
+        if (90 != cmDistribution.status()) {
+            cmDistribution.status(91);
+        }
+        cmDistributionService.updateCmDistribution(new CmDistribution()
+                .userId(cmDistribution.userId())
+                .status(cmDistribution.status())
+        );
+        return ResponseJson.success();
+    }
+
+    /**
+     * 新增协销信息
+     */
+    @PostMapping("/save")
+    public ResponseJson save(CmDistribution cmDistribution) {
+        if (null == cmDistribution.parentId() || cmDistribution.parentId() == 0) {
+            return ResponseJson.error("管理员ID不能为空!", null);
+        }
+        if (null == cmDistribution.name() || null == cmDistribution.mobile() || null == cmDistribution.status()) {
+            return ResponseJson.error("参数异常!", null);
+        }
+        // 验证手机号
+        String result = ValidateUtil.validateMobile(cmDistribution.mobile());
+        if (result != null) {
+            return ResponseJson.error(result);
+        }
+        if (90 != cmDistribution.status()) {
+            cmDistribution.status(91);
+        }
+        CmDistribution cmDistributionById = cmDistribution.id()==null?null:cmDistributionService.getCmDistributionById(cmDistribution.id());
+        CmUser cmUser = baseService.findUserByMobile(cmDistribution.mobile(),cmDistributionById==null?null:cmDistributionById.userId(),null);
+        if (cmUser!=null) {
+            return ResponseJson.error("手机号码已经被使用!", null);
+        }
+        cmDistributionService.addCmDistribution(cmDistribution);
+        return ResponseJson.success();
+    }
+
+}

+ 43 - 0
src/main/java/com/caimei365/user/controller/LoginApi.java

@@ -5,6 +5,7 @@ import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.*;
 import com.caimei365.user.model.vo.MessageCenter;
 import com.caimei365.user.model.vo.UserLoginVo;
+import com.caimei365.user.service.CmDistributionService;
 import com.caimei365.user.service.LoginService;
 import com.caimei365.user.service.SellerService;
 import com.github.pagehelper.PageInfo;
@@ -30,6 +31,7 @@ public class LoginApi {
 
     private final LoginService loginService;
     private final SellerService sellerService;
+    private final CmDistributionService cmDistributionService;
 
     /**
      * 登录(用户名,密码)
@@ -119,6 +121,8 @@ public class LoginApi {
         String unionId = loginPasswordDto.getUnionId();
         return sellerService.passwordLogin(mobile, password, unionId);
     }
+
+
     /**
      * 采购员登录(手机号,验证码) --组织
      *
@@ -129,6 +133,45 @@ public class LoginApi {
     public ResponseJson<UserLoginVo> organizesellerLogin(LoginCodeDto loginCodeDto) {
         return sellerService.organizeCodeLogin(loginCodeDto);
     }
+
+    /**
+     * 分销人员登录(手机号,密码)
+     * @param loginPasswordDto {
+     *                         mobileOrEmail 手机号
+     *                         password 密码
+     *                         }
+     * @return UserLoginVo
+     */
+    @ApiOperation("分销人员登录(手机号,密码)")
+    @PostMapping("/distribution")
+    public ResponseJson<UserLoginVo> distributionLogin(LoginPasswordDto loginPasswordDto) {
+        String mobile = loginPasswordDto.getMobileOrEmail();
+        String password = loginPasswordDto.getPassword();
+        return cmDistributionService.passwordLogin(mobile, password);
+    }
+
+    /**
+     * 分销人员登录(手机号,验证码)
+     *
+     * @return UserLoginVo
+     */
+    @ApiOperation("分销人员登录(手机号,验证码)")
+    @PostMapping("/organizeDistribution")
+    public ResponseJson<UserLoginVo> organizeDistributionLogin(LoginCodeDto loginCodeDto) {
+        return cmDistributionService.organizeCodeLogin(loginCodeDto);
+    }
+
+    /**
+     * 分销机构获取验证码(手机号,验证码)
+     *
+     * @return UserLoginVo
+     */
+    @ApiOperation("分销机构获取验证码(手机号,验证码)")
+    @PostMapping("/organizeDistributionClub")
+    public ResponseJson organizeClubCodeLogin(LoginCodeDto loginCodeDto,String userId) {
+        return cmDistributionService.organizeClubCodeLogin(loginCodeDto,userId);
+    }
+
     /**
      * 微信授权登录(小程序),用户数据存入Redis,key前缀:wxInfo:applets:
      * <p>

+ 21 - 0
src/main/java/com/caimei365/user/controller/RegisterApi.java

@@ -87,6 +87,27 @@ public class RegisterApi {
         return registerService.clubRegister(clubRegisterDto, headers);
     }
 
+    /**
+     * 分销人员生成特殊机构(注册)
+     * <p>
+     * spi旧接口:/club/common
+     *
+     * @param clubRegisterDto ClubRegisterDto{
+     *                        name          机构名称
+     *                        userName          联系人
+     *                        bindMobile        企业绑定手机号
+     *                        }
+     * @param headers         HttpHeaders
+     */
+    @ApiOperation("分销人员生成特殊机构")
+    @Idempotent(prefix = "idempotent_distributionClub", keys = {"#distributionClubRegisterDto"}, expire = 5)
+//    @IpSave(saveName = "分销人员生成特殊机构",saveParams = true)
+    @PostMapping("/distributionClub")
+    public ResponseJson distributionClubRegister(ClubRegisterDto clubRegisterDto, @RequestHeader HttpHeaders headers) {
+
+        return registerService.distributionClubRegister(clubRegisterDto, headers);
+    }
+
     /**
      * 组织普通机构 注册校验
      * @param bindMobile

+ 3 - 0
src/main/java/com/caimei365/user/controller/SellerApi.java

@@ -192,6 +192,9 @@ public class SellerApi {
      */
     @GetMapping("/setHome")
     public ResponseJson<ServiceProviderPo> setSellerHome(ServiceProviderPo serviceProviderPo) {
+        if (null == serviceProviderPo.getUserId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
         return sellerService.setSellerHome(new ServiceProviderPo()
                 .setUserId(serviceProviderPo.getUserId())
                 .setImage(serviceProviderPo.getImage())

+ 47 - 1
src/main/java/com/caimei365/user/mapper/BaseMapper.java

@@ -1,5 +1,6 @@
 package com.caimei365.user.mapper;
 
+import com.caimei365.user.model.po.CmUser;
 import com.caimei365.user.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -154,6 +155,12 @@ public interface BaseMapper {
      * @param userId   用户Id
      */
     void updateMobileByUserId(String mobile, Integer userId);
+    /**
+     * 根据用户Id修改头像
+     * @param image   头像
+     * @param userId   用户Id
+     */
+    void updateImageByUserId(String image, Integer userId);
     /**
      * 根据供应商Id修改手机号
      * @param mobile   手机号
@@ -175,5 +182,44 @@ public interface BaseMapper {
     List<String> findLabelsByLableIds(String labelIds);
 
     Integer findBankByUserId(Integer userId);
-    Integer getByUserId(@Param("userType")Integer userType,@Param("id")Integer id);
+
+    Integer getByUserId(@Param("userType") Integer userType, @Param("id") Integer id);
+
+    String getByMobile(@Param("userIdentity") Integer userIdentity, @Param("userId") Integer userId);
+
+    Integer getByUserCount(CmUser user);
+
+    /**
+     * 新增用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    public int addUser(CmUser user);
+
+    /**
+     * 修改用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    public int updateUser(CmUser user);
+
+
+    /**
+     * 修改机构状态信息
+     *
+     */
+    public int updateClubStatus(Integer userId,Integer status);
+
+    /**
+     * 用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    public CmUser getByUser(CmUser user);
+
+    CmUser findUserByMobile(@Param("mobile") String mobile, @Param("oldUserId") Integer oldUserId, @Param("userIdentity") Integer userIdentity);
+
 }

+ 122 - 0
src/main/java/com/caimei365/user/mapper/CmDistributionMapper.java

@@ -0,0 +1,122 @@
+package com.caimei365.user.mapper;
+
+import java.util.List;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.vo.UserLoginVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * distributionMapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Mapper
+public interface CmDistributionMapper
+{
+    /**
+     * 通过对象查询distribution列表
+     *
+     * @param cmDistribution distribution
+     * @return distribution集合
+     */
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution);
+
+    /**
+     * 通过Id查询distribution对象
+     *
+     * @param id distribution主键
+     * @return distribution
+     */
+    public CmDistribution getCmDistributionById(String id);
+
+    /**
+     * 通过对象查询distribution对象
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 通过对象查询distributionId
+     *
+     * @param cmDistribution distribution
+     * @return String
+     */
+    public String getById(CmDistribution cmDistribution);
+
+    /**
+     * 通过对象查询distributionIds
+     *
+     * @param cmDistribution distribution
+     * @return List<String>
+     */
+    public List<String> getByIds(CmDistribution cmDistribution);
+
+    /**
+     * 通过对象查询distribution记录总数
+     *
+     * @param cmDistribution distribution
+     * @return distributionInteger
+     */
+    public int getCmDistributionCount(CmDistribution cmDistribution);
+
+    /**
+     * 根据手机号获取协销
+     *
+     * @param mobile 手机号
+     * @return UserLoginVo
+     */
+    UserLoginVo getLoginDistributionByMobile(String mobile);
+    /**
+     * 新增distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int addCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 修改distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int updateCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 删除distribution
+     *
+     * @param id distribution主键
+     * @return 结果
+     */
+    public int delCmDistributionById(String id);
+
+    /**
+     * 批量删除distribution
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 批量删除distribution
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistributionByIds(@Param("ids") String[] ids);
+
+    /**
+     * 修改批量删除distribution
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmDistributionByIds(@Param("ids") String[] ids,@Param("delFlag") Integer delFlag);
+}

+ 6 - 0
src/main/java/com/caimei365/user/model/dto/ClubRegisterDto.java

@@ -31,6 +31,12 @@ public class ClubRegisterDto implements Serializable {
      */
     @ApiModelProperty("用户名")
     private String userName;
+
+    /**
+     * 名称
+     */
+    @ApiModelProperty("名称")
+    private String name;
     /**
      * 企业绑定手机号
      */

+ 227 - 0
src/main/java/com/caimei365/user/model/po/CmDistribution.java

@@ -0,0 +1,227 @@
+package com.caimei365.user.model.po;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * distribution对象 cm_distribution
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmDistribution")
+public class CmDistribution implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 用户id */
+    private Integer userId;
+
+    /** 名称 */
+    private String name;
+
+    /** 联系人 */
+    private String linkMan;
+
+    /** 手机号 */
+    private String mobile;
+
+    /** 密码 */
+    private String password;
+
+    /** 公司名称 */
+    private String corporateName;
+
+    /** 分账号 */
+    private String splitCode;
+
+    /** 所属银行 */
+    private String bankName;
+
+    /** 银行卡号 */
+    private String bankAccount;
+
+    /** 状态:90上线,91下线 */
+    private Integer status;
+
+    /** 分销二维码 */
+    private String qrCode;
+
+    /** 头像 */
+    private String image;
+
+    /** 父级团队Id:0表示团队 */
+    private Integer parentId;
+
+    /** 父级团队Id集合 */
+    private String parentIds;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date addTime;
+
+    /** 删除状态 0正常,其他删除 */
+    private Integer delFlag;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLinkMan() {
+        return linkMan;
+    }
+
+    public void setLinkMan(String linkMan) {
+        this.linkMan = linkMan;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getCorporateName() {
+        return corporateName;
+    }
+
+    public void setCorporateName(String corporateName) {
+        this.corporateName = corporateName;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public void setBankName(String bankName) {
+        this.bankName = bankName;
+    }
+
+    public String getBankAccount() {
+        return bankAccount;
+    }
+
+    public void setBankAccount(String bankAccount) {
+        this.bankAccount = bankAccount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getQrCode() {
+        return qrCode;
+    }
+
+    public void setQrCode(String qrCode) {
+        this.qrCode = qrCode;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getParentIds() {
+        return parentIds;
+    }
+
+    public void setParentIds(String parentIds) {
+        this.parentIds = parentIds;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+}
+

+ 488 - 0
src/main/java/com/caimei365/user/model/po/CmUser.java

@@ -0,0 +1,488 @@
+package com.caimei365.user.model.po;
+
+import java.math.BigDecimal;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 用户信息对象 user
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmUser")
+public class CmUser implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String userID;
+
+    /** 采美组织默认为0,具体对应cm_mall_organize表ID */
+    private String userOrganizeID;
+
+    /** 企业账号名【供应商,目前只存数据不能用于登录】 */
+    private String account;
+
+    /** 个人手机号码(协销) */
+    private String mobile;
+
+    /** 企业绑定手机号(机构,供应商) */
+    private String bindMobile;
+
+    /** 用户权限 0游客 1 普通用户 2 会员机构 3 供应商 4 协销 5 普通机构 6 呵呵商城用户【V6.2.0版本后0和1不存在】 */
+    private Integer userPermission;
+
+    /** 用户身份 0、个人 1、协销 2、会员机构 3、供应商 4.普通机构 6、呵呵商城用户【V6.2.0版本后0不存在】 */
+    private String userIdentity;
+
+    /** 邮箱 */
+    private String email;
+
+    /** 用户名(机构联系人,供应商简称) */
+    private String userName;
+
+    /** 真实姓名(供应商的联系人,机构不使用) */
+    private String realName;
+
+    /** 注册来源: 0网站 1小程序 */
+    private String source;
+
+    /** 头像 */
+    private String image;
+
+    /** 密码 */
+    private String password;
+
+    /** 名称(机构名称,供应商的公司名称) */
+    private String name;
+
+    /** 见枚举UserType(1供应商,2协销经理,32协销,3会员机构,4普通机构,6呵呵商城) */
+    private String registerUserTypeID;
+
+    /** 供应商状态, 3待审核, 90已上线,91已下线,92审核不通过 */
+    private Integer manufacturerStatus;
+
+    /** 供应商Id */
+    private Integer shopID;
+
+    /** 审核状态 */
+    private String auditStatus;
+
+    /** 审核时间 */
+    private String auditTime;
+
+    /** 审核备注 */
+    private String auditNote;
+
+    /** 注册时间 */
+    private String registerTime;
+
+    /** 注册ip */
+    private String registerIP;
+
+    /** 注册IP所属地 */
+    private String ipAddress;
+
+    /** 登录时间 */
+    private String loginTime;
+
+    /** 登录ip */
+    private String loginIP;
+
+    /** 用户状态,1正常,0冻结 */
+    private String validFlag;
+
+    /** 会所状态,见表c_clubstatus或枚举ClubStatus */
+    private Integer clubStatus;
+
+    /** 会所Id */
+    private Integer clubID;
+
+    /** 同意协议标志 */
+    private String agreeFlag;
+
+    /** 创客状态 */
+    private Integer serviceProviderStatus;
+
+    /** 创客Id */
+    private Integer serviceProviderID;
+
+    /** 账户线下余额 */
+    private BigDecimal userMoney;
+
+    /** 账户实际可用余额(提交订单未支付的被抵扣后的余额) */
+    private BigDecimal ableUserMoney;
+
+    /** 退出时间 */
+    private String logoffTime;
+
+    /** $column.columnComment */
+    private String appKey;
+
+    /** $column.columnComment */
+    private String appSecret;
+
+    /** 扫描标志(4 CRM拉上来的会所) 0待扫描 1 已扫描 2已上线 */
+    private Integer scanFlag;
+
+    /** 采美豆数量 */
+    private Integer userBeans;
+
+    /** 是否已经引导过(供应商首次登陆操作引导/普通机构升级引导) */
+    private Integer guideFlag;
+
+    /** $column.columnComment */
+    private Integer loginFailTime;
+
+    /** $column.columnComment */
+    private String tipStatus;
+
+    /** 账户线上余额 */
+    private BigDecimal onlineMoney;
+
+    public String getUserID() {
+        return userID;
+    }
+
+    public void setUserID(String userID) {
+        this.userID = userID;
+    }
+
+    public String getUserOrganizeID() {
+        return userOrganizeID;
+    }
+
+    public void setUserOrganizeID(String userOrganizeID) {
+        this.userOrganizeID = userOrganizeID;
+    }
+
+    public String getAccount() {
+        return account;
+    }
+
+    public void setAccount(String account) {
+        this.account = account;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getBindMobile() {
+        return bindMobile;
+    }
+
+    public void setBindMobile(String bindMobile) {
+        this.bindMobile = bindMobile;
+    }
+
+    public Integer getUserPermission() {
+        return userPermission;
+    }
+
+    public void setUserPermission(Integer userPermission) {
+        this.userPermission = userPermission;
+    }
+
+    public String getUserIdentity() {
+        return userIdentity;
+    }
+
+    public void setUserIdentity(String userIdentity) {
+        this.userIdentity = userIdentity;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getRegisterUserTypeID() {
+        return registerUserTypeID;
+    }
+
+    public void setRegisterUserTypeID(String registerUserTypeID) {
+        this.registerUserTypeID = registerUserTypeID;
+    }
+
+    public Integer getManufacturerStatus() {
+        return manufacturerStatus;
+    }
+
+    public void setManufacturerStatus(Integer manufacturerStatus) {
+        this.manufacturerStatus = manufacturerStatus;
+    }
+
+    public Integer getShopID() {
+        return shopID;
+    }
+
+    public void setShopID(Integer shopID) {
+        this.shopID = shopID;
+    }
+
+    public String getAuditStatus() {
+        return auditStatus;
+    }
+
+    public void setAuditStatus(String auditStatus) {
+        this.auditStatus = auditStatus;
+    }
+
+    public String getAuditTime() {
+        return auditTime;
+    }
+
+    public void setAuditTime(String auditTime) {
+        this.auditTime = auditTime;
+    }
+
+    public String getAuditNote() {
+        return auditNote;
+    }
+
+    public void setAuditNote(String auditNote) {
+        this.auditNote = auditNote;
+    }
+
+    public String getRegisterTime() {
+        return registerTime;
+    }
+
+    public void setRegisterTime(String registerTime) {
+        this.registerTime = registerTime;
+    }
+
+    public String getRegisterIP() {
+        return registerIP;
+    }
+
+    public void setRegisterIP(String registerIP) {
+        this.registerIP = registerIP;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public void setIpAddress(String ipAddress) {
+        this.ipAddress = ipAddress;
+    }
+
+    public String getLoginTime() {
+        return loginTime;
+    }
+
+    public void setLoginTime(String loginTime) {
+        this.loginTime = loginTime;
+    }
+
+    public String getLoginIP() {
+        return loginIP;
+    }
+
+    public void setLoginIP(String loginIP) {
+        this.loginIP = loginIP;
+    }
+
+    public String getValidFlag() {
+        return validFlag;
+    }
+
+    public void setValidFlag(String validFlag) {
+        this.validFlag = validFlag;
+    }
+
+    public Integer getClubStatus() {
+        return clubStatus;
+    }
+
+    public void setClubStatus(Integer clubStatus) {
+        this.clubStatus = clubStatus;
+    }
+
+    public Integer getClubID() {
+        return clubID;
+    }
+
+    public void setClubID(Integer clubID) {
+        this.clubID = clubID;
+    }
+
+    public String getAgreeFlag() {
+        return agreeFlag;
+    }
+
+    public void setAgreeFlag(String agreeFlag) {
+        this.agreeFlag = agreeFlag;
+    }
+
+    public Integer getServiceProviderStatus() {
+        return serviceProviderStatus;
+    }
+
+    public void setServiceProviderStatus(Integer serviceProviderStatus) {
+        this.serviceProviderStatus = serviceProviderStatus;
+    }
+
+    public Integer getServiceProviderID() {
+        return serviceProviderID;
+    }
+
+    public void setServiceProviderID(Integer serviceProviderID) {
+        this.serviceProviderID = serviceProviderID;
+    }
+
+    public BigDecimal getUserMoney() {
+        return userMoney;
+    }
+
+    public void setUserMoney(BigDecimal userMoney) {
+        this.userMoney = userMoney;
+    }
+
+    public BigDecimal getAbleUserMoney() {
+        return ableUserMoney;
+    }
+
+    public void setAbleUserMoney(BigDecimal ableUserMoney) {
+        this.ableUserMoney = ableUserMoney;
+    }
+
+    public String getLogoffTime() {
+        return logoffTime;
+    }
+
+    public void setLogoffTime(String logoffTime) {
+        this.logoffTime = logoffTime;
+    }
+
+    public String getAppKey() {
+        return appKey;
+    }
+
+    public void setAppKey(String appKey) {
+        this.appKey = appKey;
+    }
+
+    public String getAppSecret() {
+        return appSecret;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+    public Integer getScanFlag() {
+        return scanFlag;
+    }
+
+    public void setScanFlag(Integer scanFlag) {
+        this.scanFlag = scanFlag;
+    }
+
+    public Integer getUserBeans() {
+        return userBeans;
+    }
+
+    public void setUserBeans(Integer userBeans) {
+        this.userBeans = userBeans;
+    }
+
+    public Integer getGuideFlag() {
+        return guideFlag;
+    }
+
+    public void setGuideFlag(Integer guideFlag) {
+        this.guideFlag = guideFlag;
+    }
+
+    public Integer getLoginFailTime() {
+        return loginFailTime;
+    }
+
+    public void setLoginFailTime(Integer loginFailTime) {
+        this.loginFailTime = loginFailTime;
+    }
+
+    public String getTipStatus() {
+        return tipStatus;
+    }
+
+    public void setTipStatus(String tipStatus) {
+        this.tipStatus = tipStatus;
+    }
+
+    public BigDecimal getOnlineMoney() {
+        return onlineMoney;
+    }
+
+    public void setOnlineMoney(BigDecimal onlineMoney) {
+        this.onlineMoney = onlineMoney;
+    }
+}
+

+ 116 - 0
src/main/java/com/caimei365/user/model/vo/CmDistributionVO.java

@@ -0,0 +1,116 @@
+package com.caimei365.user.model.vo;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import com.caimei365.user.model.po.CmDistribution;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * distribution对象 cm_distribution
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Data
+@Alias("CmDistributionVO")
+public class CmDistributionVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private String id;
+
+    /**
+     * 用户id
+     */
+    private Integer userId;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 联系人
+     */
+    private String linkMan;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 分账号
+     */
+    private String splitCode;
+
+    /**
+     * 状态:90上线,91下线
+     */
+    private Integer status;
+
+    /**
+     * 分销二维码
+     */
+    private String qrCode;
+
+    /**
+     * 头像
+     */
+    private String image;
+
+    /**
+     * 父级团队Id:0表示团队
+     */
+    private Integer parentId;
+
+    /**
+     * 父级团队Id集合
+     */
+    private String parentIds;
+
+    public static List<CmDistributionVO> setValues(List<CmDistribution> cmDistributionList) {
+        List<CmDistributionVO> cmDistributionVOList = new ArrayList<>();
+        if(null!=cmDistributionList) {
+
+            cmDistributionList.forEach(cmDistribution -> {
+                cmDistributionVOList.add(setValue(cmDistribution));
+            });
+        }
+        return cmDistributionVOList;
+    }
+
+    public static CmDistributionVO setValue(CmDistribution cmDistribution) {
+            CmDistributionVO cmDistributionVO = new CmDistributionVO();
+            if(null!=cmDistribution) {
+
+                cmDistributionVO.setId(cmDistribution.getId());
+                cmDistributionVO.setUserId(cmDistribution.getUserId());
+                cmDistributionVO.setName(cmDistribution.getName());
+                cmDistributionVO.setLinkMan(cmDistribution.getLinkMan());
+                cmDistributionVO.setMobile(cmDistribution.getMobile());
+                cmDistributionVO.setSplitCode(cmDistribution.getSplitCode());
+                cmDistributionVO.setStatus(cmDistribution.getStatus());
+                cmDistributionVO.setQrCode(cmDistribution.getQrCode());
+                cmDistributionVO.setImage(cmDistribution.getImage());
+                cmDistributionVO.setParentId(cmDistribution.getParentId());
+                cmDistributionVO.setParentIds(cmDistribution.getParentIds());
+            }
+        return cmDistributionVO;
+    }
+}

+ 12 - 1
src/main/java/com/caimei365/user/service/BaseService.java

@@ -4,6 +4,7 @@ import com.aliyuncs.exceptions.ClientException;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
+import com.caimei365.user.model.po.CmUser;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
@@ -126,12 +127,22 @@ public interface BaseService {
 
     /**
      * 查超级会员套餐详情
+     *
      * @return
      */
     ResponseJson findPackage();
 
     ResponseJson<HashMap<String, String>> ossTokenGet() throws ClientException;
 
-    ResponseJson<Integer>  getByUserId(Integer userType, Integer userId);
+    ResponseJson<Integer> getByUserId(Integer userType, Integer userId);
+
+    String getByMobile( Integer userIdentity,  Integer userId);
+
+    Integer getUserIdByMobile(String mobile);
+
+    Integer getByUserCount(CmUser user);
+
+    CmUser getByUser(CmUser user);
 
+    CmUser findUserByMobile(String mobile, Integer oldUserId, Integer userIdentity);
 }

+ 70 - 0
src/main/java/com/caimei365/user/service/CmDistributionService.java

@@ -0,0 +1,70 @@
+package com.caimei365.user.service;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.LoginCodeDto;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.vo.UserLoginVo;
+
+import java.util.List;
+
+/**
+ * distributionService接口
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+public interface CmDistributionService
+{
+    /**
+     * 通过对象查询distribution列表
+     *
+     * @param cmDistribution distribution
+     * @return distribution集合
+     */
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution);
+
+
+    /**
+     * 通过对象查询distribution
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution);
+
+    public CmDistribution getCmDistributionById(String id);
+
+    /**
+     * 新增distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int addCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 修改distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int updateCmDistribution(CmDistribution cmDistribution);
+
+
+    public ResponseJson<UserLoginVo> passwordLogin(String mobile, String password);
+
+    /**
+     * 分销人员登录验证码登录
+     * @param loginCodeDto
+     * @return
+     */
+    ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto);
+
+    ResponseJson organizeClubCodeLogin(LoginCodeDto loginCodeDto ,String userId);
+    /**
+     * 修改分销人员登录密码
+     * @param cmDistribution
+     * @return
+     */
+     ResponseJson setPassword(CmDistribution cmDistribution, String code);
+}

+ 1 - 0
src/main/java/com/caimei365/user/service/RegisterService.java

@@ -53,6 +53,7 @@ public interface RegisterService {
      */
     ResponseJson clubRegister(ClubRegisterDto clubRegisterDto, HttpHeaders headers);
 
+    public ResponseJson distributionClubRegister(ClubRegisterDto clubRegisterDto, HttpHeaders headers);
     /**
      * 组织注册信息校验
      * @param bindMobile

+ 41 - 4
src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java

@@ -12,6 +12,7 @@ import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
 import com.caimei365.user.model.dto.SuperVipDto;
+import com.caimei365.user.model.po.CmUser;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.po.VipPackage;
 import com.caimei365.user.model.po.VipPayHistoryPo;
@@ -24,6 +25,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
@@ -120,7 +122,8 @@ public class BaseServiceImpl implements BaseService {
      * 获取短信验证码
      *
      * @param mobile           手机号
-     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录,8:联合丽格注册,9:联合丽格登录验证,10:联合丽格找回密码,11:联合丽格更换手机号--旧手机验证码,12:联合丽格更换手机号--新手机验证码,13联合丽格采购员登录
+     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录,8:联合丽格注册,9:联合丽格登录验证,10:联合丽格找回密码,11:联合丽格更换手机号--旧手机验证码,12:联合丽格更换手机号--新手机验证码,13联合丽格采购员登录,
+     *                         14登录分销商城,15分销商城找回密码
      * @param platformType     0:www,1:crm/h5,2:小程序
      * @param isCheckCaptcha   是否检查图片验证码,0:检查,1:不检查
      * @param imgCode          图片验证码
@@ -305,12 +308,20 @@ public class BaseServiceImpl implements BaseService {
             }
             // 【丽格集采联盟】您的验证码为:{s6},5分钟内有效,请勿泄漏他人。
             String content = "【丽格集采联盟】您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
-            sendFlag = isBeta || remoteCallService.remoteSendSms(0,1,mobile,content);
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
             if (!sendFlag) {
                 // 短信发送失败重试一次
-                sendFlag = remoteCallService.remoteSendSms(0,1,mobile,content);
+                sendFlag = remoteCallService.remoteSendSms(0, 1, mobile, content);
             }
             codeTypeTxt = "联合丽格采购员登录";
+        } else if (14 == activateCodeType) {
+            String content = "【分销系统】欢迎登录分销商城,您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
+            codeTypeTxt = "分销商城人员登录";
+        } else if (15 == activateCodeType) {
+            String content = "【分销系统】您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
+            codeTypeTxt = "分销商城找回密码";
         } else {
             return ResponseJson.error("参数错误:activateCodeType");
         }
@@ -318,7 +329,7 @@ public class BaseServiceImpl implements BaseService {
             if (6 == activateCodeType) {
                 //二手验证码10分钟有效期
                 redisService.set("code:" + mobile, randomCode, 600L);
-            } else if (8 == activateCodeType || 10 == activateCodeType || 11 == activateCodeType) {
+            } else if (8 == activateCodeType || 10 == activateCodeType || 11 == activateCodeType||14 == activateCodeType||15 == activateCodeType) {
                 // 联合丽格验证码5分钟有效期
                 redisService.set("code:" + mobile, randomCode, 300L);
             }else {
@@ -332,6 +343,7 @@ public class BaseServiceImpl implements BaseService {
         return ResponseJson.success("发送验证码成功");
     }
 
+
     /**
      * 绑定账号,发送短信验证
      *
@@ -805,4 +817,29 @@ public class BaseServiceImpl implements BaseService {
     public ResponseJson<Integer> getByUserId(Integer userType, Integer id) {
         return ResponseJson.success(baseMapper.getByUserId(userType, id));
     }
+
+    @Override
+    public String getByMobile(Integer userIdentity, Integer userId) {
+        return baseMapper.getByMobile(userIdentity,userId);
+    }
+
+    @Override
+    public Integer getUserIdByMobile(String mobile) {
+        return baseMapper.getUserIdByMobile(mobile);
+    }
+
+    @Override
+    public Integer getByUserCount(CmUser user) {
+        return baseMapper.getByUserCount(user);
+    }
+
+    @Override
+    public CmUser getByUser(CmUser user) {
+        return baseMapper.getByUser(user);
+    }
+
+    @Override
+    public CmUser findUserByMobile(String mobile, Integer oldUserId, Integer userIdentity) {
+        return baseMapper.findUserByMobile(mobile, oldUserId, userIdentity);
+    }
 }

+ 389 - 0
src/main/java/com/caimei365/user/service/impl/CmDistributionServiceImpl.java

@@ -0,0 +1,389 @@
+package com.caimei365.user.service.impl;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.caimei365.user.components.CommonService;
+import com.caimei365.user.components.RedisService;
+import com.caimei365.user.components.WeChatService;
+import com.caimei365.user.mapper.BaseMapper;
+import com.caimei365.user.mapper.CmDistributionMapper;
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.LoginCodeDto;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.po.CmUser;
+import com.caimei365.user.model.vo.UserLoginVo;
+import com.caimei365.user.service.CmDistributionService;
+import com.caimei365.user.service.RemoteCallService;
+import com.caimei365.user.utils.CodeUtil;
+import com.caimei365.user.utils.DateUtil;
+import com.caimei365.user.utils.JwtUtil;
+import com.caimei365.user.utils.Md5Util;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.http.client.utils.DateUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+
+/**
+ * distributionService业务层处理
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Slf4j
+@Service
+public class CmDistributionServiceImpl implements CmDistributionService {
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private BaseMapper baseMapper;
+    @Resource
+    private CmDistributionMapper cmDistributionMapper;
+    @Resource
+    private CommonService commonService;
+    @Resource
+    private RemoteCallService remoteCallService;
+    /**
+     * 通过对象查询distribution列表
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    @Override
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution) {
+        return cmDistributionMapper.getCmDistributionList(cmDistribution);
+    }
+
+
+    /**
+     * 通过对象查询distribution
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    @Override
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution) {
+        return cmDistributionMapper.getByCmDistribution(cmDistribution);
+    }
+
+    /**
+     * 通过对象查询distribution
+     *
+     * @return distribution
+     */
+    @Override
+    public CmDistribution getCmDistributionById(String id) {
+        return cmDistributionMapper.getCmDistributionById(id);
+    }
+
+
+    /**
+     * 新增distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    @Override
+    public int addCmDistribution(CmDistribution cmDistribution) {
+        cmDistribution.linkMan(cmDistribution.name());
+        CmUser cmUser = new CmUser();
+        cmUser.setMobile(cmDistribution.mobile());
+        cmUser.setBindMobile(cmDistribution.mobile());
+        cmUser.setServiceProviderStatus(cmDistribution.status());
+        cmUser.setRealName(cmDistribution.name());
+        cmUser.setUserName(cmDistribution.name());
+        cmUser.setName(cmDistribution.name());
+        cmUser.setAuditStatus("1");
+        cmUser.setAuditTime(DateUtil.formatDateTime(new Date()));
+        if (StringUtils.isBlank(cmDistribution.id())) {
+            String password=(char)(Math.random()*26+'A')+ CodeUtil.generateCodeInt(7);
+            cmUser.setUserOrganizeID("0");
+            cmUser.setMobile(cmDistribution.mobile());
+            cmUser.setBindMobile(cmDistribution.mobile());
+            cmUser.setUserIdentity("7");//外部协销
+            cmUser.setRegisterUserTypeID("32");//协销
+            cmUser.setRegisterTime(DateUtil.formatDateTime(new Date()));
+            cmUser.setValidFlag("1");
+            CmDistribution cmDistributionByParentId = cmDistributionMapper.getCmDistributionById(String.valueOf(cmDistribution.parentId()));
+            cmDistribution.parentIds(cmDistributionByParentId.parentIds() + "," + cmDistribution.parentId());
+            cmDistribution.corporateName(cmDistributionByParentId.corporateName());
+            cmDistribution.password(Md5Util.md5(password));
+            cmUser.setPassword(cmDistribution.password());
+            baseMapper.addUser(cmUser);
+//            cmUser.setServiceProviderID(Integer.valueOf(cmDistribution.id()));
+            cmDistribution.userId(Integer.valueOf(cmUser.getUserID()));
+            cmDistribution.addTime(new Date());
+            String content = "【分销系统】您的分销系统登录账号 :"+cmDistribution.mobile()+",密码:"+password;
+            if (cmDistribution.mobile()!= null && cmDistribution.mobile() != "") {
+                remoteCallService.remoteSendSms(0, 1, cmDistribution.mobile(), content);
+            }
+            return cmDistributionMapper.addCmDistribution(cmDistribution);
+        } else {
+            cmDistributionMapper.updateCmDistribution(cmDistribution);
+            cmUser.setUserID(String.valueOf(cmDistribution.userId()));
+            return baseMapper.updateUser(cmUser);
+        }
+    }
+
+    /**
+     * 修改distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    @Override
+    public int updateCmDistribution(CmDistribution cmDistribution) {
+        cmDistribution.updateTime(new Date());
+        if (StringUtils.isNotBlank(cmDistribution.image())) {
+            baseMapper.updateImageByUserId(cmDistribution.image(), cmDistribution.userId());
+        }
+        if (StringUtils.isNotBlank(cmDistribution.password())) {
+            baseMapper.updatePasswordByUserId(cmDistribution.password(), cmDistribution.userId());
+        }
+        if (null!=cmDistribution.status()) {
+            baseMapper.updateUser(new CmUser()
+                    .userID(String.valueOf(cmDistribution.userId()))
+                    .validFlag(cmDistribution.status()==90?"1":"0"));
+        }
+        return cmDistributionMapper.updateCmDistribution(cmDistribution);
+    }
+
+    /**
+     * 协销登录(手机号,密码)
+     *
+     * @param mobile   手机号
+     * @param password 密码
+     * @return UserLoginVo
+     */
+    @Override
+    public ResponseJson<UserLoginVo> passwordLogin(String mobile, String password) {
+        if (StringUtils.isBlank(mobile) || StringUtils.isBlank(password)) {
+            return ResponseJson.error("请输入账号密码", null);
+        }
+        UserLoginVo distribution = cmDistributionMapper.getLoginDistributionByMobile(mobile);
+        if (null != distribution) {
+            String key = "login-" + distribution.getUserId();
+            boolean exists = redisService.exists(key);
+            //如果30分钟内输入错误记录>=5,return该账号暂时被冻结,请(30-最前一次时间)分钟后重试或直接修改密码
+            if (exists) {
+                String val = (String) redisService.get(key);
+                String[] split = val.split(",");
+                int count = Integer.parseInt(split[0]);
+                if (count >= 5) {
+                    long s = Long.parseLong(split[1]);
+                    int l = (int) Math.floor((System.currentTimeMillis() - s) / 1000 / 60);
+                    return ResponseJson.error("该账号暂时被冻结,请" + (30 - l) + "分钟后重试或直接修改密码", null);
+                }
+            }
+            // 比对密码
+            if (Md5Util.md5(password).equals(distribution.getPassword())) {
+                if (distribution.getServiceStatus().equals(90)) {
+                    // 生成token
+                    String token = JwtUtil.createToken(distribution.getUserId());
+                    // 为了过期续签,将token存入redis,并设置超时时间
+                    redisService.set(token, token, JwtUtil.getExpireTime());
+                    distribution.setToken(token);
+                    log.info("分销人员账号密码登录");
+                    return ResponseJson.success(distribution);
+                } else {
+                    return ResponseJson.error("登录账号已下线,请联系客服", null);
+                }
+            } else {
+                // 增加一次错误输入密码记录,30分钟内连续五次冻结
+                if (exists) {
+                    String val = (String) redisService.get(key);
+                    String[] split = val.split(",");
+                    int count = Integer.parseInt(split[0]);
+                    if (count < 5) {
+                        count++;
+                        String va = count + "," + System.currentTimeMillis();
+                        redisService.set(key, va);
+                    }
+                    if (count >= 5) {
+                        redisService.set(key, 5 + "," + System.currentTimeMillis(), 1800L);
+                    }
+                } else {
+                    String val = 1 + "," + System.currentTimeMillis();
+                    redisService.set(key, val);
+                }
+            }
+        }
+        return ResponseJson.error("账户名与密码不匹配,请重新输入", null);
+    }
+
+
+    /**
+     * 分销人员登录验证码登录
+     *
+     * @param loginCodeDto
+     * @return
+     */
+    @Override
+    public ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto) {
+        String mobile = loginCodeDto.getMobile();
+        String code = loginCodeDto.getCode();
+        if (StringUtils.isBlank(mobile)) {
+            return ResponseJson.error("请输入手机号", null);
+        }
+        if (StringUtils.isBlank(code)) {
+            return ResponseJson.error("请输入验证码", null);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:" + mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    // 根据手机号获取分销人员
+                    UserLoginVo distribution = cmDistributionMapper.getLoginDistributionByMobile(mobile);
+                    if (null!=distribution&&distribution.getServiceStatus().equals(90)) {
+                        // 生成token
+                        String token = JwtUtil.createToken(distribution.getUserId());
+                        // 为了过期续签,将token存入redis,并设置超时时间
+                        redisService.set(token, token, JwtUtil.getExpireTime());
+                        distribution.setToken(token);
+                        log.info("分销人员账号密码登录");
+                        return ResponseJson.success(distribution);
+                    } else {
+                        return ResponseJson.error("登录账号已下线,请联系客服", null);
+                    }
+                } else {
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入", null);
+                }
+            } else {
+                return ResponseJson.error(-1, "验证码错误, 请重新获取", null);
+            }
+        }
+        return ResponseJson.error(-1, "请获短信取验证码", null);
+    }
+
+    /**
+     * 分销人员登录验证码登录
+     *
+     * @param loginCodeDto
+     * @return
+     */
+    @Override
+    public ResponseJson organizeClubCodeLogin(LoginCodeDto loginCodeDto ,String userId) {
+        String mobile = loginCodeDto.getMobile();
+        String code = loginCodeDto.getCode();
+        if (StringUtils.isBlank(mobile)) {
+            return ResponseJson.error("请输入手机号", null);
+        }
+        if (StringUtils.isBlank(code)) {
+            return ResponseJson.error("请输入验证码", null);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:" + mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    // 根据手机号获取分销人员
+                    CmUser user = baseMapper.getByUser(new CmUser().userIdentity("8").userID(userId).bindMobile(mobile));
+                    if (null!=user) {
+                        String password=(char)(Math.random()*26+'A')+CodeUtil.generateCodeInt(7);
+                        baseMapper.updateUser(new CmUser()
+                                .userID(userId)
+                                .validFlag("1")
+                                .clubStatus(90)
+                                .password(Md5Util.md5(password))
+                        );
+                        baseMapper.updateClubStatus(Integer.valueOf(userId),90);
+                        // 发送短信
+                        String content = "【分销系统】亲爱的买家,您好,系统根据您下单时的手机号默认给您生成了登录账号与密码,账号:"+mobile+",密码:"+password+",您可通过手机号与密码或验证码登录分销系统查看您的订单状态";
+                        boolean smsFlag = remoteCallService.remoteSendSms(0, 1, mobile, content);
+                        if (!smsFlag) {
+                            // 短信发送失败重试一次
+                            remoteCallService.remoteSendSms(0, 1, mobile, content);
+                        }
+                        // 生成token
+                        String token = JwtUtil.createToken(Integer.valueOf(userId));
+                        // 为了过期续签,将token存入redis,并设置超时时间
+                        redisService.set(token, token, JwtUtil.getExpireTime());
+                        return ResponseJson.success(null,token);
+                    } else {
+                        return ResponseJson.error("该手机号暂未注册", null);
+                    }
+                } else {
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入", null);
+                }
+            } else {
+                return ResponseJson.error(-1, "验证码错误, 请重新获取", null);
+            }
+        }
+        return ResponseJson.error(-1, "请获短信取验证码", null);
+    }
+
+    /**
+     * 分销人员登录验证码登录
+     *
+     * @param cmDistribution
+     * @return
+     */
+    @Override
+    public ResponseJson setPassword(CmDistribution cmDistribution, String code) {
+        String mobile = cmDistribution.mobile();
+        if (StringUtils.isBlank(mobile)) {
+            return ResponseJson.error("请输入手机号", null);
+        }
+        if (StringUtils.isBlank(code)) {
+            return ResponseJson.error("请输入验证码", null);
+        }
+        UserLoginVo userBy = cmDistributionMapper.getLoginDistributionByMobile(mobile);
+        if (null==userBy) {
+            return ResponseJson.error("该手机号暂未注册", null);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:" + mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    updateCmDistribution(new CmDistribution()
+                            .userId(userBy.getUserId())
+                            .password(Md5Util.md5(cmDistribution.password()))
+                    );
+                    return ResponseJson.success();
+                } else {
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入", null);
+                }
+            } else {
+                return ResponseJson.error(-1, "验证码错误, 请重新获取", null);
+            }
+        }
+        return ResponseJson.error(-1, "请获短信取验证码", null);
+    }
+}
+
+

+ 157 - 3
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -1125,9 +1125,9 @@ public class RegisterServiceImpl implements RegisterService {
         if (StringUtils.isBlank(shopRegisterDto.getBindMobile())) {
             return ResponseJson.error("参数异常:企业绑定手机号不能为空!");
         }
-        if (StringUtils.isBlank(shopRegisterDto.getPassword())) {
-            return ResponseJson.error("参数异常:密码不能为空!");
-        }
+//        if (StringUtils.isBlank(shopRegisterDto.getPassword())) {
+//            return ResponseJson.error("参数异常:密码不能为空!");
+//        }
         if (StringUtils.isBlank(passWordConfirm)) {
             return ResponseJson.error("参数异常:确认密码不能为空!");
         }
@@ -1736,6 +1736,160 @@ public class RegisterServiceImpl implements RegisterService {
         return shortLink;
     }
 
+    /**
+     * 功能描述:分销人员生成机构
+     *
+     * @param clubRegisterDto
+     * @param headers
+     * @return [clubRegisterDto, headers]
+     * @auther: Kaick
+     * @date: 2023/10/10 11:28
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ResponseJson distributionClubRegister(ClubRegisterDto clubRegisterDto, HttpHeaders headers) {
+        // 打印IP
+        String ip = headers.getFirst("X-CLIENT-IP");
+        log.info("机构注册 X-CLIENT-IP : " + ip);
+        // 参数校验
+        if (StringUtils.isBlank(clubRegisterDto.getName())) {
+            return ResponseJson.error("参数异常:名称不能为空!");
+        }
+        // 参数校验
+        if (StringUtils.isBlank(clubRegisterDto.getUserName())) {
+            return ResponseJson.error("参数异常:用户名不能为空!");
+        }
+        if (StringUtils.isBlank(clubRegisterDto.getBindMobile())) {
+            return ResponseJson.error("参数异常:企业绑定手机号不能为空!");
+        }
+        //机构重复则不注册
+        CmUser byUser = baseMapper.getByUser(new CmUser()
+                .userIdentity("8")
+                .validFlag("1")
+                .bindMobile(clubRegisterDto.getBindMobile())
+        );
+        if (null!=byUser) {
+            return ResponseJson.success(String.valueOf(byUser.clubID()), null);
+        }
+        clubRegisterDto.setPassword("1111aaaa");
+        // 获取ip所在地
+        String ipAddress = "";
+        Integer provinceId = null;
+        Integer cityId = null;
+        try {
+            ipAddress = IpUtil.recordIp(ip);
+            Map<String, String> map = IpUtil.recordAddress(ip);
+            // 省
+            String regionPro = map.get("regionPro");
+            provinceId = registerMapper.selProvince(regionPro);
+            // 市
+            String regionCity = map.get("regionCity");
+            cityId = registerMapper.selCity(regionCity);
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        log.info("ip所在地====》" + ipAddress);
+        /*
+            组装用户数据 user
+         */
+        UserPo user = new UserPo();
+        // 设置日期时间格式
+        Date date = new Date();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String current = dateFormat.format(date);
+        // 注册时间
+        user.setRegisterTime(current);
+        // 注册IP
+        user.setRegisterIp(ip);
+        // 注册IP所在地
+        user.setIpAddress(ipAddress);
+        // 注册来源: 0网站 1小程序
+        user.setSource(clubRegisterDto.getSource());
+        // 用户类型,供应商1,会员机构3,普通机构4
+        user.setRegisterUserTypeId(4);
+        // 采美默认组织机构0
+        user.setOrganizeId(0);
+        // 用户名
+        user.setName(clubRegisterDto.getName());
+        user.setUserName(clubRegisterDto.getUserName());
+        // 绑定手机号
+        user.setBindMobile(clubRegisterDto.getBindMobile());
+        // 用户身份: 1协销 2会员机构 3供应商 4普通机构,8分销人员生成机构
+        user.setUserIdentity(8);
+        // 用户权限: 2会员机构 3供应商 4协销 5普通机构
+        user.setUserPermission(5);
+        // 是否已经引导过(机构升级:0否,1是)
+        user.setGuideFlag(0);
+        // 设置机构
+        user.setClubStatus(92);
+        // 设置密码
+        user.setPassword(Md5Util.md5(clubRegisterDto.getPassword()));
+        // 同意协议
+        user.setAgreeFlag(1);
+        // 用户状态,1正常,0冻结
+        user.setValidFlag(0);
+        //采美豆
+        user.setUserBeans(0);
+        // 协销Id,默认采美官方
+        user.setServiceProviderId(clubRegisterDto.getSpId());
+        /*
+            保存数据库 user
+         */
+        int insertFlag = registerMapper.insertClubUser(user);
+        log.info("插入数据库User表,获得userId:" + user.getUserId());
+        if (insertFlag < 1) {
+            throw new RuntimeException("插入数据库异常user:" + user.toString());
+        }
+
+        /*
+          保存用户状态
+         */
+        List<UserPo> userPos = registerMapper.selUser(current);
+        for (UserPo userInfo : userPos) {
+            registerMapper.insertOrgan(userInfo.getUserId());
+        }
+        /*
+            组装机构数据
+         */
+        ClubPo club = new ClubPo();
+        // 机构名称
+        club.setName(user.getName());
+        // 联系手机
+        club.setContractMobile(user.getBindMobile());
+        // 联系人
+        club.setLinkMan(user.getUserName());
+        // 用户Id
+        club.setUserId(user.getUserId());
+        // 注册时间
+        club.setAddTime(current);
+        // 状态设置
+        club.setStatus(92);
+        // 协销Id(spId)
+        club.setServiceProviderId(clubRegisterDto.getSpId());
+        if (4 == user.getUserIdentity()) {
+            if (null != provinceId) {
+                club.setProvinceId(provinceId);
+            }
+            if (null != cityId) {
+                club.setCityId(cityId);
+            }
+        }
+        /*
+            保存数据库 club
+         */
+        int insertClubFlag = registerMapper.insertClub(club);
+        log.info("插入数据库club表,获得clubId:" + club.getClubId());
+        if (insertClubFlag < 1) {
+            throw new RuntimeException("插入数据库异常club:" + club.toString());
+        }
+        // user更新clubId
+        user.setClubId(club.getClubId());
+        registerMapper.updateUserClubId(user.getUserId(), club.getClubId());
+
+        return ResponseJson.success(String.valueOf(club.getClubId()), null);
+    }
+
 //    public static void main(String[] args) throws ParseException {
 //        Date d=new Date();
 //        //1.日期格式

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -17,4 +17,4 @@ mybatis:
   # 扫描classpath中mapper目录下的映射配置文件,针对于映射文件放到了resources目录下
   mapper-locations: classpath:/mapper/*.xml
   # 定义包别名,使用pojo时可以直接使用pojo的类型名称不用加包名
-  type-aliases-package: com.caimei365.user.model
+  type-aliases-package: com.caimei365.user.model

+ 464 - 4
src/main/resources/mapper/BaseMapper.xml

@@ -11,6 +11,14 @@
         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}
@@ -40,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)
+          and u.userIdentity in (1, 2, 3, 4,7)
         UNION
         SELECT u.userID
         FROM USER u
@@ -206,14 +214,466 @@
     <select id="getByUserId" resultType="java.lang.Integer">
         <if test="userType != null">
             <if test="userType == 1">
-            SELECT userID from  club   WHERE  clubId = #{id}
+                SELECT userID from club WHERE clubId = #{id}
             </if>
             <if test="userType == 2">
-            SELECT userID from  shop   WHERE  shopId = #{id}
+                SELECT userID from shop WHERE shopId = #{id}
             </if>
             <if test="userType == 3">
-            SELECT userID from  serviceprovider  WHERE  serviceProviderID = #{id}
+                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="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>
+
 </mapper>

+ 391 - 0
src/main/resources/mapper/CmDistributionMapper.xml

@@ -0,0 +1,391 @@
+<?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.CmDistributionMapper">
+
+    <resultMap type="CmDistribution" id="CmDistributionResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="userId"    />
+        <result property="name"    column="name"    />
+        <result property="linkMan"    column="linkMan"    />
+        <result property="mobile"    column="mobile"    />
+        <result property="password"    column="password"    />
+        <result property="corporateName"    column="corporateName"    />
+        <result property="splitCode"    column="splitCode"    />
+        <result property="bankName"    column="bankName"    />
+        <result property="bankAccount"    column="bankAccount"    />
+        <result property="status"    column="status"    />
+        <result property="qrCode"    column="qrCode"    />
+        <result property="parentId"    column="parentId"    />
+        <result property="parentIds"    column="parentIds"    />
+        <result property="updateTime"    column="updateTime"    />
+        <result property="addTime"    column="addTime"    />
+        <result property="delFlag"    column="delFlag"    />
+        <result property="image"    column="image"    />
+    </resultMap>
+
+    <sql id="selectCmDistributionVo">
+         select
+         cm_distribution.id,
+         cm_distribution.userId,
+         cm_distribution.name,
+         cm_distribution.linkMan,
+         cm_distribution.mobile,
+         cm_distribution.password,
+         cm_distribution.corporateName,
+         cm_distribution.splitCode,
+         cm_distribution.bankName,
+         cm_distribution.bankAccount,
+         cm_distribution.status,
+         cm_distribution.qrCode,
+         cm_distribution.parentId,
+         cm_distribution.parentIds,
+         cm_distribution.updateTime,
+         cm_distribution.addTime,
+         cm_distribution.delFlag,
+         u.image
+    </sql>
+
+    <select id="getByCmDistribution" parameterType="CmDistribution" resultMap="CmDistributionResult">
+        <include refid="selectCmDistributionVo"/>
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+        order by cm_distribution.addTime desc
+        limit 0,1
+    </select>
+
+    <select id="getCmDistributionList" parameterType="CmDistribution" resultMap="CmDistributionResult">
+        <include refid="selectCmDistributionVo"/>
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+        order by cm_distribution.addTime desc
+    </select>
+
+    <select id="getCmDistributionCount" parameterType="CmDistribution" resultType="int">
+       select count(1)
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and  id != ''">
+                    and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                        = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                            #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+    </select>
+
+    <select id="getCmDistributionById" parameterType="String" resultMap="CmDistributionResult">
+        <include refid="selectCmDistributionVo"/>
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        where  cm_distribution.delFlag = 0 and cm_distribution.id = #{id}
+    </select>
+
+    <select id="getByIds" parameterType="CmDistribution" resultType="String">
+        select id
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+                <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+    </select>
+
+    <select id="getById" parameterType="CmDistribution" resultType="String">
+        select id
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toString().toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toString().toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+                <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+        limit 0,1
+    </select>
+
+    <select id="getLoginDistributionByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
+        select u.userID         as userId,
+               u.clubID         as clubId,
+               u.shopID         as shopId,
+               u.userName       as userName,
+               u.name           as name,
+               u.mobile         as mobile,
+               u.bindMobile     as bindMobile,
+               u.email          as email,
+               u.image          as image,
+               u.guideFlag      as guideFlag,
+               u.userPermission as userPermission,
+               u.userIdentity   as userIdentity,
+               u.serviceProviderID as serviceProviderId,
+               u.serviceProviderStatus as serviceStatus,
+               u.password       as password
+        from user u
+        where u.bindMobile = #{mobile}
+          and u.userIdentity = 7
+          and u.validFlag = 1
+    </select>
+
+    <insert id="addCmDistribution" parameterType="CmDistribution" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_distribution
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="userId != null">userId,</if>
+            <if test="name != null and name != ''">name,</if>
+            <if test="linkMan != null and linkMan != ''">linkMan,</if>
+            <if test="mobile != null and mobile != ''">mobile,</if>
+            <if test="password != null and password != ''">password,</if>
+            <if test="corporateName != null and corporateName != ''">corporateName,</if>
+            <if test="splitCode != null and splitCode != ''">splitCode,</if>
+            <if test="bankName != null and bankName != ''">bankName,</if>
+            <if test="bankAccount != null and bankAccount != ''">bankAccount,</if>
+            <if test="status != null">status,</if>
+            <if test="qrCode != null and qrCode != ''">qrCode,</if>
+            <if test="parentId != null">parentId,</if>
+            <if test="parentIds != null and parentIds != ''">parentIds,</if>
+            <if test="updateTime != null">updateTime,</if>
+            <if test="addTime != null">addTime,</if>
+            <if test="delFlag != null">delFlag,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="linkMan != null and linkMan != ''">#{linkMan},</if>
+            <if test="mobile != null and mobile != ''">#{mobile},</if>
+            <if test="password != null and password != ''">#{password},</if>
+            <if test="corporateName != null and corporateName != ''">#{corporateName},</if>
+            <if test="splitCode != null and splitCode != ''">#{splitCode},</if>
+            <if test="bankName != null and bankName != ''">#{bankName},</if>
+            <if test="bankAccount != null and bankAccount != ''">#{bankAccount},</if>
+            <if test="status != null">#{status},</if>
+            <if test="qrCode != null and qrCode != ''">#{qrCode},</if>
+            <if test="parentId != null">#{parentId},</if>
+            <if test="parentIds != null and parentIds != ''">#{parentIds},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="addTime != null">#{addTime},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCmDistribution" parameterType="CmDistribution">
+        update cm_distribution
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">userId = #{userId},</if>
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="linkMan != null and linkMan != ''">linkMan = #{linkMan},</if>
+            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+            <if test="password != null and password != ''">password = #{password},</if>
+            <if test="corporateName != null and corporateName != ''">corporateName = #{corporateName},</if>
+            <if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
+            <if test="bankName != null and bankName != ''">bankName = #{bankName},</if>
+            <if test="bankAccount != null and bankAccount != ''">bankAccount = #{bankAccount},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="qrCode != null and qrCode != ''">qrCode = #{qrCode},</if>
+            <if test="parentId != null">parentId = #{parentId},</if>
+            <if test="parentIds != null and parentIds != ''">parentIds = #{parentIds},</if>
+            <if test="updateTime != null">updateTime = #{updateTime},</if>
+            <if test="addTime != null">addTime = #{addTime},</if>
+            <if test="delFlag != null">delFlag = #{delFlag},</if>
+        </trim>
+        where 1=1
+        <if test="id != null">and id = #{id}</if>
+        <if test="userId != null">and userId = #{userId}</if>
+    </update>
+
+    <update id="updateDelCmDistributionByIds" parameterType="String">
+        update cm_distribution set delFlag=#{delFlag} where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <delete id="delCmDistributionById" parameterType="String">
+        delete
+        from cm_distribution where id = #{id}
+    </delete>
+
+    <delete id="delCmDistribution" parameterType="CmDistribution">
+        delete
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+            <if test="delFlag != null "> and cm_distribution.delFlag = #{delFlag}</if>
+        </where>
+    </delete>
+
+    <delete id="delCmDistributionByIds" parameterType="String">
+        delete from cm_distribution where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>