| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/spareParts") |
| | | @Api(tags = "备件分类接口") |
| | | @Tag(name = "备件分类接口") |
| | | @AllArgsConstructor |
| | | public class SparePartsController { |
| | | @Autowired |
| | | private SparePartsService sparePartsService; |
| | | @GetMapping("/getTree") |
| | | @ApiOperation("备件分类-树结构") |
| | | @Operation(summary = "备件分类-树结构") |
| | | public AjaxResult getTree(){ |
| | | List<SparePartsDto> tree = sparePartsService.getTree(); |
| | | return AjaxResult.success(tree); |
| | | } |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("备件分类-分页查询") |
| | | @Operation(summary = "备件分类-分页查询") |
| | | public AjaxResult listPage(Page page, SpareParts spareParts){ |
| | | IPage<SparePartsDto> listPage = sparePartsService.listPage(page, spareParts); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | // @GetMapping("/list") |
| | | // @ApiOperation("备件分类-查询所有") |
| | | // @Operation(summary = "备件分类-查询所有") |
| | | // public AjaxResult list(){ |
| | | // return AjaxResult.success(sparePartsService.list()); |
| | | // } |
| | | @PostMapping("/add") |
| | | @ApiOperation("备件分类-添加") |
| | | @Operation(summary = "备件分类-添加") |
| | | @Log(title = "备件分类-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.save(spareParts)); |
| | | } |
| | | @PostMapping("/update") |
| | | @ApiOperation("备件分类-更新") |
| | | @Operation(summary = "备件分类-更新") |
| | | @Log(title = "备件分类-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.updateById(spareParts)); |
| | | } |
| | | @DeleteMapping("/delete/{id}") |
| | | @ApiOperation("备件分类-删除") |
| | | @Operation(summary = "备件分类-删除") |
| | | @Log(title = "备件分类-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@PathVariable Long id){ |
| | | return AjaxResult.success(sparePartsService.removeById(id)); |