permission
This commit is contained in:
parent
013b58f6bd
commit
b40ccfe775
@ -10,6 +10,8 @@ import club.joylink.rtss.vo.client.PageVO;
|
|||||||
import club.joylink.rtss.vo.permission.*;
|
import club.joylink.rtss.vo.permission.*;
|
||||||
import club.joylink.rtss.vo.permission.convertor.PermissionConvertor;
|
import club.joylink.rtss.vo.permission.convertor.PermissionConvertor;
|
||||||
import club.joylink.rtss.vo.permission.convertor.SystemAbilityConvertor;
|
import club.joylink.rtss.vo.permission.convertor.SystemAbilityConvertor;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -186,29 +188,19 @@ public class AcPermissionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
PageVO<PermissionBasicRspVo> page = new PageVO<>();
|
final String orderBy = req.getOrderByType().with() + (req.getDesc() ? " desc" : "");
|
||||||
long sum = this.permissionDAO.countByExample(permissionExample);
|
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
|
||||||
page.setTotal(sum);
|
Page<Permission> sqlPage = (Page<Permission>) this.permissionDAO.selectByExample(permissionExample);
|
||||||
page.setPageNum(req.getPageNum());
|
PageHelper.clearPage();
|
||||||
page.setPageSize(req.getPageSize());
|
//
|
||||||
page.setList(new ArrayList<>());
|
List<PermissionBasicRspVo> rtList = new ArrayList<>();
|
||||||
if (sum > 0) {
|
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
|
||||||
//
|
rtList=sqlPage.getResult().stream().map(PermissionConvertor::convertPermissionBasicRspVoFrom).collect(Collectors.toList());
|
||||||
String orderBy = req.getOrderByType().with();
|
|
||||||
long startIndex = (req.getPageNum() - 1) * req.getPageSize();
|
|
||||||
//
|
|
||||||
if (req.getDesc()) {
|
|
||||||
permissionExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
|
|
||||||
} else {
|
|
||||||
permissionExample.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
|
|
||||||
}
|
|
||||||
List<Permission> pContent = this.permissionDAO.selectByExample(permissionExample);
|
|
||||||
if (!CollectionUtils.isEmpty(pContent)) {
|
|
||||||
page.setList(pContent.stream().map(PermissionConvertor::convertPermissionBasicRspVoFrom).collect(Collectors.toList()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return page;
|
//
|
||||||
|
return PageVO.convert(sqlPage,rtList);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
private List<SystemAbility> findAbilitiesByPermissionId(Long permissionId) {
|
private List<SystemAbility> findAbilitiesByPermissionId(Long permissionId) {
|
||||||
PermissionSystemAbilityExample psaExample = new PermissionSystemAbilityExample();
|
PermissionSystemAbilityExample psaExample = new PermissionSystemAbilityExample();
|
||||||
|
Loading…
Reference in New Issue
Block a user