|
|
@@ -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.AddWfCadreCandidateDto;
|
|
|
+import com.xjrsoft.module.student.dto.UpdateWfCadreCandidateDto;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+
|
|
|
+import com.xjrsoft.module.student.dto.WfCadreCandidatePageDto;
|
|
|
+import com.xjrsoft.module.student.entity.WfCadreCandidate;
|
|
|
+import com.xjrsoft.module.student.service.IWfCadreCandidateService;
|
|
|
+import com.xjrsoft.module.student.vo.WfCadreCandidatePageVo;
|
|
|
+
|
|
|
+import com.xjrsoft.module.student.vo.WfCadreCandidateVo;
|
|
|
+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 szs
|
|
|
+* @Date: 2023-12-20
|
|
|
+* @Version 1.0
|
|
|
+*/
|
|
|
+@RestController
|
|
|
+@RequestMapping("/student" + "/wfCadreCandidate")
|
|
|
+@Api(value = "/student" + "/wfCadreCandidate",tags = "干部候选人代码")
|
|
|
+@AllArgsConstructor
|
|
|
+public class WfCadreCandidateController {
|
|
|
+
|
|
|
+
|
|
|
+ private final IWfCadreCandidateService wfCadreCandidateService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value="干部候选人列表(分页)")
|
|
|
+ @SaCheckPermission("wfcadrecandidate:detail")
|
|
|
+ public RT<PageOutput<WfCadreCandidatePageVo>> page(@Valid WfCadreCandidatePageDto dto){
|
|
|
+
|
|
|
+ LambdaQueryWrapper<WfCadreCandidate> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper
|
|
|
+ .orderByDesc(WfCadreCandidate::getId)
|
|
|
+ .select(WfCadreCandidate.class,x -> VoToColumnUtil.fieldsToColumns(WfCadreCandidatePageVo.class).contains(x.getProperty()));
|
|
|
+ IPage<WfCadreCandidate> page = wfCadreCandidateService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
+ PageOutput<WfCadreCandidatePageVo> pageOutput = ConventPage.getPageOutput(page, WfCadreCandidatePageVo.class);
|
|
|
+ return RT.ok(pageOutput);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/info")
|
|
|
+ @ApiOperation(value="根据id查询干部候选人信息")
|
|
|
+ @SaCheckPermission("wfcadrecandidate:detail")
|
|
|
+ public RT<WfCadreCandidateVo> info(@RequestParam Long id){
|
|
|
+ WfCadreCandidate wfCadreCandidate = wfCadreCandidateService.getById(id);
|
|
|
+ if (wfCadreCandidate == null) {
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
+ }
|
|
|
+ return RT.ok(BeanUtil.toBean(wfCadreCandidate, WfCadreCandidateVo.class));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation(value = "新增干部候选人")
|
|
|
+ @SaCheckPermission("wfcadrecandidate:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddWfCadreCandidateDto dto){
|
|
|
+ WfCadreCandidate wfCadreCandidate = BeanUtil.toBean(dto, WfCadreCandidate.class);
|
|
|
+ boolean isSuccess = wfCadreCandidateService.save(wfCadreCandidate);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping
|
|
|
+ @ApiOperation(value = "修改干部候选人")
|
|
|
+ @SaCheckPermission("wfcadrecandidate:edit")
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateWfCadreCandidateDto dto){
|
|
|
+
|
|
|
+ WfCadreCandidate wfCadreCandidate = BeanUtil.toBean(dto, WfCadreCandidate.class);
|
|
|
+ return RT.ok(wfCadreCandidateService.updateById(wfCadreCandidate));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping
|
|
|
+ @ApiOperation(value = "删除干部候选人")
|
|
|
+ @SaCheckPermission("wfcadrecandidate:delete")
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ return RT.ok(wfCadreCandidateService.removeBatchByIds(ids));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|