ProBasicRegionController.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package com.gyee.backconfig.controller;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.gyee.backconfig.config.R;
  4. import com.gyee.backconfig.model.auto.ProBasicRegion;
  5. import com.gyee.backconfig.service.auto.IProBasicRegionService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.web.bind.annotation.*;
  9. import javax.annotation.Resource;
  10. import java.util.Arrays;
  11. /**
  12. * <p>
  13. * 区域 前端控制器
  14. * </p>
  15. *
  16. * @author wang
  17. * @since 2022-10-15
  18. */
  19. @RestController
  20. @RequestMapping("//pro-basic-region")
  21. @Api(value = "区域配置" ,tags = "区域配置")
  22. public class ProBasicRegionController {
  23. @Resource
  24. private IProBasicRegionService proBasicRegionService;
  25. /**
  26. * 查询
  27. *
  28. * @param id
  29. * @param
  30. * @param name
  31. * @param aname
  32. * @param pageNum
  33. * @param pageSize
  34. * @return
  35. */
  36. @GetMapping(value = "/List")
  37. @ApiOperation(value = "区域-列表", notes = "区域-列表")
  38. public R findList(@RequestParam(value = "id", required = false) String id,
  39. @RequestParam(value = "name", required = false) String name,
  40. @RequestParam(value = "aname", required = false) String aname,
  41. @RequestParam(value = "code", required = false) String code,
  42. @RequestParam(value = "pageNum", required = true) String pageNum,
  43. @RequestParam(value = "pageSize", required = true) String pageSize) {
  44. IPage<ProBasicRegion> list = proBasicRegionService.list(id, name, aname, code, pageNum, pageSize);
  45. if (null != list) {
  46. return R.ok().data(list);
  47. } else {
  48. return R.error().data("查询失败!");
  49. }
  50. }
  51. /**
  52. * 保存
  53. *
  54. * @param proBasicRegion
  55. * @return
  56. */
  57. @PostMapping(value = "/save")
  58. @ApiOperation(value = "区域-新增or修改", notes = "区域-新增or修改")
  59. @CrossOrigin(origins = "*", maxAge = 3600)
  60. public R addAll(@RequestBody ProBasicRegion proBasicRegion) {
  61. boolean b = proBasicRegionService.saveOrUpdate(proBasicRegion);
  62. if (b) {
  63. return R.ok().data(b);
  64. } else {
  65. return R.error().data("保存失败!");
  66. }
  67. }
  68. @DeleteMapping(value = "/{ids}")
  69. @ApiOperation(value = "区域-删除", notes = "区域-删除")
  70. public R deleteAll(@PathVariable("ids") String ids) {
  71. String[] strings = ids.split(",");
  72. boolean b = proBasicRegionService.removeByIds(Arrays.asList(strings));
  73. if (b) {
  74. return R.ok().data(b);
  75. } else {
  76. return R.error().data("删除失败!");
  77. }
  78. }
  79. }