BasePreventTreeController.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package com.railway.business.baseinfo.controller;
  2. import com.railway.business.baseinfo.domain.BasePreventTree;
  3. import com.railway.business.baseinfo.service.IBasePreventTreeService;
  4. import com.railway.common.core.controller.BaseController;
  5. import com.railway.common.core.domain.AjaxResult;
  6. import com.railway.common.core.page.TableDataInfo;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import java.util.List;
  10. import javax.validation.Valid;
  11. import org.springframework.validation.annotation.Validated;
  12. import org.springframework.web.bind.annotation.DeleteMapping;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.PathVariable;
  15. import org.springframework.web.bind.annotation.PostMapping;
  16. import org.springframework.web.bind.annotation.PutMapping;
  17. import org.springframework.web.bind.annotation.RequestBody;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RestController;
  20. /**
  21. * @author wuhonghao
  22. */
  23. @Api(value = "rest/baseinfo/base/prevent/tree", tags = "基础数据 - 九防台账-防树")
  24. @RestController
  25. @Validated
  26. @RequestMapping(value = "business/baseinfo/base/prevent/tree")
  27. public class BasePreventTreeController extends BaseController {
  28. private final IBasePreventTreeService basePreventTreeService;
  29. public BasePreventTreeController(IBasePreventTreeService basePreventTreeService) {
  30. this.basePreventTreeService = basePreventTreeService;
  31. }
  32. @ApiOperation(value = "新增")
  33. @PostMapping("/add")
  34. public AjaxResult add(@Validated @RequestBody BasePreventTree basePreventTree) {
  35. return toAjax(basePreventTreeService.create(basePreventTree));
  36. }
  37. @ApiOperation(value = "删除")
  38. @DeleteMapping("/{ids}")
  39. public AjaxResult delete(@PathVariable(value = "ids") String[] ids) {
  40. return toAjax(basePreventTreeService.delete(ids));
  41. }
  42. @ApiOperation(value = "更新")
  43. @PutMapping("/update")
  44. public AjaxResult update(@RequestBody @Valid BasePreventTree basePreventTree) {
  45. return toAjax(basePreventTreeService.update(basePreventTree));
  46. }
  47. @ApiOperation(value = "单个")
  48. @GetMapping(value = {"/", "/{id}"})
  49. public AjaxResult getInfo(String id) {
  50. BasePreventTree info = basePreventTreeService.getInfo(id);
  51. AjaxResult ajax = AjaxResult.success();
  52. ajax.put("info", info);
  53. return ajax;
  54. }
  55. @ApiOperation(value = "列表")
  56. @GetMapping(value = "list")
  57. public TableDataInfo getList(BasePreventTree basePreventTree) {
  58. startPage();
  59. List<BasePreventTree> list = basePreventTreeService.getList(basePreventTree);
  60. return getDataTable(list);
  61. }
  62. }