wang-hao-jie
2022-01-18 d9da603305a2b94bde78483fa8777a43ee352548
xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java
@@ -315,7 +315,7 @@
        // 校验是否已存在
        checkUserInfo(u.getUsername(), u.getMobile(), u.getEmail());
        u.setDescription(u.getPassword());
        String encryptPass = new BCryptPasswordEncoder().encode(u.getPassword());
        u.setPassword(encryptPass);
        if (StrUtil.isNotBlank(u.getDepartmentId())) {
@@ -355,9 +355,9 @@
        if (!old.getMobile().equals(u.getMobile()) && userService.findByMobile(u.getMobile()) != null) {
            return ResultUtil.error("该手机号已绑定其他账户");
        }
        if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) {
            return ResultUtil.error("该邮箱已绑定其他账户");
        }
//        if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) {
//            return ResultUtil.error("该邮箱已绑定其他账户");
//        }
        if (StrUtil.isNotBlank(u.getDepartmentId())) {
            Department d = departmentService.get(u.getDepartmentId());
@@ -528,4 +528,21 @@
            throw new XbootException("该手机号已被注册");
        }
    }
    @RequestMapping(value = "/findByType2", method = RequestMethod.GET)
    @ApiOperation(value = "获取全部用户数据")
    public Result<List<User>> findByType2(int type) {
        List<User> list = userService.findByType2(type);
        // 清除持久上下文环境 避免后面语句导致持久化
        List<User> list1 = new ArrayList<User>();
        entityManager.clear();
        for (User u : list) {
            u.setPassword(null);
            if (u.getType()==0){
                list1.add(u);
            }
        }
        return new ResultUtil<List<User>>().setData(list1);
    }
}