| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsService; |
| | |
| | | @RequestMapping("/spareParts") |
| | | @Tag(name = "备件分类接口") |
| | | @AllArgsConstructor |
| | | public class SparePartsController { |
| | | public class SparePartsController extends BaseController { |
| | | private SparePartsService sparePartsService; |
| | | @GetMapping("/getTree") |
| | | @Operation(summary = "备件分类-树结构") |
| | | public AjaxResult getTree(){ |
| | | public R<?> getTree(){ |
| | | List<SparePartsDto> tree = sparePartsService.getTree(); |
| | | return AjaxResult.success(tree); |
| | | return R.ok(tree); |
| | | } |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "备件分类-分页查询") |
| | | public AjaxResult listPage(Page page, SpareParts spareParts){ |
| | | public R<?> listPage(Page page, SpareParts spareParts){ |
| | | IPage<SparePartsDto> listPage = sparePartsService.listPage(page, spareParts); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | // @GetMapping("/list") |
| | | // @Operation(summary = "备件分类-查询所有") |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "备件分类-添加") |
| | | @Log(title = "备件分类-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.save(spareParts)); |
| | | public R<?> add(@RequestBody SpareParts spareParts){ |
| | | return R.ok(sparePartsService.save(spareParts)); |
| | | } |
| | | @PostMapping("/update") |
| | | @Operation(summary = "备件分类-更新") |
| | | @Log(title = "备件分类-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.updateById(spareParts)); |
| | | public R<?> update(@RequestBody SpareParts spareParts){ |
| | | return R.ok(sparePartsService.updateById(spareParts)); |
| | | } |
| | | @DeleteMapping("/delete/{id}") |
| | | @Operation(summary = "备件分类-删除") |
| | | @Log(title = "备件分类-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@PathVariable Long id){ |
| | | return AjaxResult.success(sparePartsService.removeById(id)); |
| | | public R<?> delete(@PathVariable Long id){ |
| | | return R.ok(sparePartsService.removeById(id)); |
| | | } |
| | | |
| | | } |