| | |
| | | if (Objects.isNull(loc.getTypeIds())) { |
| | | throw new CoolException("库位类型不能为空!!"); |
| | | } |
| | | List<Long> lists = JSONArray.parseArray(loc.getTypeIds(), Long.class); |
| | | String join = StringUtils.join(lists, ","); |
| | | String join = StringUtils.join(loc.getTypeIds(), ","); |
| | | loc.setType(join); |
| | | |
| | | loc.setCreateBy(getLoginUserId()); |
| | |
| | | } |
| | | |
| | | if (!locService.saveType(loc)) { |
| | | throw new CoolException("库位类型保存失败!!"); |
| | | throw new CoolException("库位类型关联关系保存失败!!"); |
| | | } |
| | | return R.ok("Save Success").add(loc); |
| | | } |
| | |
| | | @PostMapping("/loc/update") |
| | | public R update(@RequestBody Loc loc) { |
| | | loc.setUpdateBy(getLoginUserId()); |
| | | loc.setUpdateTime(new Date()); |
| | | |
| | | String join = StringUtils.join(loc.getTypeIds(), ","); |
| | | loc.setType(join); |
| | | |
| | | if (!locService.updateById(loc)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | |
| | | if (!locService.updateLoc(loc)) { |
| | | throw new CoolException("库位类型关联关系修改失败!!"); |
| | | } |
| | | return R.ok("Update Success").add(loc); |
| | | } |
| | | |