|
|
@@ -0,0 +1,193 @@
|
|
|
+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.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.base.entity.BaseSemester;
|
|
|
+import com.xjrsoft.module.base.mapper.BaseClassMapper;
|
|
|
+import com.xjrsoft.module.organization.entity.Department;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentBehaviorManageDto;
|
|
|
+import com.xjrsoft.module.student.dto.BaseStudentBehaviorManagePageDto;
|
|
|
+import com.xjrsoft.module.student.dto.UpdateBaseStudentBehaviorManageDto;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentBehaviorCategory;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentBehaviorClassRelation;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentBehaviorManage;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentBehaviorProject;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentBehaviorStudentRelation;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
+import com.xjrsoft.module.student.mapper.BaseStudentBehaviorClassRelationMapper;
|
|
|
+import com.xjrsoft.module.student.mapper.BaseStudentBehaviorStudentRelationMapper;
|
|
|
+import com.xjrsoft.module.student.service.IBaseStudentBehaviorManageService;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentBehaviorClassRelationVo;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentBehaviorManagePageVo;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentBehaviorManageVo;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentBehaviorStudentRelationVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+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;
|
|
|
+
|
|
|
+/**
|
|
|
+* @title: 学生操行分记录管理
|
|
|
+* @Author dzx
|
|
|
+* @Date: 2023-11-17
|
|
|
+* @Version 1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/student" + "/baseStudentBehaviorManage")
|
|
|
+@Api(value = "/student" + "/baseStudentBehaviorManage",tags = "学生操行分记录管理代码")
|
|
|
+@AllArgsConstructor
|
|
|
+public class BaseStudentBehaviorManageController {
|
|
|
+
|
|
|
+
|
|
|
+ private final IBaseStudentBehaviorManageService baseStudentBehaviorManageService;
|
|
|
+ private final BaseStudentBehaviorClassRelationMapper baseStudentBehaviorClassRelationMapper;
|
|
|
+ private final BaseStudentBehaviorStudentRelationMapper baseStudentBehaviorStudentRelationMapper;
|
|
|
+ private final BaseClassMapper baseClassMapper;
|
|
|
+
|
|
|
+ @GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value="学生操行分记录管理列表(分页)")
|
|
|
+ @SaCheckPermission("basestudentbehaviormanage:detail")
|
|
|
+ public RT<PageOutput<BaseStudentBehaviorManagePageVo>> page(@Valid BaseStudentBehaviorManagePageDto dto){
|
|
|
+ return RT.ok(getData(dto));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/mibliePage")
|
|
|
+ @ApiOperation(value="学生操行分记录管理列表(移动端分页)")
|
|
|
+ @SaCheckPermission("basestudentbehaviormanage:detail")
|
|
|
+ public RT<PageOutput<BaseStudentBehaviorManagePageVo>> mibliePage(@Valid BaseStudentBehaviorManagePageDto dto){
|
|
|
+
|
|
|
+ List<BaseClass> classList = baseClassMapper.selectList(
|
|
|
+ MPJWrappers.<BaseClass>lambdaJoin()
|
|
|
+ .eq(BaseClass::getTeacherId, StpUtil.getLoginIdAsLong())
|
|
|
+ .select(BaseClass.class, x -> VoToColumnUtil.fieldsToColumns(BaseClass.class).contains(x.getProperty()))
|
|
|
+ );
|
|
|
+ List<Long> classIds = new ArrayList<>();
|
|
|
+ for (BaseClass baseClass : classList) {
|
|
|
+ classIds.add(baseClass.getId());
|
|
|
+ }
|
|
|
+ dto.setClassIds(classIds);
|
|
|
+ return RT.ok(getData(dto));
|
|
|
+ }
|
|
|
+
|
|
|
+ PageOutput<BaseStudentBehaviorManagePageVo> getData(BaseStudentBehaviorManagePageDto dto){
|
|
|
+ IPage<BaseStudentBehaviorManagePageVo> page = baseStudentBehaviorManageService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentBehaviorManagePageVo.class,
|
|
|
+ MPJWrappers.<BaseStudentBehaviorManage>lambdaJoin()
|
|
|
+ .like(StrUtil.isNotEmpty(dto.getName()), BaseStudentBehaviorStudentRelation::getName, dto.getName())
|
|
|
+ .like(ObjectUtil.isNotNull(dto.getSemesterId()), BaseStudentBehaviorManage::getBaseSemesterId, dto.getSemesterId())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getBehaviorCategoryIds()), BaseStudentBehaviorManage::getBaseStudentBehaviorCategoryId, dto.getBehaviorCategoryIds())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getBehaviorProjectIds()), BaseStudentBehaviorManage::getBaseStudentBehaviorProjectId, dto.getBehaviorProjectIds())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getOrgIds()), Department::getId, dto.getOrgIds())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getGradeIds()), BaseStudentBehaviorManage::getGradeId, dto.getGradeIds())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getMajorSetIds()), BaseStudentSchoolRoll::getMajorSetId, dto.getMajorSetIds())
|
|
|
+ .in(ObjectUtil.isNotNull(dto.getClassIds()), BaseStudentBehaviorClassRelation::getClassId, dto.getClassIds())
|
|
|
+ .like(StrUtil.isNotEmpty(dto.getModifyUserName()), "t.modify_user_id = (select id from xjr_user where name like concat('%',?,'%'))", dto.getModifyUserName())
|
|
|
+ .like(StrUtil.isNotEmpty(dto.getCreateUserName()), "t.create_user_id = (select id from xjr_user where name like concat('%',?,'%'))", dto.getCreateUserName())
|
|
|
+ .eq(BaseStudentBehaviorManage::getStatus, 1)
|
|
|
+ .eq(ObjectUtil.isNotNull(dto.getIsAffect()), BaseStudentBehaviorManage::getIsAffect, dto.getIsAffect())
|
|
|
+ .select(BaseStudentBehaviorManage::getId)
|
|
|
+ .select(BaseStudentBehaviorStudentRelation::getClassName)
|
|
|
+ .select(BaseStudentBehaviorStudentRelation::getName)
|
|
|
+ .select(BaseStudentBehaviorProject::getScoreType)
|
|
|
+ .select(BaseStudentBehaviorStudentRelation::getStudentId)
|
|
|
+ .select(BaseStudentBehaviorStudentRelation::getSortCode)
|
|
|
+ .select(BaseStudentBehaviorManage::getFileId)
|
|
|
+ .select(BaseStudentBehaviorManage::getAssessmentAddress)
|
|
|
+ .select(BaseStudentBehaviorManage::getAssessmentDate)
|
|
|
+ .select(BaseStudentBehaviorManage::getScore)
|
|
|
+ .select(BaseStudentBehaviorManage::getScoreNumber)
|
|
|
+ .select(BaseStudentBehaviorManage::getTotalScore)
|
|
|
+ .select(BaseStudentBehaviorManage::getIsAffect)
|
|
|
+ .selectAs(BaseStudentBehaviorCategory::getName, BaseStudentBehaviorManagePageVo::getBehaviorCategoryName)
|
|
|
+ .selectAs(BaseStudentBehaviorProject::getName, BaseStudentBehaviorManagePageVo::getBehaviorProjectName)
|
|
|
+ .selectAs(BaseStudentBehaviorProject::getName, BaseStudentBehaviorManagePageVo::getBehaviorProjectName)
|
|
|
+ .innerJoin(BaseStudentBehaviorCategory.class, BaseStudentBehaviorCategory::getId, BaseStudentBehaviorManage::getBaseStudentBehaviorCategoryId)
|
|
|
+ .innerJoin(BaseStudentBehaviorProject.class, BaseStudentBehaviorProject::getId, BaseStudentBehaviorManage::getBaseStudentBehaviorProjectId)
|
|
|
+ .innerJoin(BaseSemester.class, BaseSemester::getId, BaseStudentBehaviorManage::getBaseSemesterId)
|
|
|
+ .innerJoin(BaseStudentBehaviorStudentRelation.class, BaseStudentBehaviorStudentRelation::getBaseStudentBehaviorManageId, BaseStudentBehaviorManage::getId)
|
|
|
+ .innerJoin(BaseStudentBehaviorClassRelation.class, BaseStudentBehaviorClassRelation::getBaseStudentBehaviorManageId, BaseStudentBehaviorManage::getId)
|
|
|
+ .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentBehaviorClassRelation::getClassId)
|
|
|
+ .innerJoin(Department.class, Department::getId, BaseClass::getOrgId)
|
|
|
+ .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, BaseStudentBehaviorStudentRelation::getUserId)
|
|
|
+ );
|
|
|
+ return ConventPage.getPageOutput(page, BaseStudentBehaviorManagePageVo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询学生操行分记录管理信息")
|
|
|
+ @SaCheckPermission("basestudentbehaviormanage:detail")
|
|
|
+ public RT<BaseStudentBehaviorManageVo> info(@RequestParam Long id){
|
|
|
+ BaseStudentBehaviorManage baseStudentBehaviorManage = baseStudentBehaviorManageService.getById(id);
|
|
|
+ if (baseStudentBehaviorManage == null) {
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
+ }
|
|
|
+ BaseStudentBehaviorManageVo behaviorManageVo = BeanUtil.toBean(baseStudentBehaviorManage, BaseStudentBehaviorManageVo.class);
|
|
|
+ //查询班级
|
|
|
+ List<BaseStudentBehaviorClassRelation> classList = baseStudentBehaviorClassRelationMapper.selectList(
|
|
|
+ MPJWrappers.<BaseStudentBehaviorClassRelation>lambdaJoin()
|
|
|
+ .eq(BaseStudentBehaviorClassRelation::getBaseStudentBehaviorManageId, id)
|
|
|
+ .selectAs(BaseClass::getName, BaseStudentBehaviorClassRelationVo::getClassName)
|
|
|
+ .select(BaseStudentBehaviorClassRelation.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentBehaviorClassRelation.class).contains(x.getProperty()))
|
|
|
+ .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentBehaviorClassRelation::getClassId)
|
|
|
+ );
|
|
|
+ behaviorManageVo.setBaseStudentBehaviorClassRelationList(BeanUtil.copyToList(classList, BaseStudentBehaviorClassRelationVo.class));
|
|
|
+ //查询学生
|
|
|
+ List<BaseStudentBehaviorStudentRelation> studentList = baseStudentBehaviorStudentRelationMapper.selectList(
|
|
|
+ MPJWrappers.<BaseStudentBehaviorStudentRelation>lambdaJoin()
|
|
|
+ .eq(BaseStudentBehaviorStudentRelation::getBaseStudentBehaviorManageId, id)
|
|
|
+ .select(BaseStudentBehaviorStudentRelation.class, x -> VoToColumnUtil.fieldsToColumns(BaseStudentBehaviorStudentRelation.class).contains(x.getProperty()))
|
|
|
+ );
|
|
|
+ behaviorManageVo.setBaseStudentBehaviorStudentRelationList(BeanUtil.copyToList(studentList, BaseStudentBehaviorStudentRelationVo.class));
|
|
|
+
|
|
|
+ return RT.ok(behaviorManageVo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation(value = "新增学生操行分记录管理")
|
|
|
+ @SaCheckPermission("basestudentbehaviormanage:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddBaseStudentBehaviorManageDto dto){
|
|
|
+ BaseStudentBehaviorManage baseStudentBehaviorManage = BeanUtil.toBean(dto, BaseStudentBehaviorManage.class);
|
|
|
+ boolean isSuccess = baseStudentBehaviorManageService.add(baseStudentBehaviorManage);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ @ApiOperation(value = "修改学生操行分记录管理")
|
|
|
+ @SaCheckPermission("basestudentbehaviormanage:edit")
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentBehaviorManageDto dto){
|
|
|
+
|
|
|
+ BaseStudentBehaviorManage baseStudentBehaviorManage = BeanUtil.toBean(dto, BaseStudentBehaviorManage.class);
|
|
|
+ return RT.ok(baseStudentBehaviorManageService.update(baseStudentBehaviorManage));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除学生操行分记录管理")
|
|
|
+ @SaCheckPermission("basestudentbehaviormanage:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(baseStudentBehaviorManageService.delete(ids));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|