园区管理删除逻辑修改

master
vayne 3 months ago
parent d5802faea2
commit 2a4e2a782e

@ -1,5 +1,6 @@
package jnpf.controller; package jnpf.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult; import jnpf.base.ActionResult;
@ -411,6 +412,15 @@ public class AreaRenameController {
@Operation(summary = "批量删除") @Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){ public ActionResult batchRemove(@RequestBody String ids){
List<String> idList = JsonUtil.getJsonToList(ids, String.class); List<String> idList = JsonUtil.getJsonToList(ids, String.class);
for (String allId : idList) {
QueryWrapper<AreaEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(AreaEntity::getPid,allId);
queryWrapper.lambda().isNull(AreaEntity::getDeleteMark);
long lenght = areaService.count(queryWrapper);
if (lenght > 0){
return ActionResult.fail("该区域已配置空间数据,不能删除,请确认!");
}
}
int i =0; int i =0;
for (String allId : idList){ for (String allId : idList){
this.delete(allId); this.delete(allId);
@ -459,13 +469,21 @@ public class AreaRenameController {
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Transactional @Transactional
public ActionResult delete(@PathVariable("id") String id){ public ActionResult delete(@PathVariable("id") String id){
AreaEntity entity= areaService.getInfo(id); QueryWrapper<AreaEntity> queryWrapper = new QueryWrapper<>();
if(entity!=null){ queryWrapper.lambda().eq(AreaEntity::getPid,id);
//假删除 queryWrapper.lambda().isNull(AreaEntity::getDeleteMark);
entity.setDeleteMark(1); long lenght = areaService.count(queryWrapper);
areaService.update(id,entity); if (lenght > 0){
return ActionResult.fail("该区域已配置空间数据,不能删除,请确认!");
}else {
AreaEntity entity = areaService.getInfo(id);
if (entity != null) {
//假删除
entity.setDeleteMark(1);
areaService.update(id, entity);
}
return ActionResult.success("删除成功");
} }
return ActionResult.success("删除成功");
} }
/** /**
* () * ()

@ -82,6 +82,8 @@ public class ParkController {
@Autowired @Autowired
private ConfigValueUtil configValueUtil; private ConfigValueUtil configValueUtil;
@Autowired
private AreaService areaService;
/** /**
* *
* *
@ -421,6 +423,15 @@ public class ParkController {
@Operation(summary = "批量删除") @Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids) { public ActionResult batchRemove(@RequestBody String ids) {
List<String> idList = JsonUtil.getJsonToList(ids, String.class); List<String> idList = JsonUtil.getJsonToList(ids, String.class);
for (String allId : idList) {
QueryWrapper<AreaEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(AreaEntity::getPid,allId);
queryWrapper.lambda().isNull(AreaEntity::getDeleteMark);
long lenght = areaService.count(queryWrapper);
if (lenght > 0){
return ActionResult.fail("该园区已配置区域数据,不能删除,请确认!");
}
}
int i = 0; int i = 0;
for (String allId : idList) { for (String allId : idList) {
this.delete(allId); this.delete(allId);
@ -473,13 +484,21 @@ public class ParkController {
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Transactional @Transactional
public ActionResult delete(@PathVariable("id") String id) { public ActionResult delete(@PathVariable("id") String id) {
ParkEntity entity = parkService.getInfo(id); QueryWrapper<AreaEntity> queryWrapper = new QueryWrapper<>();
if (entity != null) { queryWrapper.lambda().eq(AreaEntity::getPid,id);
//假删除 queryWrapper.lambda().isNull(AreaEntity::getDeleteMark);
entity.setDeleteMark(1); long lenght = areaService.count(queryWrapper);
parkService.update(id, entity); if (lenght > 0){
return ActionResult.fail("该园区已配置区域数据,不能删除,请确认!");
}else {
ParkEntity entity = parkService.getInfo(id);
if (entity != null) {
//假删除
entity.setDeleteMark(1);
parkService.update(id, entity);
}
return ActionResult.success("删除成功");
} }
return ActionResult.success("删除成功");
} }
/** /**

@ -75,6 +75,8 @@ public class SpaceController {
@Autowired @Autowired
private ConfigValueUtil configValueUtil; private ConfigValueUtil configValueUtil;
@Autowired
private AreaService areaService;
/** /**
* *
@ -432,6 +434,12 @@ public class SpaceController {
@Operation(summary = "批量删除") @Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){ public ActionResult batchRemove(@RequestBody String ids){
List<String> idList = JsonUtil.getJsonToList(ids, String.class); List<String> idList = JsonUtil.getJsonToList(ids, String.class);
for (String allId : idList){
SpaceEntity spaceEntity = spaceService.getInfo(allId);
if (ObjectUtil.isNotEmpty(spaceEntity) && !spaceEntity.getState().equals("10")){
return ActionResult.fail("有空间已被使用,不能删除,请确认!");
}
}
int i =0; int i =0;
for (String allId : idList){ for (String allId : idList){
this.delete(allId); this.delete(allId);
@ -480,11 +488,15 @@ public class SpaceController {
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Transactional @Transactional
public ActionResult delete(@PathVariable("id") String id){ public ActionResult delete(@PathVariable("id") String id){
SpaceEntity entity= spaceService.getInfo(id); SpaceEntity entity = spaceService.getInfo(id);
if(entity!=null){ if (entity != null) {
//假删除 if (!entity.getState().equals("10")){
entity.setDeleteMark(1); return ActionResult.fail("该空间已被使用,不能删除,请确认!");
spaceService.update(id,entity); }else {
//假删除
entity.setDeleteMark(1);
spaceService.update(id, entity);
}
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }

@ -318,6 +318,8 @@ export default {
init(id, isDetail, allList, treeActiveId) { init(id, isDetail, allList, treeActiveId) {
if (id) { if (id) {
this.disFlag = true; this.disFlag = true;
} else {
this.disFlag = false;
} }
this.prevDis = false; this.prevDis = false;
this.nextDis = false; this.nextDis = false;

@ -283,6 +283,8 @@ export default {
init(id, isDetail, allList) { init(id, isDetail, allList) {
if (id) { if (id) {
this.disFlag = true; this.disFlag = true;
} else {
this.disFlag = false;
} }
this.prevDis = false; this.prevDis = false;
this.nextDis = false; this.nextDis = false;

@ -388,6 +388,8 @@ export default {
init(id, isDetail, allList, treeActiveId) { init(id, isDetail, allList, treeActiveId) {
if (id) { if (id) {
this.disFlag = true; this.disFlag = true;
} else {
this.disFlag = false;
} }
this.prevDis = false; this.prevDis = false;
this.nextDis = false; this.nextDis = false;

Loading…
Cancel
Save