OrganizationEvaluationRuleController.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package com.ims.eval.controller;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.ims.eval.config.CustomException;
  4. import com.ims.eval.entity.OrganizationEvaluationRule;
  5. import com.ims.eval.entity.dto.request.OrganizationEvaluationRuleDTO;
  6. import com.ims.eval.entity.dto.result.R;
  7. import com.ims.eval.service.IOrganizationEvaluationRuleService;
  8. import io.swagger.annotations.ApiOperation;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import java.util.Arrays;
  12. import java.util.List;
  13. /**
  14. * <p>
  15. * 单位/部门考评配置 前端控制器
  16. * </p>
  17. *
  18. * @author wang
  19. * @since 2023-03-01
  20. */
  21. @RestController
  22. @RequestMapping("//organization-evaluation-rule")
  23. public class OrganizationEvaluationRuleController {
  24. @Autowired
  25. private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
  26. /**
  27. * @param pageNum 当前页数
  28. * @param pageSize 当前页大小
  29. * @param id 主键
  30. * @param organizationName 考评组织名称
  31. * @param organizationId 考评组织ID
  32. * @param organizationType 考评类别
  33. * @param binSection 业务版块
  34. * @param binStage 业务阶段
  35. * @param evaluationCycle 考评周期
  36. * @return
  37. */
  38. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  39. @GetMapping(value = "list")
  40. public R list(@RequestParam(value = "pageNum") Integer pageNum,
  41. @RequestParam(value = "pageSize") Integer pageSize,
  42. @RequestParam(value = "id", required = false) String id,
  43. @RequestParam(value = "organizationName", required = false) String organizationName,
  44. @RequestParam(value = "organizationId", required = false) String organizationId,
  45. @RequestParam(value = "organizationType", required = false) String organizationType,
  46. @RequestParam(value = "binSection", required = false) String binSection,
  47. @RequestParam(value = "binStage", required = false) String binStage,
  48. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle) {
  49. IPage<OrganizationEvaluationRule> list = organizationEvaluationRuleService.list2(pageNum, pageSize, id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
  50. return R.ok().data(list);
  51. }
  52. @GetMapping(value = "list2")
  53. public R list2(@RequestParam(value = "pageNum") Integer pageNum,
  54. @RequestParam(value = "pageSize") Integer pageSize,
  55. @RequestParam(value = "id", required = false) String id,
  56. @RequestParam(value = "organizationName", required = false) String organizationName,
  57. @RequestParam(value = "organizationId", required = false) String organizationId,
  58. @RequestParam(value = "organizationType", required = false) String organizationType,
  59. @RequestParam(value = "binSection", required = false) String binSection,
  60. @RequestParam(value = "binStage", required = false) String binStage,
  61. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle) {
  62. IPage<OrganizationEvaluationRule> list = organizationEvaluationRuleService.list(pageNum, pageSize, id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
  63. return R.ok().data(list);
  64. }
  65. /**
  66. * 查询所有数据
  67. *
  68. * @param id 主键
  69. * @param organizationName 考评组织名称
  70. * @param organizationId 考评组织ID
  71. * @param organizationType 考评类别
  72. * @param binSection 业务版块
  73. * @param binStage 业务阶段
  74. * @param evaluationCycle 考评周期
  75. * @return
  76. */
  77. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  78. @GetMapping(value = "listAll")
  79. public R listAll(
  80. @RequestParam(value = "id", required = false) String id,
  81. @RequestParam(value = "organizationName", required = false) String organizationName,
  82. @RequestParam(value = "organizationId", required = false) String organizationId,
  83. @RequestParam(value = "organizationType", required = false) String organizationType,
  84. @RequestParam(value = "binSection", required = false) String binSection,
  85. @RequestParam(value = "binStage", required = false) String binStage,
  86. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle) {
  87. List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listAll(id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
  88. return R.ok().data(list);
  89. }
  90. /**
  91. * 添加
  92. *
  93. * @param evaluationRule
  94. * @return
  95. */
  96. //@ImsPreAuth("eval:organizationEvaluationRule:edit")
  97. @PostMapping(value = "/save")
  98. @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
  99. public R addAll(@RequestBody OrganizationEvaluationRule evaluationRule) {
  100. try {
  101. boolean b = organizationEvaluationRuleService.saveOrUpdate(evaluationRule);
  102. if (b) {
  103. return R.ok().data(b);
  104. } else {
  105. return R.error().data("保存失败!");
  106. }
  107. } catch (CustomException e) {
  108. return R.customError(e.getMessage()).data("失败!");
  109. }
  110. }
  111. /**
  112. * 批量删除
  113. *
  114. * @param ids
  115. * @return
  116. */
  117. //@ImsPreAuth("eval:organizationEvaluationRule:remove")
  118. @PostMapping(value = "/remove/{ids}")
  119. @ApiOperation(value = "删除", notes = "删除")
  120. public R deleteAll(@PathVariable("ids") String ids) {
  121. String[] strings = ids.split(",");
  122. boolean b = organizationEvaluationRuleService.removeByIds(Arrays.asList(strings));
  123. if (b) {
  124. return R.ok().data(b);
  125. } else {
  126. return R.error().data("删除失败!");
  127. }
  128. }
  129. }