use of org.jeecg.modules.system.entity.SysPermissionDataRule in project jeecg-boot by jeecgboot.
the class SysDepartPermissionController method loadDatarule.
/**
* 部门管理授权查询数据规则数据
*/
@GetMapping(value = "/datarule/{permissionId}/{departId}")
public Result<?> loadDatarule(@PathVariable("permissionId") String permissionId, @PathVariable("departId") String departId) {
List<SysPermissionDataRule> list = sysPermissionDataRuleService.getPermRuleListByPermId(permissionId);
if (list == null || list.size() == 0) {
return Result.error("未找到权限配置信息");
} else {
Map<String, Object> map = new HashMap<>();
map.put("datarule", list);
LambdaQueryWrapper<SysDepartPermission> query = new LambdaQueryWrapper<SysDepartPermission>().eq(SysDepartPermission::getPermissionId, permissionId).eq(SysDepartPermission::getDepartId, departId);
SysDepartPermission sysDepartPermission = sysDepartPermissionService.getOne(query);
if (sysDepartPermission == null) {
// return Result.error("未找到角色菜单配置信息");
} else {
String drChecked = sysDepartPermission.getDataRuleIds();
if (oConvertUtils.isNotEmpty(drChecked)) {
map.put("drChecked", drChecked.endsWith(",") ? drChecked.substring(0, drChecked.length() - 1) : drChecked);
}
}
return Result.ok(map);
// TODO 以后按钮权限的查询也走这个请求 无非在map中多加两个key
}
}
use of org.jeecg.modules.system.entity.SysPermissionDataRule in project jeecg-boot by jeecgboot.
the class SysDepartPermissionServiceImpl method getPermRuleListByDeptIdAndPermId.
@Override
public List<SysPermissionDataRule> getPermRuleListByDeptIdAndPermId(String departId, String permissionId) {
SysDepartPermission departPermission = this.getOne(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
if (departPermission != null && oConvertUtils.isNotEmpty(departPermission.getDataRuleIds())) {
LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
query.in(SysPermissionDataRule::getId, Arrays.asList(departPermission.getDataRuleIds().split(",")));
query.orderByDesc(SysPermissionDataRule::getCreateTime);
List<SysPermissionDataRule> permRuleList = this.ruleMapper.selectList(query);
return permRuleList;
} else {
return null;
}
}
use of org.jeecg.modules.system.entity.SysPermissionDataRule in project kykms by mahonelau.
the class SysDepartPermissionServiceImpl method getPermRuleListByDeptIdAndPermId.
@Override
public List<SysPermissionDataRule> getPermRuleListByDeptIdAndPermId(String departId, String permissionId) {
SysDepartPermission departPermission = this.getOne(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId).eq(SysDepartPermission::getPermissionId, permissionId));
if (departPermission != null) {
LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<SysPermissionDataRule>();
query.in(SysPermissionDataRule::getId, Arrays.asList(departPermission.getDataRuleIds().split(",")));
query.orderByDesc(SysPermissionDataRule::getCreateTime);
List<SysPermissionDataRule> permRuleList = this.ruleMapper.selectList(query);
return permRuleList;
} else {
return null;
}
}
use of org.jeecg.modules.system.entity.SysPermissionDataRule in project kykms by mahonelau.
the class SysPermissionDataRuleImpl method deletePermissionDataRule.
@Override
@Transactional
public void deletePermissionDataRule(String dataRuleId) {
SysPermissionDataRule dataRule = this.baseMapper.selectById(dataRuleId);
if (dataRule != null) {
this.removeById(dataRuleId);
Integer count = this.baseMapper.selectCount(new LambdaQueryWrapper<SysPermissionDataRule>().eq(SysPermissionDataRule::getPermissionId, dataRule.getPermissionId()));
// 注:同一个事务中删除后再查询是会认为数据已被删除的 若事务回滚上述删除无效
if (count == null || count == 0) {
SysPermission permission = sysPermissionMapper.selectById(dataRule.getPermissionId());
if (permission != null && permission.getRuleFlag().equals(CommonConstant.RULE_FLAG_1)) {
permission.setRuleFlag(CommonConstant.RULE_FLAG_0);
sysPermissionMapper.updateById(permission);
}
}
}
}
use of org.jeecg.modules.system.entity.SysPermissionDataRule in project kykms by mahonelau.
the class SysDepartPermissionController method loadDatarule.
/**
* 部门管理授权查询数据规则数据
*/
@GetMapping(value = "/datarule/{permissionId}/{departId}")
public Result<?> loadDatarule(@PathVariable("permissionId") String permissionId, @PathVariable("departId") String departId) {
List<SysPermissionDataRule> list = sysPermissionDataRuleService.getPermRuleListByPermId(permissionId);
if (list == null || list.size() == 0) {
return Result.error("未找到权限配置信息");
} else {
Map<String, Object> map = new HashMap<>();
map.put("datarule", list);
LambdaQueryWrapper<SysDepartPermission> query = new LambdaQueryWrapper<SysDepartPermission>().eq(SysDepartPermission::getPermissionId, permissionId).eq(SysDepartPermission::getDepartId, departId);
SysDepartPermission sysDepartPermission = sysDepartPermissionService.getOne(query);
if (sysDepartPermission == null) {
// return Result.error("未找到角色菜单配置信息");
} else {
String drChecked = sysDepartPermission.getDataRuleIds();
if (oConvertUtils.isNotEmpty(drChecked)) {
map.put("drChecked", drChecked.endsWith(",") ? drChecked.substring(0, drChecked.length() - 1) : drChecked);
}
}
return Result.ok(map);
// TODO 以后按钮权限的查询也走这个请求 无非在map中多加两个key
}
}
Aggregations