|
|
@@ -0,0 +1,102 @@
|
|
|
+package com.xjrsoft.module.student.controller;
|
|
|
+
|
|
|
+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.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
+import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.model.result.RT;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentScholarshipApplicantDto;
|
|
|
+import com.xjrsoft.module.student.dto.UpdateBaseStudentScholarshipApplicantDto;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+
|
|
|
+import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantPageDto;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
|
|
|
+import com.xjrsoft.module.student.service.IBaseStudentScholarshipApplicantService;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantPageVo;
|
|
|
+
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+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 baseStudentScholarshipApplicantService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value="奖学金申请列表(分页)")
|
|
|
+ @SaCheckPermission("basestudentscholarshipapplicant:detail")
|
|
|
+ public RT<PageOutput<BaseStudentScholarshipApplicantPageVo>> page(@Valid BaseStudentScholarshipApplicantPageDto dto){
|
|
|
+
|
|
|
+ LambdaQueryWrapper<BaseStudentScholarshipApplicant> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper
|
|
|
+ .orderByDesc(BaseStudentScholarshipApplicant::getId)
|
|
|
+ .select(BaseStudentScholarshipApplicant.class,x -> VoToColumnUtil.fieldsToColumns(BaseStudentScholarshipApplicantPageVo.class).contains(x.getProperty()));
|
|
|
+ IPage<BaseStudentScholarshipApplicant> page = baseStudentScholarshipApplicantService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
+ PageOutput<BaseStudentScholarshipApplicantPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentScholarshipApplicantPageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询奖学金申请信息")
|
|
|
+ @SaCheckPermission("basestudentscholarshipapplicant:detail")
|
|
|
+ public RT<BaseStudentScholarshipApplicantVo> info(@RequestParam Long id){
|
|
|
+ BaseStudentScholarshipApplicant baseStudentScholarshipApplicant = baseStudentScholarshipApplicantService.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 = baseStudentScholarshipApplicantService.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(baseStudentScholarshipApplicantService.updateById(baseStudentScholarshipApplicant));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除奖学金申请")
|
|
|
+ @SaCheckPermission("basestudentscholarshipapplicant:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(baseStudentScholarshipApplicantService.removeBatchByIds(ids));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|