OrganizationEvaluationRuleController.java 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. import java.util.Map;
  14. /**
  15. * <p>
  16. * 单位/部门考评配置 前端控制器
  17. * </p>
  18. *
  19. * @author wang
  20. * @since 2023-03-01
  21. */
  22. @RestController
  23. @RequestMapping("//organization-evaluation-rule")
  24. public class OrganizationEvaluationRuleController {
  25. @Autowired
  26. private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
  27. /**
  28. * @param pageNum 当前页数
  29. * @param pageSize 当前页大小
  30. * @param id 主键
  31. * @param organizationName 考评组织名称
  32. * @param organizationId 考评组织ID
  33. * @param organizationType 考评类别
  34. * @param binSection 业务版块
  35. * @param binStage 业务阶段
  36. * @param evaluationCycle 考评周期
  37. * @return
  38. */
  39. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  40. @GetMapping(value = "list")
  41. public R list(@RequestParam(value = "pageNum") Integer pageNum,
  42. @RequestParam(value = "pageSize") Integer pageSize,
  43. @RequestParam(value = "id", required = false) String id,
  44. @RequestParam(value = "organizationName", required = false) String organizationName,
  45. @RequestParam(value = "organizationId", required = false) String organizationId,
  46. @RequestParam(value = "organizationType", required = false) String organizationType,
  47. @RequestParam(value = "binSection", required = false) String binSection,
  48. @RequestParam(value = "binStage", required = false) String binStage,
  49. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle) {
  50. IPage<OrganizationEvaluationRule> list = organizationEvaluationRuleService.list2(pageNum, pageSize, id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
  51. return R.ok().data(list);
  52. }
  53. @GetMapping(value = "list2")
  54. public R list2(@RequestParam(value = "pageNum") Integer pageNum,
  55. @RequestParam(value = "pageSize") Integer pageSize,
  56. @RequestParam(value = "id", required = false) String id,
  57. @RequestParam(value = "organizationName", required = false) String organizationName,
  58. @RequestParam(value = "organizationId", required = false) String organizationId,
  59. @RequestParam(value = "organizationType", required = false) String organizationType,
  60. @RequestParam(value = "binSection", required = false) String binSection,
  61. @RequestParam(value = "binStage", required = false) String binStage,
  62. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle) {
  63. IPage<OrganizationEvaluationRule> list = organizationEvaluationRuleService.list(pageNum, pageSize, id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
  64. return R.ok().data(list);
  65. }
  66. /**
  67. * 查询所有数据
  68. *
  69. * @param id 主键
  70. * @param organizationName 考评组织名称
  71. * @param organizationId 考评组织ID
  72. * @param organizationType 考评类别
  73. * @param binSection 业务版块
  74. * @param binStage 业务阶段
  75. * @param evaluationCycle 考评周期
  76. * @return
  77. */
  78. //@ImsPreAuth("eval:organizationEvaluationRule:view")
  79. @GetMapping(value = "listAll")
  80. public R listAll(
  81. @RequestParam(value = "id", required = false) String id,
  82. @RequestParam(value = "organizationName", required = false) String organizationName,
  83. @RequestParam(value = "organizationId", required = false) String organizationId,
  84. @RequestParam(value = "organizationType", required = false) String organizationType,
  85. @RequestParam(value = "binSection", required = false) String binSection,
  86. @RequestParam(value = "binStage", required = false) String binStage,
  87. @RequestParam(value = "evaluationCycle", required = false) String evaluationCycle) {
  88. List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listAll(id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
  89. return R.ok().data(list);
  90. }
  91. /**
  92. * 添加
  93. *
  94. * @param evaluationRule
  95. * @return
  96. */
  97. //@ImsPreAuth("eval:organizationEvaluationRule:edit")
  98. @PostMapping(value = "/save")
  99. @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
  100. public R addAll(@RequestBody OrganizationEvaluationRule evaluationRule) {
  101. try {
  102. boolean b = organizationEvaluationRuleService.saveOrUpdate(evaluationRule);
  103. if (b) {
  104. return R.ok().data(b);
  105. } else {
  106. return R.error().data("保存失败!");
  107. }
  108. } catch (CustomException e) {
  109. return R.customError(e.getMessage()).data("失败!");
  110. }
  111. }
  112. /**
  113. * 批量删除
  114. *
  115. * @param ids
  116. * @return
  117. */
  118. //@ImsPreAuth("eval:organizationEvaluationRule:remove")
  119. @PostMapping(value = "/remove/{ids}")
  120. @ApiOperation(value = "删除", notes = "删除")
  121. public R deleteAll(@PathVariable("ids") String ids) {
  122. String[] strings = ids.split(",");
  123. boolean b = organizationEvaluationRuleService.removeByIds(Arrays.asList(strings));
  124. if (b) {
  125. return R.ok().data(b);
  126. } else {
  127. return R.error().data("删除失败!");
  128. }
  129. }
  130. /**
  131. * 更具目标责任书获取对应的组织考评股则id
  132. * @param id
  133. * @param type (目标责任书:mb;考评记录:kp)
  134. * @return
  135. */
  136. @GetMapping(value = "getOrganizationRule")
  137. public R getOrganizationRule(
  138. @RequestParam(value = "id", required = false) String id,
  139. @RequestParam(value = "type", required = true) String type) {
  140. List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.getOrganizationRuleId(id,type);
  141. return R.ok().data(list);
  142. }
  143. }