PmDemandController.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package com.ozs.web.controller.pm;
  2. import java.util.List;
  3. import com.ozs.pm.doman.PmDemand;
  4. import com.ozs.pm.doman.vo.requestVo.PmRequestVo;
  5. import com.ozs.pm.doman.vo.responseVo.PmDemandResponseVo;
  6. import com.ozs.pm.service.IPmDemandService;
  7. import org.springframework.security.access.prepost.PreAuthorize;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.PutMapping;
  12. import org.springframework.web.bind.annotation.PathVariable;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. import com.ozs.common.annotation.Log;
  17. import com.ozs.common.core.controller.BaseController;
  18. import com.ozs.common.core.domain.AjaxResult;
  19. import com.ozs.common.enums.BusinessType;
  20. import com.ozs.common.core.page.TableDataInfo;
  21. /**
  22. * 采购需求Controller
  23. *
  24. * @author ruoyi
  25. * @date 2023-01-16
  26. */
  27. @RestController
  28. @RequestMapping("/system/demand")
  29. public class PmDemandController extends BaseController
  30. {
  31. @Autowired
  32. private IPmDemandService pmDemandService;
  33. /**
  34. * 查询采购需求列表
  35. */
  36. @PreAuthorize("@ss.hasPermi('system:demand:list')")
  37. @GetMapping("/list")
  38. public TableDataInfo list(@RequestBody PmRequestVo pmDemand)
  39. {
  40. startPage();
  41. List<PmDemandResponseVo> list = pmDemandService.selectPmDemandList(pmDemand);
  42. return getDataTable(list);
  43. }
  44. /**
  45. * 获取采购需求详细信息
  46. */
  47. @PreAuthorize("@ss.hasPermi('system:demand:query')")
  48. @GetMapping(value = "/{demandId}")
  49. public AjaxResult getInfo(@PathVariable("demandId") Long demandId)
  50. {
  51. return success(pmDemandService.selectPmDemandByDemandId(demandId));
  52. }
  53. /**
  54. * 新增采购需求
  55. */
  56. @PreAuthorize("@ss.hasPermi('system:demand:add')")
  57. @Log(title = "采购需求", businessType = BusinessType.INSERT)
  58. @PostMapping
  59. public AjaxResult add(@RequestBody PmDemand pmDemand)
  60. {
  61. return toAjax(pmDemandService.insertPmDemand(pmDemand));
  62. }
  63. /**
  64. * 修改采购需求
  65. */
  66. @PreAuthorize("@ss.hasPermi('system:demand:edit')")
  67. @Log(title = "采购需求", businessType = BusinessType.UPDATE)
  68. @PutMapping
  69. public AjaxResult edit(@RequestBody PmDemand pmDemand)
  70. {
  71. return toAjax(pmDemandService.updatePmDemand(pmDemand));
  72. }
  73. }