YearOperatingCoefficientController.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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.Indicator;
  5. import com.ims.eval.entity.YearGroupCoefficient;
  6. import com.ims.eval.entity.YearOperatingCoefficient;
  7. import com.ims.eval.entity.dto.request.IndicatorDictionaryDTO;
  8. import com.ims.eval.entity.dto.request.YearGroupCoefficientDTO;
  9. import com.ims.eval.entity.dto.result.R;
  10. import com.ims.eval.service.IIndicatorDictionaryService;
  11. import com.ims.eval.service.IIndicatorService;
  12. import com.ims.eval.service.IYearGroupCoefficientService;
  13. import com.ims.eval.service.IYearOperatingCoefficientService;
  14. import io.swagger.annotations.ApiOperation;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.*;
  17. import java.util.ArrayList;
  18. import java.util.Arrays;
  19. import java.util.List;
  20. /**
  21. * <p>
  22. * 年度经营业绩系数明细 前端控制器
  23. * </p>
  24. *
  25. * @author wang
  26. * @since 2023-03-17
  27. */
  28. @RestController
  29. @RequestMapping("//year-operating-coefficient")
  30. public class YearOperatingCoefficientController {
  31. @Autowired
  32. private IYearOperatingCoefficientService yearOperatingCoefficientService;
  33. /**
  34. * year
  35. * @param pageNum
  36. * @param pageSize
  37. * @param id
  38. * @param organizationName
  39. * @param organizationId
  40. * @param yearGroupCoefficientId
  41. * @param binSection
  42. * @param year
  43. * @return
  44. */
  45. //@ImsPreAuth("eval:yearOperatingCoefficient:view")
  46. @GetMapping(value = "list")
  47. public R list(@RequestParam(value = "pageNum") Integer pageNum,
  48. @RequestParam(value = "pageSize") Integer pageSize,
  49. @RequestParam(value = "id", required = false) String id,
  50. @RequestParam(value = "organizationName", required = false) String organizationName,
  51. @RequestParam(value = "organizationId", required = false) String organizationId,
  52. @RequestParam(value = "yearGroupCoefficientId", required = false) String yearGroupCoefficientId,
  53. @RequestParam(value = "binSection", required = false) String binSection,
  54. @RequestParam(value = "year", required = false) String year) {
  55. IPage<YearOperatingCoefficient> list = yearOperatingCoefficientService.list(pageNum, pageSize, id, organizationName, organizationId, yearGroupCoefficientId, binSection,year);
  56. return R.ok().data(list);
  57. }
  58. /**
  59. * 查询所有数据
  60. * @param id
  61. * @param organizationName
  62. * @param organizationId
  63. * @param yearGroupCoefficientId
  64. * @param binSection
  65. * @param year
  66. * @return
  67. */
  68. //@ImsPreAuth("eval:yearOperatingCoefficient:view")
  69. @GetMapping(value = "listAll")
  70. public R listAll(
  71. @RequestParam(value = "id", required = false) String id,
  72. @RequestParam(value = "organizationName", required = false) String organizationName,
  73. @RequestParam(value = "organizationId", required = false) String organizationId,
  74. @RequestParam(value = "yearGroupCoefficientId", required = false) String yearGroupCoefficientId,
  75. @RequestParam(value = "binSection", required = false) String binSection,
  76. @RequestParam(value = "year", required = false) String year) {
  77. List<YearOperatingCoefficient> list = yearOperatingCoefficientService.listAll(id, organizationName, organizationId, yearGroupCoefficientId, binSection,year);
  78. return R.ok().data(list);
  79. }
  80. /**
  81. * 添加
  82. *
  83. * @param yearOperatingCoefficient
  84. * @return
  85. */
  86. //@ImsPreAuth("eval:yearOperatingCoefficient:edit")
  87. @PostMapping(value = "/save")
  88. @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
  89. public R addAll(@RequestBody YearOperatingCoefficient yearOperatingCoefficient) {
  90. try {
  91. boolean b = yearOperatingCoefficientService.saveOrUpdate(yearOperatingCoefficient);
  92. if (b) {
  93. return R.ok().data(b);
  94. } else {
  95. return R.error().data("保存失败!");
  96. }
  97. } catch (CustomException e){
  98. return R.customError(e.getMessage()).data("失败!");
  99. }
  100. }
  101. /**
  102. * 批量删除
  103. *
  104. * @param ids
  105. * @return
  106. */
  107. //@ImsPreAuth("eval:yearOperatingCoefficient:remove")
  108. @PostMapping(value = "/remove/{ids}")
  109. @ApiOperation(value = "删除", notes = "删除")
  110. public R deleteAll(@PathVariable("ids") String ids) {
  111. String[] strings = ids.split(",");
  112. boolean b = yearOperatingCoefficientService.removeByIds(Arrays.asList(strings));
  113. if (b) {
  114. return R.ok().data(b);
  115. } else {
  116. return R.error().data("删除失败!");
  117. }
  118. }
  119. }