permission
This commit is contained in:
parent
e577e255a9
commit
d9828671c7
@ -145,10 +145,16 @@ public class AcPermissionService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public PageVO<PermissionBasicRspVo> findByPage(FindPermissionBasicByPageReqVo req) {
|
public PageVO<PermissionBasicRspVo> findByPage(FindPermissionBasicByPageReqVo req) {
|
||||||
PageVO<PermissionBasicRspVo> page = new PageVO<>();
|
//查询条件
|
||||||
|
final boolean hasCondition = null != req.getName() || null != req.getDes();
|
||||||
|
final boolean multiConditions = null != req.getName() && null != req.getDes();
|
||||||
|
//多个条件与、一个条件默认按与处理
|
||||||
|
final boolean makeAnd = hasCondition && (multiConditions && req.getLogicAnd() || !multiConditions);
|
||||||
|
//多个条件或
|
||||||
|
final boolean makeOr = multiConditions && !req.getLogicAnd();
|
||||||
//
|
//
|
||||||
PermissionExample permissionExample = new PermissionExample();
|
PermissionExample permissionExample = new PermissionExample();
|
||||||
if (null != req.getName() || null != req.getDes()) {
|
if (makeAnd) {
|
||||||
PermissionExample.Criteria pc = permissionExample.createCriteria();
|
PermissionExample.Criteria pc = permissionExample.createCriteria();
|
||||||
if (null != req.getName()) {
|
if (null != req.getName()) {
|
||||||
if (req.getNameLike()) {
|
if (req.getNameLike()) {
|
||||||
@ -165,7 +171,22 @@ public class AcPermissionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (makeOr) {
|
||||||
|
PermissionExample.Criteria nc = permissionExample.or();
|
||||||
|
if (req.getNameLike()) {
|
||||||
|
nc.andNameLike(String.format("%%%s%%", req.getName()));
|
||||||
|
} else {
|
||||||
|
nc.andNameEqualTo(req.getName());
|
||||||
|
}
|
||||||
|
PermissionExample.Criteria dc = permissionExample.or();
|
||||||
|
if (req.getDesLike()) {
|
||||||
|
dc.andDesLike(String.format("%%%s%%", req.getDes()));
|
||||||
|
} else {
|
||||||
|
dc.andDesEqualTo(req.getDes());
|
||||||
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
|
PageVO<PermissionBasicRspVo> page = new PageVO<>();
|
||||||
long sum = this.permissionDAO.countByExample(permissionExample);
|
long sum = this.permissionDAO.countByExample(permissionExample);
|
||||||
page.setTotal(sum);
|
page.setTotal(sum);
|
||||||
page.setPageNum(req.getPageNum());
|
page.setPageNum(req.getPageNum());
|
||||||
@ -188,7 +209,7 @@ public class AcPermissionService {
|
|||||||
}
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
private List<SystemAbility> findAbilitiesByPermissionId(Long permissionId) {
|
private List<SystemAbility> findAbilitiesByPermissionId(Long permissionId) {
|
||||||
PermissionSystemAbilityExample psaExample = new PermissionSystemAbilityExample();
|
PermissionSystemAbilityExample psaExample = new PermissionSystemAbilityExample();
|
||||||
psaExample.createCriteria().andPermissionIdEqualTo(permissionId);
|
psaExample.createCriteria().andPermissionIdEqualTo(permissionId);
|
||||||
|
@ -29,6 +29,10 @@ public class FindPermissionBasicByPageReqVo extends PageQueryVO {
|
|||||||
* 按权限描述查询时,默认true,true-模糊查询,false-精确查询
|
* 按权限描述查询时,默认true,true-模糊查询,false-精确查询
|
||||||
*/
|
*/
|
||||||
private Boolean desLike = true;
|
private Boolean desLike = true;
|
||||||
|
/**
|
||||||
|
* 当查询条件有多个时,条件间关系:true-且,false-或;默认值为true
|
||||||
|
*/
|
||||||
|
private Boolean logicAnd = true;
|
||||||
/**
|
/**
|
||||||
* 是否降序,true-降序,false-升序,默认值为true;
|
* 是否降序,true-降序,false-升序,默认值为true;
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user