|
|
@@ -3,12 +3,10 @@ package com.xjrsoft.module.student.controller;
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
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.alibaba.excel.EasyExcel;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.github.yulichang.toolkit.MPJWrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
|
import com.xjrsoft.common.model.result.R;
|
|
|
@@ -16,7 +14,6 @@ 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.entity.BaseGrade;
|
|
|
import com.xjrsoft.module.base.service.IBaseClassService;
|
|
|
@@ -24,8 +21,6 @@ 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;
|
|
|
-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;
|
|
|
@@ -68,35 +63,7 @@ public class StudentManagerController {
|
|
|
@SaCheckPermission("studentmanager:detail")
|
|
|
public R page(@Valid BaseStudentUserPageDto dto) {
|
|
|
|
|
|
- IPage<BaseStudentUserPageVo> page = studentManagerService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentUserPageVo.class,
|
|
|
- MPJWrappers.<BaseStudentUser>lambdaJoin()
|
|
|
- .like(StrUtil.isNotBlank(dto.getUserName()), BaseStudentUser::getUserName, dto.getUserName())
|
|
|
- .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()), BaseClass::getId, dto.getClassId())
|
|
|
- .in((ObjectUtil.isNotNull(dto.getTokenType()) && dto.getTokenType() == 1), BaseClass::getTeacherId, StpUtil.getLoginIdAsLong())
|
|
|
- .orderByDesc(BaseStudentUser::getId)
|
|
|
- .select(BaseStudentUser::getId)
|
|
|
- .select(BaseStudent::getStudentId)
|
|
|
- .select(BaseStudentSchoolRoll.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentUserPageVo.class).contains(x.getProperty()))
|
|
|
- .select(BaseStudentUser.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentUserPageVo.class).contains(x.getProperty()))
|
|
|
- .select(BaseStudentSchoolRoll::getStudyYear)
|
|
|
- .select("a.`name` as grade_name")
|
|
|
- .select("b.`name` as major_set_name")
|
|
|
- .selectAs(BaseClass::getName, BaseStudentUserPageVo::getClassName)
|
|
|
- .innerJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentUser::getId)
|
|
|
- .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, BaseStudentUser::getId)
|
|
|
- .leftJoin("base_grade a on a.id = t2.grade_id")
|
|
|
- .leftJoin("base_major_set b on b.id = t2.major_set_id")
|
|
|
- .leftJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
|
|
|
-// .select("c.`mobile` as guardianPhone")
|
|
|
-// .select("c.`name` as guardianName")
|
|
|
-// .leftJoin("base_student_family_member c on c.user_id = t2.user_id")
|
|
|
- );
|
|
|
- for (BaseStudentUserPageVo record : page.getRecords()) {
|
|
|
- record.setGenderCn(GenderDictionaryEnum.getValue(record.getGender()));
|
|
|
- }
|
|
|
+ IPage<BaseStudentUserPageVo> page = studentManagerService.getStudentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
|
|
|
PageOutput<BaseStudentUserPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentUserPageVo.class);
|
|
|
return R.ok(pageOutput);
|
|
|
}
|