dzx пре 1 година
родитељ
комит
0bbc38eae3

+ 41 - 0
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -6,12 +6,14 @@ import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.constant.GlobalConstant;
+import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.RoleEnum;
@@ -22,6 +24,7 @@ import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.sms.SmsCtcc;
 import com.xjrsoft.common.utils.RedisUtil;
+import com.xjrsoft.common.utils.TreeUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.config.CommonPropertiesConfig;
 import com.xjrsoft.module.base.service.IBaseClassService;
@@ -53,6 +56,7 @@ import com.xjrsoft.module.organization.service.IUserRoleRelationService;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.organization.service.IUserStudentService;
 import com.xjrsoft.module.organization.utils.OrganizationUtil;
+import com.xjrsoft.module.organization.vo.DepartmentTreeVo;
 import com.xjrsoft.module.organization.vo.PendingCountDto;
 import com.xjrsoft.module.organization.vo.ResetUserPageVo;
 import com.xjrsoft.module.organization.vo.ResetUserRoleVo;
@@ -357,6 +361,43 @@ public class UserController {
         return RT.ok(roleList);
     }
 
+    @GetMapping(value = "/pc-role-tree")
+    @ApiOperation(value = "pc端用户列表分类")
+    public RT<List<ResetUserRoleVo>> pcRoleTree() {
+        List<Department> departmentList = departmentService.list(
+            new QueryWrapper<Department>().lambda()
+            .eq(Department::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        List<ResetUserRoleVo> voList = new ArrayList<>();
+        for (Department department : departmentList) {
+            ResetUserRoleVo roleVo = BeanUtil.toBean(department, ResetUserRoleVo.class);
+            roleVo.setType(2);
+            voList.add(roleVo);
+        }
+
+        List<ResetUserRoleVo> treeVoList = TreeUtil.build(voList);
+        List<ResetUserRoleVo> roleList =  new ArrayList<>();
+        ResetUserRoleVo roleVo = new ResetUserRoleVo() {{
+            setId(2L);
+            setType(1);
+            setName("教师");
+            setChildren(treeVoList);
+        }};
+        roleList.add(roleVo);
+        roleList.add(new ResetUserRoleVo(){{
+            setId(3L);
+            setType(1);
+            setName("学生");
+        }});
+        roleList.add(new ResetUserRoleVo(){{
+            setId(4L);
+            setType(1);
+            setName("家长");
+        }});
+
+        return RT.ok(roleList);
+    }
+
     @PutMapping("/update/info")
     @ApiOperation(value = "登陆人修改自己得用户信息")
     public R updateInfo(@RequestBody @Valid UpdateInfoDto dto) {

+ 8 - 1
src/main/java/com/xjrsoft/module/organization/vo/ResetUserRoleVo.java

@@ -1,9 +1,11 @@
 package com.xjrsoft.module.organization.vo;
 
+import com.xjrsoft.common.model.tree.ITreeNode;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * @title: 移动端重置密码用户列表
@@ -12,7 +14,7 @@ import java.io.Serializable;
  * @Version 1.0
  */
 @Data
-public class ResetUserRoleVo implements Serializable {
+public class ResetUserRoleVo implements ITreeNode<ResetUserRoleVo,Long>, Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -27,6 +29,11 @@ public class ResetUserRoleVo implements Serializable {
     @ApiModelProperty("名称")
     private String name;
 
+    @ApiModelProperty("类型:1:角色, 2:部门")
+    private Integer type;
 
+    @ApiModelProperty("父级id")
+    private Long parentId;
 
+    private List<ResetUserRoleVo> children;
 }