| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- package com.xjrsoft.module.textbook.controller;
- import cn.dev33.satoken.annotation.SaCheckPermission;
- import cn.dev33.satoken.stp.StpUtil;
- import cn.hutool.core.bean.BeanUtil;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.github.yulichang.wrapper.MPJLambdaWrapper;
- 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.textbook.dto.*;
- import com.xjrsoft.module.textbook.entity.TextbookStudentClaim;
- import com.xjrsoft.module.textbook.service.ITextbookStudentClaimService;
- import com.xjrsoft.module.textbook.vo.*;
- 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.Date;
- import java.util.List;
- /**
- * @title: 学生教材认领记录
- * @Author szs
- * @Date: 2023-12-26
- * @Version 1.0
- */
- @RestController
- @RequestMapping("/textbook" + "/textbookStudentClaim")
- @Api(value = "/textbook" + "/textbookStudentClaim",tags = "学生教材认领记录代码")
- @AllArgsConstructor
- public class TextbookStudentClaimController {
- private final ITextbookStudentClaimService textbookStudentClaimService;
- @GetMapping(value = "/head-tea-look-class-book-semester")
- @ApiOperation(value="班主任查看班级教材学期页面")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<List<HeadTeaLookClassBookSemesterVo>> headTeaLookClassBookSemester(){
- return RT.ok(textbookStudentClaimService.headTeaLookClassBookSemester());
- }
- @GetMapping(value = "/head-tea-look-class-book")
- @ApiOperation(value="班主任查看班级教材页面")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<HeadTeaLookClassBookVo> headTeaLookClassBook(@Valid HeadTeaLookClassBookDto dto){
- return RT.ok(textbookStudentClaimService.headTeaLookClassBook(dto));
- }
- @GetMapping(value = "/page")
- @ApiOperation(value="学生确认教材领取记录列表(分页)")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<PageOutput<TextbookStudentClaimPageVo>> page(@Valid TextbookStudentClaimPageDto dto){
- LambdaQueryWrapper<TextbookStudentClaim> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper
- .orderByDesc(TextbookStudentClaim::getId)
- .select(TextbookStudentClaim.class,x -> VoToColumnUtil.fieldsToColumns(TextbookStudentClaimPageVo.class).contains(x.getProperty()))
- .eq(dto.getStudentUserId() != null, TextbookStudentClaim::getStudentUserId, dto.getStudentUserId())
- .eq(TextbookStudentClaim::getIsClaim, 1)
- ;
- IPage<TextbookStudentClaim> page = textbookStudentClaimService.page(ConventPage.getPage(dto), queryWrapper);
- PageOutput<TextbookStudentClaimPageVo> pageOutput = ConventPage.getPageOutput(page, TextbookStudentClaimPageVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/student-confirm-list")
- @ApiOperation(value="学生确定教材领取页面")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<TextbookClaimStudentConfirmVo> studentConfirmList(@Valid TextbookClaimStudentConfirmDto dto){
- TextbookClaimStudentConfirmVo textbookClaimStudentConfirmVo = textbookStudentClaimService.getStudentConfirmList(dto);
- return RT.ok(textbookClaimStudentConfirmVo);
- }
- @GetMapping(value = "/student-semester-list")
- @ApiOperation(value="学生确定教材领取学期页面")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<List<TextbookStudentSemesterVo>> studentSemesterList(){
- List<TextbookStudentSemesterVo> textbookStudentSemesterVoList = textbookStudentClaimService.getStudentSemesterList();
- return RT.ok(textbookStudentSemesterVoList);
- }
- @GetMapping(value = "/teacher-check-byClass-list")
- @ApiOperation(value="班主任确认教材领取按班级查看页面")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<PageOutput<TeacherCheckByclassVo>> teacherCheckByClassList(@Valid TeacherCheckByclassDto dto){
- IPage<TeacherCheckByclassVo> page = textbookStudentClaimService.getTeacherCheckByclassList(dto);
- PageOutput<TeacherCheckByclassVo> pageOutput = ConventPage.getPageOutput(page, TeacherCheckByclassVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/teacher-check-byStu-list")
- @ApiOperation(value="班主任确认教材领取按学生查看页面")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<PageOutput<TeacherCheckByStuVo>> teacherCheckByStuList(@Valid TeacherCheckByStuDto dto){
- IPage<TeacherCheckByStuVo> page = textbookStudentClaimService.getTeacherCheckByStuList(dto);
- PageOutput<TeacherCheckByStuVo> pageOutput = ConventPage.getPageOutput(page, TeacherCheckByStuVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/teacher-check-stu-claim-list")
- @ApiOperation(value="教师查看一本教材的学生领取情况页面")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<List<TeacherCheckStuClaimVo>> teacherCheckStuClaimList(@Valid TeacherCheckStuClaimDto dto){
- List<TeacherCheckStuClaimVo> teacherCheckStuClaimList = textbookStudentClaimService.getTeacherCheckStuClaimList(dto);
- return RT.ok(teacherCheckStuClaimList);
- }
- @GetMapping(value = "/teacher-get-stu-noClaim-list")
- @ApiOperation(value="班主任获取班上某个学生没有认领的教材记录")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<List<TextbookClaimVO>> teacherGetStuNoClaimList(@RequestParam Long studentUserId){
- List<TextbookClaimVO> textbookClaimVOList = textbookStudentClaimService.getTeacherGetStuNoClaimList(studentUserId);
- return RT.ok(textbookClaimVOList);
- }
- @PutMapping("/confirm")
- @ApiOperation(value = "学生自己确认已经领取")
- @SaCheckPermission("textbookstudentclaim:edit")
- public RT<Boolean> confirm(@Valid @RequestBody List<Long> textbookStudentClaimIds){
- return RT.ok(textbookStudentClaimService.updateByIds(textbookStudentClaimIds));
- }
- @PutMapping("/teacher-confirm")
- @ApiOperation(value = "教师帮助学生确认已经领取")
- @SaCheckPermission("textbookstudentclaim:edit")
- public RT<Boolean> teacherConfirm(@Valid @RequestBody List<TeacherConfirmDto> teacherConfirmDtoList){
- return RT.ok( textbookStudentClaimService.teacherConfirm(teacherConfirmDtoList));
- }
- @GetMapping(value = "/teacher-confirm-batch-textbook-list")
- @ApiOperation(value="教师根据教材帮助学生批量确认已经领取教材列表")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<List<TeacherConfirmBatchTextbookListVo>> teacherConfirmBatchTextbookList(@Valid TeacherConfirmBatchTextbookListDto dto){
- return RT.ok(textbookStudentClaimService.teacherConfirmBatchTextbookList(dto));
- }
- @PutMapping("/teacher-confirm-batch-by-textbook")
- @ApiOperation(value = "教师根据教材帮助学生批量确认已经领取")
- @SaCheckPermission("textbookstudentclaim:edit")
- public RT<Boolean> teacherConfirmBatchBytTextbook(@Valid @RequestBody TeacherConfirmBatchByTextbookDto dto){
- return RT.ok(textbookStudentClaimService.teacherConfirmBatchBytTextbook(dto));
- }
- @GetMapping(value = "/info")
- @ApiOperation(value="根据id查询学生教材认领记录信息")
- @SaCheckPermission("textbookstudentclaim:detail")
- public RT<TextbookStudentClaimVo> info(@RequestParam Long id){
- TextbookStudentClaim textbookStudentClaim = textbookStudentClaimService.getById(id);
- if (textbookStudentClaim == null) {
- return RT.error("找不到此数据!");
- }
- return RT.ok(BeanUtil.toBean(textbookStudentClaim, TextbookStudentClaimVo.class));
- }
- @PostMapping
- @ApiOperation(value = "新增学生教材认领记录")
- @SaCheckPermission("textbookstudentclaim:add")
- public RT<Boolean> add(@Valid @RequestBody AddTextbookStudentClaimDto dto){
- TextbookStudentClaim textbookStudentClaim = BeanUtil.toBean(dto, TextbookStudentClaim.class);
- boolean isSuccess = textbookStudentClaimService.save(textbookStudentClaim);
- return RT.ok(isSuccess);
- }
- @PutMapping
- @ApiOperation(value = "修改学生教材认领记录")
- @SaCheckPermission("textbookstudentclaim:edit")
- public RT<Boolean> update(@Valid @RequestBody UpdateTextbookStudentClaimDto dto){
- TextbookStudentClaim textbookStudentClaim = BeanUtil.toBean(dto, TextbookStudentClaim.class);
- return RT.ok(textbookStudentClaimService.updateById(textbookStudentClaim));
- }
- @DeleteMapping
- @ApiOperation(value = "删除学生教材认领记录")
- @SaCheckPermission("textbookstudentclaim:delete")
- public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
- return RT.ok(textbookStudentClaimService.removeBatchByIds(ids));
- }
- }
|