|
|
@@ -2,20 +2,30 @@ package com.xjrsoft.module.student.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
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.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.student.dto.AddBaseStudentAssessmentInspectionDto;
|
|
|
import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
|
|
|
import com.xjrsoft.module.student.dto.UpdateBaseStudentAssessmentInspectionDto;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentAssessmentCategory;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentAssessmentClassRelation;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentAssessmentProject;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentAssessmentStudentRelation;
|
|
|
+import com.xjrsoft.module.student.service.IBaseStudentAssessmentClassRelationService;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentAssessmentInspectionService;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentAssessmentClassRelationListVo;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentAssessmentStudentRelationVo;
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -46,18 +56,34 @@ public class BaseStudentAssessmentInspectionController {
|
|
|
|
|
|
|
|
|
private final IBaseStudentAssessmentInspectionService baseStudentAssessmentInspectionService;
|
|
|
+ private final IBaseStudentAssessmentClassRelationService baseStudentAssessmentClassRelationService;
|
|
|
+ private final com.xjrsoft.module.student.service.IBaseStudentAssessmentStudentRelationService baseStudentAssessmentStudentRelationService;
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
|
@ApiOperation(value="学生班级巡查考核列表(分页)")
|
|
|
@SaCheckPermission("basestudentassessmentinspection:detail")
|
|
|
public RT<PageOutput<BaseStudentAssessmentInspectionPageVo>> page(@Valid BaseStudentAssessmentInspectionPageDto dto){
|
|
|
+
|
|
|
+ //未传流程状态不返回数据
|
|
|
+ if(ObjectUtil.isNull(dto) || ObjectUtil.isNull(dto.getStatus())){
|
|
|
+ PageOutput<BaseStudentAssessmentInspectionPageVo> result = ConventPage.getPageOutputNull(BaseStudentAssessmentInspectionPageVo.class);
|
|
|
+ return RT.ok(result);
|
|
|
+ }
|
|
|
IPage<BaseStudentAssessmentInspectionPageVo> page = baseStudentAssessmentInspectionService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentAssessmentInspectionPageVo.class,
|
|
|
MPJWrappers.<BaseStudentAssessmentInspection>lambdaJoin()
|
|
|
+ .like(StrUtil.isNotEmpty(dto.getCreateUserName()), XjrUser::getName, dto.getCreateUserName())
|
|
|
+ .like(StrUtil.isNotEmpty(dto.getModifyUserName()), XjrUser::getName, dto.getModifyUserName())
|
|
|
+ .eq(BaseStudentAssessmentInspection::getStatus, dto.getStatus())
|
|
|
+ .eq(StrUtil.isNotEmpty(dto.getEnrollType()), BaseClass::getEnrollType, dto.getEnrollType())
|
|
|
+ .eq(ObjectUtil.isNotNull(dto.getGradeId()), BaseClass::getGradeId, dto.getGradeId())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getBaseStudentAssessmentProjectIds()), BaseStudentAssessmentInspection::getBaseStudentAssessmentProjectId, dto.getBaseStudentAssessmentProjectIds())
|
|
|
+ .between(ObjectUtil.isNotNull(dto.getStartDate()) && ObjectUtil.isNotNull(dto.getEndDate()), BaseStudentAssessmentInspection::getCreateDate,dto.getStartDate(),dto.getEndDate())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getBaseStudentAssessmentProjectIds()), BaseStudentAssessmentInspection::getBaseStudentAssessmentProjectId, dto.getBaseStudentAssessmentProjectIds())
|
|
|
.select("c.name as class_name")
|
|
|
.select("u.name as class_teacher")
|
|
|
.select("d.name as dept_name")
|
|
|
.select("(SELECT COUNT(*) FROM base_student_assessment_student_relation WHERE base_student_assessment_inspection_id = t.id) as student_count")
|
|
|
- .selectAs(XjrUser::getName, BaseStudentAssessmentInspectionPageVo::getCreateUserName)
|
|
|
+ .select("(SELECT name FROM xjr_user WHERE id = t.assessment_user_id) as assessment_user_name")
|
|
|
.select(BaseStudentAssessmentInspection::getScore)
|
|
|
.select(BaseStudentAssessmentInspection::getSortCode)
|
|
|
.select(BaseStudentAssessmentInspection::getReason)
|
|
|
@@ -67,10 +93,11 @@ public class BaseStudentAssessmentInspectionController {
|
|
|
.selectAs(BaseStudentAssessmentProject::getName, BaseStudentAssessmentInspectionPageVo::getAssessmentProjectName)
|
|
|
.innerJoin(BaseStudentAssessmentCategory.class, BaseStudentAssessmentCategory::getId, BaseStudentAssessmentInspection::getBaseStudentAssessmentCategoryId)
|
|
|
.innerJoin(BaseStudentAssessmentProject.class, BaseStudentAssessmentProject::getId, BaseStudentAssessmentInspection::getBaseStudentAssessmentProjectId)
|
|
|
- .innerJoin(XjrUser.class, XjrUser::getId, BaseStudentAssessmentInspection::getCreateUserId)
|
|
|
+ .leftJoin(XjrUser.class, XjrUser::getId, BaseStudentAssessmentInspection::getAssessmentUserId)
|
|
|
.innerJoin("base_class c ON t.class_ids LIKE CONCAT('%', c.id, '%')")
|
|
|
.innerJoin("xjr_user u on c.teacher_id = u.id")
|
|
|
.innerJoin("xjr_department d on c.org_id = d.id")
|
|
|
+ .leftJoin(BaseStudentAssessmentClassRelation.class, BaseStudentAssessmentClassRelation::getBaseStudentAssessmentInspectionId, BaseStudentAssessmentInspection::getId)
|
|
|
);
|
|
|
|
|
|
PageOutput<BaseStudentAssessmentInspectionPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentAssessmentInspectionPageVo.class);
|
|
|
@@ -85,7 +112,24 @@ public class BaseStudentAssessmentInspectionController {
|
|
|
if (baseStudentAssessmentInspection == null) {
|
|
|
return RT.error("找不到此数据!");
|
|
|
}
|
|
|
- return RT.ok(BeanUtil.toBean(baseStudentAssessmentInspection, BaseStudentAssessmentInspectionVo.class));
|
|
|
+ BaseStudentAssessmentInspectionVo baseStudentAssessmentInspectionVo = BeanUtil.toBean(baseStudentAssessmentInspection, BaseStudentAssessmentInspectionVo.class);
|
|
|
+ //查询班级
|
|
|
+ LambdaQueryWrapper<BaseStudentAssessmentClassRelation> classQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ classQueryWrapper
|
|
|
+ .eq(BaseStudentAssessmentClassRelation::getBaseStudentAssessmentInspectionId, id)
|
|
|
+ .select(BaseStudentAssessmentClassRelation.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentAssessmentClassRelationListVo.class).contains(x.getProperty()));
|
|
|
+ List<BaseStudentAssessmentClassRelation> classList = baseStudentAssessmentClassRelationService.list(classQueryWrapper);
|
|
|
+ baseStudentAssessmentInspectionVo.setClassList(BeanUtil.copyToList(classList, BaseStudentAssessmentClassRelationListVo.class));
|
|
|
+
|
|
|
+ //查询学生
|
|
|
+ LambdaQueryWrapper<BaseStudentAssessmentStudentRelation> studentQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ studentQueryWrapper
|
|
|
+ .eq(BaseStudentAssessmentStudentRelation::getBaseStudentAssessmentInspectionId, id)
|
|
|
+ .select(BaseStudentAssessmentStudentRelation.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentAssessmentStudentRelationVo.class).contains(x.getProperty()));
|
|
|
+ List<BaseStudentAssessmentStudentRelation> studentList = baseStudentAssessmentStudentRelationService.list(studentQueryWrapper);
|
|
|
+ baseStudentAssessmentInspectionVo.setStudentList(BeanUtil.copyToList(studentList, BaseStudentAssessmentStudentRelationVo.class));
|
|
|
+
|
|
|
+ return RT.ok(baseStudentAssessmentInspectionVo);
|
|
|
}
|
|
|
|
|
|
|