wang-hao-jie
2022-03-17 6dfd2599d2e52507e018fd4c6b35d38873e48cfb
xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java
@@ -157,8 +157,8 @@
        User u = securityUtil.getCurrUser();
        // 清除持久上下文环境 避免后面语句导致持久化
        entityManager.clear();
        u.setPassword(null);
//        entityManager.clear();
//        u.setPassword(null);
        return new ResultUtil<User>().setData(u);
    }
@@ -231,8 +231,8 @@
        User user = securityUtil.getCurrUser();
        // 在线DEMO所需
        if ("test".equals(user.getUsername()) || "test2".equals(user.getUsername())) {
            return ResultUtil.error("演示账号不支持修改密码");
        if (user.getType()==0) {
            return ResultUtil.error("业务账号不支持修改密码");
        }
        if (!new BCryptPasswordEncoder().matches(password, user.getPassword())) {
@@ -276,10 +276,10 @@
    public Result<List<User>> getByCondition(@PathVariable String departmentId) {
        List<User> list = userService.findByDepartmentId(departmentId);
        entityManager.clear();
        list.forEach(u -> {
            u.setPassword(null);
        });
//        entityManager.clear();
//        list.forEach(u -> {
//            u.setPassword(null);
//        });
        return new ResultUtil<List<User>>().setData(list);
    }
@@ -288,10 +288,10 @@
    public Result<List<User>> searchByName(@PathVariable String username) throws UnsupportedEncodingException {
        List<User> list = userService.findByUsernameLikeAndStatus(URLDecoder.decode(username, "utf-8"), CommonConstant.STATUS_NORMAL);
        entityManager.clear();
        list.forEach(u -> {
            u.setPassword(null);
        });
//        entityManager.clear();
//        list.forEach(u -> {
//            u.setPassword(null);
//        });
        return new ResultUtil<List<User>>().setData(list);
    }
@@ -301,10 +301,10 @@
        List<User> list = userService.getAll();
        // 清除持久上下文环境 避免后面语句导致持久化
        entityManager.clear();
        for (User u : list) {
            u.setPassword(null);
        }
//        entityManager.clear();
//        for (User u : list) {
//            u.setPassword(null);
//        }
        return new ResultUtil<List<User>>().setData(list);
    }
@@ -536,9 +536,9 @@
        List<User> list = userService.findByType2(type);
        // 清除持久上下文环境 避免后面语句导致持久化
        List<User> list1 = new ArrayList<User>();
        entityManager.clear();
        //entityManager.clear();
        for (User u : list) {
            u.setPassword(null);
            //u.setPassword(null);
            if (u.getType()==0){
                list1.add(u);
            }