|
@@ -0,0 +1,101 @@
|
|
|
|
+package com.xjrsoft.module.student.controller;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+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.AddClassHonorsDto;
|
|
|
|
+import com.xjrsoft.module.student.dto.UpdateClassHonorsDto;
|
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+
|
|
|
|
+import com.xjrsoft.module.student.dto.ClassHonorsPageDto;
|
|
|
|
+import com.xjrsoft.module.student.entity.ClassHonors;
|
|
|
|
+import com.xjrsoft.module.student.service.IClassHonorsService;
|
|
|
|
+import com.xjrsoft.module.student.vo.ClassHonorsPageVo;
|
|
|
|
+
|
|
|
|
+import com.xjrsoft.module.student.vo.ClassHonorsVo;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+* @title: 班级荣誉
|
|
|
|
+* @Author szs
|
|
|
|
+* @Date: 2023-12-06
|
|
|
|
+* @Version 1.0
|
|
|
|
+*/
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/student" + "/classHonors")
|
|
|
|
+@Api(value = "/student" + "/classHonors",tags = "班级荣誉代码")
|
|
|
|
+@AllArgsConstructor
|
|
|
|
+public class ClassHonorsController {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private final IClassHonorsService classHonorsService;
|
|
|
|
+
|
|
|
|
+ @GetMapping(value = "/page")
|
|
|
|
+ @ApiOperation(value="班级荣誉列表(分页)")
|
|
|
|
+ @SaCheckPermission("classhonors:detail")
|
|
|
|
+ public RT<PageOutput<ClassHonorsPageVo>> page(@Valid ClassHonorsPageDto dto){
|
|
|
|
+ IPage<ClassHonorsPageVo> page = classHonorsService.getPagePC(dto);
|
|
|
|
+ PageOutput<ClassHonorsPageVo> pageOutput = ConventPage.getPageOutput(page, ClassHonorsPageVo.class);
|
|
|
|
+ return RT.ok(pageOutput);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping(value = "/info")
|
|
|
|
+ @ApiOperation(value="根据id查询班级荣誉信息")
|
|
|
|
+ @SaCheckPermission("classhonors:detail")
|
|
|
|
+ public RT<ClassHonorsVo> info(@RequestParam Long id){
|
|
|
|
+ ClassHonorsVo classHonorsVo = classHonorsService.getInfoById(id);
|
|
|
|
+ if (classHonorsVo == null) {
|
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
|
+ }
|
|
|
|
+ return RT.ok(classHonorsVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PostMapping
|
|
|
|
+ @ApiOperation(value = "新增班级荣誉")
|
|
|
|
+ @SaCheckPermission("classhonors:add")
|
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddClassHonorsDto dto){
|
|
|
|
+ ClassHonors classHonors = BeanUtil.toBean(dto, ClassHonors.class);
|
|
|
|
+ boolean isSuccess = classHonorsService.save(classHonors);
|
|
|
|
+ return RT.ok(isSuccess);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PutMapping
|
|
|
|
+ @ApiOperation(value = "修改班级荣誉")
|
|
|
|
+ @SaCheckPermission("classhonors:edit")
|
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateClassHonorsDto dto){
|
|
|
|
+
|
|
|
|
+ ClassHonors classHonors = BeanUtil.toBean(dto, ClassHonors.class);
|
|
|
|
+ return RT.ok(classHonorsService.updateById(classHonors));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @DeleteMapping
|
|
|
|
+ @ApiOperation(value = "删除班级荣誉")
|
|
|
|
+ @SaCheckPermission("classhonors:delete")
|
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
|
+ return RT.ok(classHonorsService.removeBatchByIds(ids));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ @PostMapping("/import")
|
|
|
|
+ @ApiOperation(value = "导入")
|
|
|
|
+ public RT<Boolean> importData(@RequestParam MultipartFile file) throws IOException {
|
|
|
|
+ List<ClassHonorsPageVo> savedDataList = EasyExcel.read(file.getInputStream()).head(ClassHonorsPageVo.class).sheet().doReadSync();
|
|
|
|
+ Boolean result = classHonorsService.saveBatch(BeanUtil.copyToList(savedDataList, ClassHonors.class));
|
|
|
|
+ return RT.ok(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|