OrganizationStructureController.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package com.ims.eval.controller;
  2. import com.ims.eval.entity.OrganizationStructure;
  3. import com.ims.eval.entity.dto.result.R;
  4. import com.ims.eval.service.IOrganizationStructureService;
  5. import io.swagger.annotations.ApiOperation;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.*;
  8. import javax.servlet.http.HttpServletRequest;
  9. import java.util.List;
  10. /**
  11. * <p>
  12. * 前端控制器
  13. * </p>
  14. *
  15. * @author wang
  16. * @since 2023-03-01
  17. */
  18. @RestController
  19. @RequestMapping("//organization-structure")
  20. public class OrganizationStructureController {
  21. @Autowired
  22. private HttpServletRequest request;
  23. @Autowired
  24. private IOrganizationStructureService organizationStructureService;
  25. /**
  26. * 添加
  27. *
  28. * @param evaluateRuleInfo
  29. * @return
  30. */
  31. //@ImsPreAuth("eval:dataDictionary:edit")
  32. @PostMapping(value = "/save")
  33. @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
  34. public R addAll(@RequestBody List<OrganizationStructure> evaluateRuleInfo) {
  35. boolean b = organizationStructureService.saveBatch(evaluateRuleInfo);
  36. if (b) {
  37. return R.ok().data(b);
  38. } else {
  39. return R.error().data("保存失败!");
  40. }
  41. }
  42. @GetMapping(value = "getTree")
  43. public R getTree(
  44. @RequestParam(value = "id", required = false) String id,
  45. @RequestParam(value = "num", required = false) Integer num,
  46. @RequestParam(value = "type", required = false) String type) {
  47. List<OrganizationStructure> list = organizationStructureService.getTree(id,num,type);
  48. return R.ok().data(list);
  49. }
  50. @GetMapping(value = "getList2")
  51. public R getList2(
  52. @RequestParam(value = "id", required = false) String id,
  53. @RequestParam(value = "num", required = false) Integer num,
  54. @RequestParam(value = "type", required = false) String type) {
  55. List<OrganizationStructure> list = organizationStructureService.getList2(id,num,type);
  56. return R.ok().data(list);
  57. }
  58. @GetMapping(value = "getList")
  59. public R getList(
  60. @RequestParam(value = "likeParentId", required = false) String id,
  61. @RequestParam(value = "parentId", required = false) String num,
  62. @RequestParam(value = "name", required = false) String name,
  63. @RequestParam(value = "type", required = false) String type) {
  64. List<OrganizationStructure> list = organizationStructureService.getList(id,num,name,type, request);
  65. return R.ok().data(list);
  66. }
  67. }