| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | 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.domain.R; |
| | | import com.ruoyi.stock.dto.ManufacturerDto; |
| | | import com.ruoyi.stock.execl.ManufacturerExcelDto; |
| | | import com.ruoyi.stock.pojo.Manufacturer; |
| | |
| | | @PostMapping("/add") |
| | | @Log(title = "厂家-新增", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "新增厂家") |
| | | public AjaxResult add(@RequestBody Manufacturer manufacturer) { |
| | | public R add(@RequestBody Manufacturer manufacturer) { |
| | | manufacturerService.saveManufacturer(manufacturer); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/del") |
| | | @Log(title = "厂家-删除", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "删除厂家") |
| | | public AjaxResult delManufacturer(@RequestBody List<Long> ids) { |
| | | public R delManufacturer(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | manufacturerService.delManufacturer(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/{id}") |
| | | @Log(title = "厂家-详情", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "厂家详情") |
| | | public AjaxResult manufacturerDetail(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(manufacturerService.manufacturerDetail(id)); |
| | | public R manufacturerDetail(@PathVariable("id") Long id) { |
| | | return R.ok(manufacturerService.manufacturerDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | @Log(title = "厂家-修改", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "修改厂家") |
| | | public AjaxResult update(@RequestBody Manufacturer manufacturer) { |
| | | public R update(@RequestBody Manufacturer manufacturer) { |
| | | manufacturerService.manufacturerUpdate(manufacturer); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "厂家-分页查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "厂家分页查询") |
| | | public AjaxResult manufacturerListPage(Page page, ManufacturerDto manufacturerDto) { |
| | | return AjaxResult.success(manufacturerService.manufacturerListPage(page, manufacturerDto)); |
| | | public R manufacturerListPage(Page page, ManufacturerDto manufacturerDto) { |
| | | return R.ok(manufacturerService.manufacturerListPage(page, manufacturerDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/import") |
| | | @Log(title = "厂家-导入", businessType = BusinessType.IMPORT) |
| | | @Operation(summary = "导入厂家") |
| | | public AjaxResult importData(MultipartFile file) { |
| | | Boolean b = manufacturerService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导入成功"); |
| | | } |
| | | return AjaxResult.error("导入失败"); |
| | | public R importData(MultipartFile file) { |
| | | return manufacturerService.importData(file); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/getOptions") |
| | | @Log(title = "厂家-选项接口", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "获取厂家选项") |
| | | public AjaxResult getOptions() { |
| | | return AjaxResult.success(manufacturerService.list()); |
| | | public R getOptions() { |
| | | return R.ok(manufacturerService.list()); |
| | | } |
| | | } |