package com.gkhy.hazmat.admin.controller.web;
|
|
|
import com.gkhy.hazmat.common.annotation.RepeatSubmit;
|
import com.gkhy.hazmat.common.api.CommonResult;
|
import com.gkhy.hazmat.system.domain.HzWarehouse;
|
import com.gkhy.hazmat.system.service.HzWarehouseService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* <p>
|
* 仓库表 前端控制器
|
* </p>
|
*
|
* @author kzy
|
* @since 2024-08-05 14:41:40
|
*/
|
@Api(tags = "仓库前端控制器")
|
@RestController
|
@RequestMapping("/warehouse")
|
public class HzWarehouseController {
|
@Autowired
|
private HzWarehouseService warehouseService;
|
|
@ApiOperation(value = "仓库列表(分页)")
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
|
@ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
|
})
|
@GetMapping("/list")
|
public CommonResult list(HzWarehouse warehouse){
|
return CommonResult.success(warehouseService.selectWarehouseList(warehouse));
|
}
|
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@ApiOperation(value = "新增仓库")
|
@PostMapping
|
public CommonResult add(@Validated @RequestBody HzWarehouse warehouse){
|
return CommonResult.success(warehouseService.insertWarehouse(warehouse));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@ApiOperation(value = "编辑仓库")
|
@PutMapping
|
public CommonResult edit(@Validated @RequestBody HzWarehouse warehouse){
|
return CommonResult.success(warehouseService.updateWarehouse(warehouse));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
|
@ApiOperation(value = "删除仓库")
|
@DeleteMapping(value = { "/{warehouseId}" })
|
public CommonResult delete(@PathVariable(value = "warehouseId", required = true) Long warehouseId){
|
return CommonResult.success(warehouseService.deleteWarehouseById(warehouseId));
|
}
|
|
|
@ApiOperation(value = "校验仓库名称是否唯一")
|
@PostMapping("/checkNameUnique")
|
public CommonResult checkNameUnique(@RequestBody HzWarehouse warehouse)
|
{
|
return CommonResult.success(warehouseService.checkNameUnique(warehouse));
|
}
|
|
}
|