Browse Source

fix:[系统管理][存储位置]

master
HanLong 4 weeks ago
parent
commit
f9cd111444
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java

+ 13
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StorageLocationController.java View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hxhq.business.domain.StorageLocationJcgj; import com.hxhq.business.domain.StorageLocationJcgj;
import com.hxhq.business.domain.YqJcgj; import com.hxhq.business.domain.YqJcgj;
import com.hxhq.business.form.yq.StorageLocationForm; import com.hxhq.business.form.yq.StorageLocationForm;
@ -82,6 +83,12 @@ public class StorageLocationController extends BaseController
public AjaxResult save(@RequestBody StorageLocationForm form) public AjaxResult save(@RequestBody StorageLocationForm form)
{ {
form.setQmrId(SecurityUtils.getUserId()); form.setQmrId(SecurityUtils.getUserId());
LambdaQueryWrapper<StorageLocation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StorageLocation::getName, form.getName());
long count = storageLocationService.count(queryWrapper);
if(count > 0) {
return error("【" + form.getName() + "】已存在");
}
storageLocationService.addStorageLocation(form); storageLocationService.addStorageLocation(form);
return success(); return success();
} }
@ -94,6 +101,12 @@ public class StorageLocationController extends BaseController
public AjaxResult edit(@RequestBody StorageLocationForm form) public AjaxResult edit(@RequestBody StorageLocationForm form)
{ {
form.setQmrId(SecurityUtils.getUserId()); form.setQmrId(SecurityUtils.getUserId());
LambdaQueryWrapper<StorageLocation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StorageLocation::getName, form.getName());
StorageLocation storageLocation = storageLocationService.getOne(queryWrapper);
if(storageLocation != null && !storageLocation.getId().equals(form.getId())) {
return error("【" + form.getName() + "】已存在");
}
storageLocationService.updateStorageLocation(form); storageLocationService.updateStorageLocation(form);
return success(); return success();
} }

Loading…
Cancel
Save