package com.ozs.web.controller.pm; import java.util.List; import com.ozs.pm.doman.PmDemand; import com.ozs.pm.doman.vo.requestVo.PmRequestVo; import com.ozs.pm.doman.vo.responseVo.PmDemandResponseVo; import com.ozs.pm.service.IPmDemandService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ozs.common.annotation.Log; import com.ozs.common.core.controller.BaseController; import com.ozs.common.core.domain.AjaxResult; import com.ozs.common.enums.BusinessType; import com.ozs.common.core.page.TableDataInfo; /** * 采购需求Controller * * @author ruoyi * @date 2023-01-16 */ @RestController @RequestMapping("/system/demand") public class PmDemandController extends BaseController { @Autowired private IPmDemandService pmDemandService; /** * 查询采购需求列表 */ @PreAuthorize("@ss.hasPermi('system:demand:list')") @GetMapping("/list") public TableDataInfo list(@RequestBody PmRequestVo pmDemand) { startPage(); List list = pmDemandService.selectPmDemandList(pmDemand); return getDataTable(list); } /** * 获取采购需求详细信息 */ @PreAuthorize("@ss.hasPermi('system:demand:query')") @GetMapping(value = "/{demandId}") public AjaxResult getInfo(@PathVariable("demandId") Long demandId) { return success(pmDemandService.selectPmDemandByDemandId(demandId)); } /** * 新增采购需求 */ @PreAuthorize("@ss.hasPermi('system:demand:add')") @Log(title = "采购需求", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody PmDemand pmDemand) { return toAjax(pmDemandService.insertPmDemand(pmDemand)); } /** * 修改采购需求 */ @PreAuthorize("@ss.hasPermi('system:demand:edit')") @Log(title = "采购需求", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody PmDemand pmDemand) { return toAjax(pmDemandService.updatePmDemand(pmDemand)); } }