| | |
| | | package com.ruoyi.warehouse.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import com.ruoyi.warehouse.pojo.Warehouse; |
| | | import com.ruoyi.warehouse.service.WarehouseGoodsShelvesService; |
| | | import com.ruoyi.warehouse.service.WarehouseService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Api(tags = "仓库") |
| | | @Tag(name = "仓库") |
| | | @RequestMapping("/warehouse") |
| | | @AllArgsConstructor |
| | | public class WarehouseController extends BaseController { |
| | | @Autowired |
| | | private WarehouseService warehouseService; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("仓库-查询") |
| | | @Log(title = "仓库-查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage( Warehouse warehouse) { |
| | | return AjaxResult.success(warehouseService.listPage( warehouse)); |
| | | @GetMapping("/tree") |
| | | @Operation(summary = "仓库-查询树") |
| | | @Log(title = "仓库-查询树", businessType = BusinessType.OTHER) |
| | | public AjaxResult listTree() { |
| | | return AjaxResult.success(warehouseService.findListTree()); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "仓库-查询") |
| | | @Log(title = "仓库-查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult list(Warehouse warehouse) { |
| | | return AjaxResult.success(warehouseService.findList(warehouse)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("仓库-添加") |
| | | @Operation(summary = "仓库-添加") |
| | | @Log(title = "仓库-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody Warehouse warehouse) { |
| | | return warehouseService.save(warehouse) ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败"); |
| | | return AjaxResult.success(warehouseService.save(warehouse)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("仓库-更新") |
| | | @PutMapping("/update") |
| | | @Operation(summary = "仓库-更新") |
| | | @Log(title = "仓库-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody Warehouse warehouse) { |
| | | return AjaxResult.success(warehouseService.updateById(warehouse)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("仓库-删除") |
| | | @Operation(summary = "仓库-删除") |
| | | @Log(title = "仓库-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return warehouseService.deleteByIds(ids) ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败"); |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(warehouseService.deleteByIds(ids)); |
| | | } |
| | | } |