|
|
@@ -0,0 +1,107 @@
|
|
|
+package com.xjrsoft.module.banding.controller;
|
|
|
+
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+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.banding.dto.AddBandingTaskDto;
|
|
|
+import com.xjrsoft.module.banding.dto.BandingTaskPageDto;
|
|
|
+import com.xjrsoft.module.banding.dto.UpdateBandingTaskDto;
|
|
|
+import com.xjrsoft.module.banding.entity.BandingTask;
|
|
|
+import com.xjrsoft.module.banding.service.IBandingTaskService;
|
|
|
+import com.xjrsoft.module.banding.vo.BandingTaskPageVo;
|
|
|
+import com.xjrsoft.module.banding.vo.BandingTaskVo;
|
|
|
+import com.xjrsoft.module.base.entity.BaseGrade;
|
|
|
+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: 2024-07-01
|
|
|
+* @Version 1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/banding" + "/bandingTask")
|
|
|
+@Api(value = "/banding" + "/bandingTask",tags = "新生分班任务代码")
|
|
|
+@AllArgsConstructor
|
|
|
+public class BandingTaskController {
|
|
|
+
|
|
|
+
|
|
|
+ private final IBandingTaskService bandingTaskService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value="新生分班任务列表(分页)")
|
|
|
+ @SaCheckPermission("bandingtask:detail")
|
|
|
+ public RT<PageOutput<BandingTaskPageVo>> page(@Valid BandingTaskPageDto dto){
|
|
|
+
|
|
|
+ IPage<BandingTaskPageVo> page = bandingTaskService.selectJoinListPage(ConventPage.getPage(dto), BandingTaskPageVo.class,
|
|
|
+ new MPJLambdaWrapper<BandingTask>()
|
|
|
+ .select(BandingTask::getId)
|
|
|
+ .select(BandingTask.class, x -> VoToColumnUtil.fieldsToColumns(BandingTaskPageVo.class).contains(x.getProperty()))
|
|
|
+ .selectAs(DictionaryDetail::getName, BandingTaskPageVo::getEnrollTypeCn)
|
|
|
+ .selectAs(BaseGrade::getName, BandingTaskPageVo::getGradeName)
|
|
|
+ .leftJoin(BaseGrade.class, BaseGrade::getId, BandingTask::getGradeId)
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BandingTask::getEnrollType)
|
|
|
+ );
|
|
|
+ PageOutput<BandingTaskPageVo> pageOutput = ConventPage.getPageOutput(page, BandingTaskPageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询新生分班任务信息")
|
|
|
+ @SaCheckPermission("bandingtask:detail")
|
|
|
+ public RT<BandingTaskVo> info(@RequestParam Long id){
|
|
|
+ BandingTask bandingTask = bandingTaskService.getById(id);
|
|
|
+ if (bandingTask == null) {
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
+ }
|
|
|
+ return RT.ok(BeanUtil.toBean(bandingTask, BandingTaskVo.class));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation(value = "新增新生分班任务")
|
|
|
+ @SaCheckPermission("bandingtask:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddBandingTaskDto dto){
|
|
|
+ BandingTask bandingTask = BeanUtil.toBean(dto, BandingTask.class);
|
|
|
+ boolean isSuccess = bandingTaskService.add(bandingTask);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ @ApiOperation(value = "修改新生分班任务")
|
|
|
+ @SaCheckPermission("bandingtask:edit")
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateBandingTaskDto dto){
|
|
|
+
|
|
|
+ BandingTask bandingTask = BeanUtil.toBean(dto, BandingTask.class);
|
|
|
+ return RT.ok(bandingTaskService.update(bandingTask));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除新生分班任务")
|
|
|
+ @SaCheckPermission("bandingtask:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(bandingTaskService.delete(ids));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|