| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @OperationLog("Create 库位信息表") |
| | | @PostMapping("/loc/save") |
| | | public R save(@RequestBody Loc loc) { |
| | | if (Objects.isNull(loc.getWarehouseId())) { |
| | | throw new CoolException("仓库ID不能为空!!"); |
| | | } |
| | | if (Objects.isNull(loc.getAreaId())) { |
| | | throw new CoolException("仓库ID不能为空!!"); |
| | | } |
| | | if (Objects.isNull(loc.getTypeIds())) { |
| | | throw new CoolException("库位类型不能为空!!"); |
| | | } |
| | | List<Long> lists = JSONArray.parseArray(loc.getTypeIds(), Long.class); |
| | | String join = StringUtils.join(lists, ","); |
| | | loc.setType(join); |
| | | |
| | | loc.setCreateBy(getLoginUserId()); |
| | | loc.setUpdateBy(getLoginUserId()); |
| | | if (!locService.save(loc)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | |
| | | if (!locService.saveType(loc)) { |
| | | throw new CoolException("库位类型保存失败!!"); |
| | | } |
| | | return R.ok("Save Success").add(loc); |
| | | } |
| | | |