| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- 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.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.github.yulichang.toolkit.MPJWrappers;
- 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.base.entity.BaseSemester;
- import com.xjrsoft.module.organization.entity.User;
- import com.xjrsoft.module.student.dto.AddBaseStudentScholarshipApplicantDto;
- import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
- import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantPageDto;
- import com.xjrsoft.module.student.dto.UpdateBaseStudentScholarshipApplicantDto;
- import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
- import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
- import com.xjrsoft.module.student.service.IBaseStudentScholarshipApplicantService;
- import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo;
- import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantPageVo;
- import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantVo;
- import com.xjrsoft.module.student.vo.ScholarshipApplicantOptionVo;
- import com.xjrsoft.module.system.entity.DictionaryDetail;
- 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.List;
- /**
- * @title: 奖学金申请
- * @Author dzx
- * @Date: 2023-11-23
- * @Version 1.0
- */
- @RestController
- @RequestMapping("/student" + "/baseStudentScholarshipApplicant")
- @Api(value = "/student" + "/baseStudentScholarshipApplicant",tags = "奖学金申请代码")
- @AllArgsConstructor
- public class BaseStudentScholarshipApplicantController {
- private final IBaseStudentScholarshipApplicantService applicantService;
- @GetMapping(value = "/page")
- @ApiOperation(value="奖学金申请列表(分页)")
- @SaCheckPermission("basestudentscholarshipapplicant:detail")
- public RT<PageOutput<BaseStudentScholarshipApplicantPageVo>> page(@Valid BaseStudentScholarshipApplicantPageDto dto){
- IPage<BaseStudentScholarshipApplicantPageVo> page = applicantService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentScholarshipApplicantPageVo.class,
- MPJWrappers.<BaseStudentScholarshipApplicant>lambdaJoin()
- .like(StrUtil.isNotEmpty(dto.getName()), BaseStudentScholarshipApplicant::getName, dto.getName())
- .eq(ObjectUtil.isNotNull(dto.getSemesterId()), BaseStudentScholarshipCategory::getBaseSemesterId, dto.getSemesterId())
- .eq(ObjectUtil.isNotNull(dto.getReleaseStatus()), BaseStudentScholarshipApplicant::getReleaseStatus, dto.getReleaseStatus())
- .eq(BaseStudentScholarshipApplicant::getStatus, 1)
- .between(ObjectUtil.isNotNull(dto.getStartDate()) && ObjectUtil.isNotNull(dto.getEndDate()), BaseStudentScholarshipApplicant::getAwardDate,dto.getStartDate(),dto.getEndDate())
- .eq(BaseStudentScholarshipApplicant::getBaseStudentScholarshipCategoryId,dto.getBaseStudentScholarshipCategoryId())
- .orderByAsc(BaseStudentScholarshipApplicant::getSortCode)
- .selectAs(BaseStudentScholarshipApplicant::getId, BaseStudentScholarshipApplicantPageVo::getId)
- .select(" t4.name as bank_type_cn")
- .selectAs(BaseSemester::getName, BaseStudentScholarshipApplicantPageVo::getSemesterName)
- .select(" t5.name as category_cn")
- .select(BaseStudentScholarshipApplicant.class,x -> VoToColumnUtil.fieldsToColumns(BaseStudentScholarshipApplicantPageVo.class).contains(x.getProperty()))
- .innerJoin(BaseStudentScholarshipCategory.class, BaseStudentScholarshipCategory::getId, BaseStudentScholarshipApplicant::getBaseStudentScholarshipCategoryId)
- .leftJoin(BaseSemester.class, BaseSemester::getId, BaseStudentScholarshipApplicant::getBaseSemesterId)
- .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BaseStudentScholarshipApplicant::getBankType)
- .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BaseStudentScholarshipCategory::getCategory)
- );
- PageOutput<BaseStudentScholarshipApplicantPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentScholarshipApplicantPageVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/scholarship-page")
- @ApiOperation(value="奖学金名称表(分页)")
- @SaCheckPermission("basestudentscholarshipapplicant:detail")
- public RT<PageOutput<BaseStudentScholarshipApplicantCategoryPageVo>> scholarshiPage(@Valid BaseStudentScholarshipApplicantCategoryPageDto dto){
- IPage<BaseStudentScholarshipApplicantCategoryPageVo> page = applicantService.getScholarshiPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
- PageOutput<BaseStudentScholarshipApplicantCategoryPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentScholarshipApplicantCategoryPageVo.class);
- return RT.ok(pageOutput);
- }
- @GetMapping(value = "/info")
- @ApiOperation(value="根据id查询奖学金申请信息")
- @SaCheckPermission("basestudentscholarshipapplicant:detail")
- public RT<BaseStudentScholarshipApplicantVo> info(@RequestParam Long id){
- BaseStudentScholarshipApplicant baseStudentScholarshipApplicant = applicantService.getById(id);
- if (baseStudentScholarshipApplicant == null) {
- return RT.error("找不到此数据!");
- }
- return RT.ok(BeanUtil.toBean(baseStudentScholarshipApplicant, BaseStudentScholarshipApplicantVo.class));
- }
- @PostMapping
- @ApiOperation(value = "新增奖学金申请")
- @SaCheckPermission("basestudentscholarshipapplicant:add")
- public RT<Boolean> add(@Valid @RequestBody AddBaseStudentScholarshipApplicantDto dto){
- BaseStudentScholarshipApplicant baseStudentScholarshipApplicant = BeanUtil.toBean(dto, BaseStudentScholarshipApplicant.class);
- boolean isSuccess = applicantService.save(baseStudentScholarshipApplicant);
- return RT.ok(isSuccess);
- }
- @PutMapping
- @ApiOperation(value = "修改奖学金申请")
- @SaCheckPermission("basestudentscholarshipapplicant:edit")
- public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentScholarshipApplicantDto dto){
- BaseStudentScholarshipApplicant baseStudentScholarshipApplicant = BeanUtil.toBean(dto, BaseStudentScholarshipApplicant.class);
- return RT.ok(applicantService.updateById(baseStudentScholarshipApplicant));
- }
- @DeleteMapping
- @ApiOperation(value = "删除奖学金申请")
- @SaCheckPermission("basestudentscholarshipapplicant:delete")
- public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
- return RT.ok(applicantService.removeBatchByIds(ids));
- }
- @GetMapping(value = "/option-select")
- @ApiOperation(value="申请人下拉列表")
- @SaCheckPermission("basestudentscholarshipapplicant:detail")
- public RT<List<ScholarshipApplicantOptionVo>> optionSelect(@Valid BaseStudentScholarshipApplicantPageDto dto){
- List<BaseStudentScholarshipApplicant> applicantList = applicantService.list(
- new MPJLambdaWrapper<BaseStudentScholarshipApplicant>()
- .select(BaseStudentScholarshipApplicant::getId)
- .selectAs(User::getName, BaseStudentScholarshipApplicant::getName)
- .select(BaseStudentScholarshipApplicant.class,x -> VoToColumnUtil.fieldsToColumns(BaseStudentScholarshipApplicantPageVo.class).contains(x.getProperty()))
- .leftJoin(User.class, User::getId, BaseStudentScholarshipApplicant::getApplicantUserId)
- .eq(ObjectUtil.isNotNull(dto.getBaseStudentScholarshipCategoryId()),BaseStudentScholarshipApplicant::getBaseStudentScholarshipCategoryId, dto.getBaseStudentScholarshipCategoryId())
- .eq(ObjectUtil.isNotNull(dto.getSemesterId()), BaseStudentScholarshipApplicant::getBaseSemesterId, dto.getSemesterId())
- .eq(BaseStudentScholarshipApplicant::getStatus, 1)
- .ne(BaseStudentScholarshipApplicant::getReviewStatus, 1)
- );
- List<ScholarshipApplicantOptionVo> voList = BeanUtil.copyToList(applicantList, ScholarshipApplicantOptionVo.class);
- return RT.ok(voList);
- }
- }
|