mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -85,7 +85,7 @@ public class PermGroupController {
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Result<Integer> delete(@Validated @RequestBody IdParam param) {
|
||||
return Result.ok(permGroupService.deleteById(param.getId()));
|
||||
return Result.ok(permGroupService.delete(param.getId()));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,7 +25,7 @@ public class ApiInfo {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
* 所属应用
|
||||
*/
|
||||
private String application;
|
||||
|
||||
|
@@ -3,10 +3,14 @@ package com.gitee.sop.adminbackend.service.isv;
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroup;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvGroup;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermGroupMapper;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermIsvGroupMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -17,8 +21,11 @@ import java.util.Map;
|
||||
@Service
|
||||
public class PermGroupService implements LambdaService<PermGroup, PermGroupMapper> {
|
||||
|
||||
public PageInfo<PermGroup> doPage(LambdaQuery<PermGroup> query) {
|
||||
query.orderByDesc(PermGroup::getId);
|
||||
@Resource
|
||||
PermIsvGroupMapper permIsvGroupMapper;
|
||||
|
||||
public PageInfo<PermGroup> doPage(LambdaQuery<PermGroup> query) {
|
||||
query.orderByDesc(PermGroup::getId);
|
||||
PageInfo<PermGroup> page = this.page(query);
|
||||
|
||||
// 格式转换
|
||||
@@ -34,5 +41,15 @@ public class PermGroupService implements LambdaService<PermGroup, PermGroupMappe
|
||||
.map(PermGroup::getId, PermGroup::getGroupName);
|
||||
}
|
||||
|
||||
public int delete(Long groupId) {
|
||||
boolean used = permIsvGroupMapper.query()
|
||||
.eq(PermIsvGroup::getGroupId, groupId)
|
||||
.get() != null;
|
||||
if (used) {
|
||||
throw new BizException("无法删除:分组已被使用");
|
||||
}
|
||||
return this.deleteById(groupId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -82,7 +82,12 @@ public class PermIsvGroupService implements LambdaService<PermIsvGroup, PermIsvG
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
return list.stream().map(PermIsvGroup::getGroupId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public boolean isUsed(Long groupId) {
|
||||
return this.query()
|
||||
.eq(PermIsvGroup::getGroupId, groupId)
|
||||
.get() != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user