|
@@ -0,0 +1,112 @@
|
|
|
+package com.ims.eval.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.ims.common.utils.StringUtils;
|
|
|
+import com.ims.eval.config.CustomException;
|
|
|
+import com.ims.eval.entity.EvaluationDept;
|
|
|
+import com.ims.eval.entity.dto.result.R;
|
|
|
+import com.ims.eval.service.IEvaluationDeptService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 考评部门配置
|
|
|
+ *
|
|
|
+ * @author hlf
|
|
|
+ * @date 2023/7/14 16:54
|
|
|
+ * 文件说明:
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("//evaluation-dept-allocation")
|
|
|
+public class DepartmentAllocationController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IEvaluationDeptService evaluationDeptService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考评部门配置列表信息(分页)
|
|
|
+ *
|
|
|
+ * @param pageNum 当前记录起始索引
|
|
|
+ * @param pageSize 每页显示记录数
|
|
|
+ * @param deptName 部门名称
|
|
|
+ * @param chargePersonName 部门领导名称
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public R list(
|
|
|
+ @RequestParam(value = "pageNum") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize") Integer pageSize,
|
|
|
+ @RequestParam(value = "deptName", required = false) String deptName,
|
|
|
+ @RequestParam(value = "chargePersonName", required = false) String chargePersonName) {
|
|
|
+ QueryWrapper<EvaluationDept> qw = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(deptName)) {
|
|
|
+ qw.lambda().like(EvaluationDept::getDeptName, deptName);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(chargePersonName)) {
|
|
|
+ qw.lambda().like(EvaluationDept::getChargePersonName, chargePersonName);
|
|
|
+ }
|
|
|
+ Page<EvaluationDept> page = new Page<>(pageNum, pageSize);
|
|
|
+ IPage<EvaluationDept> list = evaluationDeptService.page(page, qw);
|
|
|
+ return R.ok().data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考评部门配置信息
|
|
|
+ *
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/listAll")
|
|
|
+ public R listAll() {
|
|
|
+ List<EvaluationDept> list = evaluationDeptService.list();
|
|
|
+ return R.ok().data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增/修改考评部门配置信息
|
|
|
+ *
|
|
|
+ * @param evaluationDept 考评部门配置实体
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/save")
|
|
|
+ public R addAll(@RequestBody EvaluationDept evaluationDept) {
|
|
|
+ try {
|
|
|
+ boolean b = evaluationDeptService.saveOrUpdate(evaluationDept);
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.customError("保存失败!");
|
|
|
+ }
|
|
|
+ } catch (CustomException e) {
|
|
|
+ return R.customError(e.getMessage()).data("失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除考评部门配置信息
|
|
|
+ *
|
|
|
+ * @param ids 主键s
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/removeAll/{ids}")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ try {
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = evaluationDeptService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.customError("删除失败!");
|
|
|
+ }
|
|
|
+ } catch (CustomException e) {
|
|
|
+ return R.customError(e.getMessage()).data("失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|