| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreas; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | | |
| | | private LocService locService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:warehouseAreas:list')") |
| | | @PostMapping("/warehouseAreas/page") |
| | |
| | | @PostMapping("/warehouseAreas/save") |
| | | public R save(@RequestBody WarehouseAreas warehouseAreas) { |
| | | warehouseAreas.setCreateBy(getLoginUserId()); |
| | | warehouseAreas.setCreateTime(new Date()); |
| | | warehouseAreas.setUpdateBy(getLoginUserId()); |
| | | warehouseAreas.setUpdateTime(new Date()); |
| | | if (!warehouseAreasService.save(warehouseAreas)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | |
| | | @OperationLog("Delete 库区信息表") |
| | | @PostMapping("/warehouseAreas/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().in(Loc::getAreaId, ids)); |
| | | if (!locs.isEmpty()) { |
| | | throw new CoolException("当前库有库位绑定,不能执行删除操作!!"); |
| | | } |
| | | if (!warehouseAreasService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |