|
@@ -0,0 +1,110 @@
|
|
|
+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.github.yulichang.toolkit.MPJWrappers;
|
|
|
+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.asset.entity.WfAssetManage;
|
|
|
+import com.xjrsoft.module.student.dto.AddStudentConsumeDateDto;
|
|
|
+import com.xjrsoft.module.student.dto.UpdateStudentConsumeDateDto;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+
|
|
|
+import com.xjrsoft.module.student.dto.StudentConsumeDatePageDto;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
|
|
|
+import com.xjrsoft.module.student.entity.StudentConsumeDate;
|
|
|
+import com.xjrsoft.module.student.service.IStudentConsumeDateService;
|
|
|
+import com.xjrsoft.module.student.vo.StudentConsumeDatePageVo;
|
|
|
+
|
|
|
+import com.xjrsoft.module.student.vo.StudentConsumeDateVo;
|
|
|
+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.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+* @title: 学生消费数据
|
|
|
+* @Author dzx
|
|
|
+* @Date: 2024-08-26
|
|
|
+* @Version 1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/student" + "/studentConsumeDate")
|
|
|
+@Api(value = "/student" + "/studentConsumeDate",tags = "学生消费数据代码")
|
|
|
+@AllArgsConstructor
|
|
|
+public class StudentConsumeDateController {
|
|
|
+
|
|
|
+
|
|
|
+ private final IStudentConsumeDateService studentConsumeDateService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value="学生消费数据列表(分页)")
|
|
|
+ @SaCheckPermission("studentconsumedate:detail")
|
|
|
+ public RT<PageOutput<StudentConsumeDatePageVo>> page(@Valid StudentConsumeDatePageDto dto) {
|
|
|
+
|
|
|
+ IPage<StudentConsumeDatePageVo> page = studentConsumeDateService.selectJoinListPage(ConventPage.getPage(dto), StudentConsumeDatePageVo.class,
|
|
|
+ MPJWrappers.<StudentConsumeDate>lambdaJoin()
|
|
|
+ .orderByDesc(StudentConsumeDate::getId)
|
|
|
+ .eq(ObjectUtil.isNotNull(dto.getConsumeType()), StudentConsumeDate::getConsumeType, dto.getConsumeType())
|
|
|
+ .between(ObjectUtil.isNotNull(dto.getStartDate()) && ObjectUtil.isNotNull(dto.getEndDate()), StudentConsumeDate::getConsumeTime, dto.getStartDate(), dto.getEndDate())
|
|
|
+ .select(StudentConsumeDate.class, x -> VoToColumnUtil.fieldsToColumns(StudentConsumeDatePageVo.class).contains(x.getProperty()))
|
|
|
+ .select(StudentConsumeDate::getId)
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, StudentConsumeDate::getConsumeType, ext -> ext.selectAs(DictionaryDetail::getName, StudentConsumeDatePageVo::getConsumeTypeCn))
|
|
|
+ );
|
|
|
+ PageOutput<StudentConsumeDatePageVo> pageOutput = ConventPage.getPageOutput(page, StudentConsumeDatePageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询学生消费数据信息")
|
|
|
+ @SaCheckPermission("studentconsumedate:detail")
|
|
|
+ public RT<StudentConsumeDateVo> info(@RequestParam Long id){
|
|
|
+ StudentConsumeDate studentConsumeDate = studentConsumeDateService.getById(id);
|
|
|
+ if (studentConsumeDate == null) {
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
+ }
|
|
|
+ return RT.ok(BeanUtil.toBean(studentConsumeDate, StudentConsumeDateVo.class));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation(value = "新增学生消费数据")
|
|
|
+ @SaCheckPermission("studentconsumedate:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddStudentConsumeDateDto dto){
|
|
|
+ StudentConsumeDate studentConsumeDate = BeanUtil.toBean(dto, StudentConsumeDate.class);
|
|
|
+ boolean isSuccess = studentConsumeDateService.save(studentConsumeDate);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ @ApiOperation(value = "修改学生消费数据")
|
|
|
+ @SaCheckPermission("studentconsumedate:edit")
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateStudentConsumeDateDto dto){
|
|
|
+
|
|
|
+ StudentConsumeDate studentConsumeDate = BeanUtil.toBean(dto, StudentConsumeDate.class);
|
|
|
+ return RT.ok(studentConsumeDateService.updateById(studentConsumeDate));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除学生消费数据")
|
|
|
+ @SaCheckPermission("studentconsumedate:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(studentConsumeDateService.removeBatchByIds(ids));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|