Explorar el Código

1、学生基本信息,增加tree接口
2、教师基本信息,增加orgId查询条件
3、学生基本信息,解决classId不生效问题

dzx hace 1 año
padre
commit
466df2bb9a

+ 42 - 5
src/main/java/com/xjrsoft/module/student/controller/StudentManagerController.java

@@ -7,12 +7,15 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.toolkit.MPJWrappers;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.model.result.R;
+import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.common.utils.TreeUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.service.IBaseClassService;
+import com.xjrsoft.module.base.service.IBaseGradeService;
 import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
 import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentUserDto;
@@ -20,16 +23,23 @@ import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.entity.BaseStudentUser;
 import com.xjrsoft.module.student.service.IStudentManagerService;
+import com.xjrsoft.module.student.vo.BaseStudentTreeVo;
 import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
 import com.xjrsoft.module.student.vo.BaseStudentUserVo;
-import com.xjrsoft.module.system.entity.DictionaryDetail;
-import com.xjrsoft.module.system.entity.Menu;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 @RestController
@@ -39,6 +49,8 @@ import java.util.List;
 public class StudentManagerController {
 
     private final IStudentManagerService studentManagerService;
+    private final IBaseGradeService baseGradeService;
+    private final IBaseClassService baseClassService;
 
 
     @GetMapping(value = "/page")
@@ -52,7 +64,7 @@ public class StudentManagerController {
                         .like(StrUtil.isNotBlank(dto.getMobile()), BaseStudentUser::getMobile, dto.getMobile())
                         .like(StrUtil.isNotBlank(dto.getName()), BaseStudentUser::getName, dto.getName())
                         .like(StrUtil.isNotBlank(dto.getEmail()), BaseStudentUser::getEmail, dto.getEmail())
-                        .eq(ObjectUtil.isNotNull(dto.getClassId()), BaseStudent::getId, dto.getClassId())
+                        .eq(ObjectUtil.isNotNull(dto.getClassId()), BaseClass::getId, dto.getClassId())
                         .in((ObjectUtil.isNotNull(dto.getTokenType()) && dto.getTokenType() == 1), BaseClass::getTeacherId, StpUtil.getLoginIdAsLong())
                         .orderByDesc(BaseStudentUser::getId)
                         .select(BaseStudentUser::getId)
@@ -73,6 +85,31 @@ public class StudentManagerController {
         return R.ok(pageOutput);
     }
 
+    @GetMapping(value = "/tree")
+    @ApiOperation(value = "学生年纪班级树")
+    @SaCheckPermission("studentmanager:detail")
+    public RT<List<BaseStudentTreeVo>> tree() {
+        List<BaseStudentTreeVo> voList = new ArrayList<>();
+        baseGradeService.list().forEach((node) -> {
+            voList.add(new BaseStudentTreeVo(){{
+                setId(node.getId());
+                setName(node.getName());
+            }});
+        });
+
+        baseClassService.list().forEach((node)->{
+            voList.add(new BaseStudentTreeVo(){{
+                setId(node.getId());
+                setName(node.getName());
+                setParentId(node.getGradeId());
+            }});
+        });
+
+        List<BaseStudentTreeVo> treeVoList = TreeUtil.build(voList);
+
+        return RT.ok(treeVoList);
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value = "根据id查询学生信息")
     @SaCheckPermission("studentmanager:detail")

+ 29 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentTreeVo.java

@@ -0,0 +1,29 @@
+package com.xjrsoft.module.student.vo;
+
+import com.xjrsoft.common.model.tree.ITreeNode;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class BaseStudentTreeVo implements ITreeNode<BaseStudentTreeVo,Long>, Serializable {
+
+
+    @ApiModelProperty("id")
+    private Long id;
+
+
+    @ApiModelProperty("name")
+    private String name;
+
+
+    @ApiModelProperty("disabled")
+    private Long parentId;
+
+
+    @ApiModelProperty("children")
+    private List<BaseStudentTreeVo> children;
+
+}

+ 4 - 1
src/main/java/com/xjrsoft/module/teacher/controller/TeacherbaseManagerController.java

@@ -9,6 +9,7 @@ import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.organization.entity.UserDeptRelation;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.system.service.IDictionarydetailService;
 import com.xjrsoft.module.teacher.dto.AddXjrUserDto;
@@ -55,13 +56,15 @@ public class TeacherbaseManagerController {
                 .like(StrUtil.isNotBlank(dto.getMobile()),XjrUser::getMobile,dto.getMobile())
                 .like(StrUtil.isNotBlank(dto.getName()),XjrUser::getName,dto.getName())
                 .like(StrUtil.isNotBlank(dto.getEmail()),XjrUser::getEmail,dto.getEmail())
-                    .orderByDesc(XjrUser::getId)
+                .eq(UserDeptRelation::getDeptId, dto.getOrgId())
+                .orderByDesc(XjrUser::getId)
                 .select(XjrUser::getId)
                 .select(XjrUser.class,x -> VoToColumnUtil.fieldsToColumns(XjrUserPageVo.class).contains(x.getProperty()))
                 .innerJoin(BaseTeacher.class,BaseTeacher::getUserId,XjrUser::getId)
                 .leftJoin(DictionaryDetail.class,DictionaryDetail::getCode,BaseTeacher::getJobState,ext->ext.selectAs(DictionaryDetail::getName, XjrUserPageVo::getJobState))
                 .leftJoin(DictionaryDetail.class,DictionaryDetail::getCode,XjrUser::getCredentialType,ext->ext.selectAs(DictionaryDetail::getName, XjrUserPageVo::getCredentialType))
                 .leftJoin(DictionaryDetail.class,DictionaryDetail::getCode,BaseTeacher::getEmployWay,ext->ext.selectAs(DictionaryDetail::getName, XjrUserPageVo::getEmployWay))
+                .leftJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId)
                 .selectAsClass(BaseTeacher.class, XjrUserPageVo.class);
 
         IPage<XjrUser> page = teacherbaseManagerService.page(ConventPage.getPage(dto), queryWrapper);

+ 6 - 0
src/main/java/com/xjrsoft/module/teacher/dto/XjrUserPageDto.java

@@ -37,4 +37,10 @@ public class XjrUserPageDto extends PageInput {
     @ApiModelProperty("邮箱")
     private String email;
 
+    /**
+     * 机构id
+     */
+    @ApiModelProperty("机构id")
+    private Long orgId;
+
 }