Pārlūkot izejas kodu

用户 项目层叠2

Reiskuchen 5 gadi atpakaļ
vecāks
revīzija
c07ac459f3

+ 3 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -108,11 +108,12 @@ public class UserController {
      * role 角色 0-普通员工 2-管理员
      * role 角色 0-普通员工 2-管理员
      * cost 成本
      * cost 成本
      * departmentId 部门id 不传或0-其他部门 其他部门id-相应部门
      * departmentId 部门id 不传或0-其他部门 其他部门id-相应部门
+     * departmentCascade 部门层叠关系字符串 默认"0"
      */
      */
     @RequestMapping("/insertUser")
     @RequestMapping("/insertUser")
     public HttpRespMsg insertUser(String id, @RequestParam String name, @RequestParam String phone,
     public HttpRespMsg insertUser(String id, @RequestParam String name, @RequestParam String phone,
-                                  @RequestParam Integer role, Double cost, Integer departmentId) {
-        return userService.insertUser(id, name, phone, role, cost, departmentId, request);
+                                  @RequestParam Integer role, Double cost, Integer departmentId, String departmentCascade) {
+        return userService.insertUser(id, name, phone, role, cost, departmentId, departmentCascade, request);
     }
     }
 
 
     /**
     /**

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java

@@ -31,7 +31,7 @@ public interface UserService extends IService<User> {
     HttpRespMsg insertCompany(String companyName, String name, String phone);
     HttpRespMsg insertCompany(String companyName, String name, String phone);
 
 
     HttpRespMsg insertUser(String id, String name, String phone, Integer role, Double cost, Integer departmentId,
     HttpRespMsg insertUser(String id, String name, String phone, Integer role, Double cost, Integer departmentId,
-                           HttpServletRequest request);
+                           String departmentCascade, HttpServletRequest request);
 
 
     HttpRespMsg importUser(MultipartFile multipartFile, HttpServletRequest request);
     HttpRespMsg importUser(MultipartFile multipartFile, HttpServletRequest request);
 
 

+ 5 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -297,7 +297,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     //新增或修改用户
     //新增或修改用户
     @Override
     @Override
     public HttpRespMsg insertUser(String targetId, String name, String phone, Integer role, Double cost,
     public HttpRespMsg insertUser(String targetId, String name, String phone, Integer role, Double cost,
-                                  Integer departmentId, HttpServletRequest request) {
+                                  Integer departmentId, String departmentCascade, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
         try {
             User creator = userMapper.selectById(request.getHeader("Token"));
             User creator = userMapper.selectById(request.getHeader("Token"));
@@ -328,7 +328,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                                     .setRole(role)
                                     .setRole(role)
                                     .setCompanyId(creator.getCompanyId())
                                     .setCompanyId(creator.getCompanyId())
                                     .setCost(costValue)
                                     .setCost(costValue)
-                                    .setDepartmentId(departmentId == null ? 0 : departmentId);
+                                    .setDepartmentId(departmentId == null ? 0 : departmentId)
+                                    .setDepartmentCascade(departmentCascade);
                             if (userMapper.insert(user) == 0) {
                             if (userMapper.insert(user) == 0) {
                                 httpRespMsg.setError("操作失败");
                                 httpRespMsg.setError("操作失败");
                             }
                             }
@@ -342,7 +343,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                         .setPhone(phone)
                         .setPhone(phone)
                         .setRole(role)
                         .setRole(role)
                         .setCost(costValue)
                         .setCost(costValue)
-                        .setDepartmentId(departmentId == null ? 0 : departmentId));
+                        .setDepartmentId(departmentId == null ? 0 : departmentId)
+                        .setDepartmentCascade(departmentCascade));
             }
             }
         } catch (NullPointerException e) {
         } catch (NullPointerException e) {
             httpRespMsg.setError("数据有误 验证失败");
             httpRespMsg.setError("数据有误 验证失败");