|
@@ -7,12 +7,15 @@ import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.github.yulichang.toolkit.MPJWrappers;
|
|
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.R;
|
|
|
|
+import com.xjrsoft.common.model.result.RT;
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
|
+import com.xjrsoft.common.utils.TreeUtil;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
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.AddBaseStudentUserDto;
|
|
import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
|
|
import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
|
|
import com.xjrsoft.module.student.dto.UpdateBaseStudentUserDto;
|
|
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.BaseStudentSchoolRoll;
|
|
import com.xjrsoft.module.student.entity.BaseStudentUser;
|
|
import com.xjrsoft.module.student.entity.BaseStudentUser;
|
|
import com.xjrsoft.module.student.service.IStudentManagerService;
|
|
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.BaseStudentUserPageVo;
|
|
import com.xjrsoft.module.student.vo.BaseStudentUserVo;
|
|
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.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
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 javax.validation.Valid;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -39,6 +49,8 @@ import java.util.List;
|
|
public class StudentManagerController {
|
|
public class StudentManagerController {
|
|
|
|
|
|
private final IStudentManagerService studentManagerService;
|
|
private final IStudentManagerService studentManagerService;
|
|
|
|
+ private final IBaseGradeService baseGradeService;
|
|
|
|
+ private final IBaseClassService baseClassService;
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
@GetMapping(value = "/page")
|
|
@@ -52,7 +64,7 @@ public class StudentManagerController {
|
|
.like(StrUtil.isNotBlank(dto.getMobile()), BaseStudentUser::getMobile, dto.getMobile())
|
|
.like(StrUtil.isNotBlank(dto.getMobile()), BaseStudentUser::getMobile, dto.getMobile())
|
|
.like(StrUtil.isNotBlank(dto.getName()), BaseStudentUser::getName, dto.getName())
|
|
.like(StrUtil.isNotBlank(dto.getName()), BaseStudentUser::getName, dto.getName())
|
|
.like(StrUtil.isNotBlank(dto.getEmail()), BaseStudentUser::getEmail, dto.getEmail())
|
|
.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())
|
|
.in((ObjectUtil.isNotNull(dto.getTokenType()) && dto.getTokenType() == 1), BaseClass::getTeacherId, StpUtil.getLoginIdAsLong())
|
|
.orderByDesc(BaseStudentUser::getId)
|
|
.orderByDesc(BaseStudentUser::getId)
|
|
.select(BaseStudentUser::getId)
|
|
.select(BaseStudentUser::getId)
|
|
@@ -73,6 +85,31 @@ public class StudentManagerController {
|
|
return R.ok(pageOutput);
|
|
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")
|
|
@GetMapping(value = "/info")
|
|
@ApiOperation(value = "根据id查询学生信息")
|
|
@ApiOperation(value = "根据id查询学生信息")
|
|
@SaCheckPermission("studentmanager:detail")
|
|
@SaCheckPermission("studentmanager:detail")
|