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.convertor.PermissionConvertor;
|
||||
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.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -186,29 +188,19 @@ public class AcPermissionService {
|
||||
}
|
||||
}
|
||||
//
|
||||
PageVO<PermissionBasicRspVo> page = new PageVO<>();
|
||||
long sum = this.permissionDAO.countByExample(permissionExample);
|
||||
page.setTotal(sum);
|
||||
page.setPageNum(req.getPageNum());
|
||||
page.setPageSize(req.getPageSize());
|
||||
page.setList(new ArrayList<>());
|
||||
if (sum > 0) {
|
||||
//
|
||||
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()));
|
||||
}
|
||||
final String orderBy = req.getOrderByType().with() + (req.getDesc() ? " desc" : "");
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
|
||||
Page<Permission> sqlPage = (Page<Permission>) this.permissionDAO.selectByExample(permissionExample);
|
||||
PageHelper.clearPage();
|
||||
//
|
||||
List<PermissionBasicRspVo> rtList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
|
||||
rtList=sqlPage.getResult().stream().map(PermissionConvertor::convertPermissionBasicRspVoFrom).collect(Collectors.toList());
|
||||
}
|
||||
return page;
|
||||
//
|
||||
return PageVO.convert(sqlPage,rtList);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private List<SystemAbility> findAbilitiesByPermissionId(Long permissionId) {
|
||||
PermissionSystemAbilityExample psaExample = new PermissionSystemAbilityExample();
|
||||
|
Loading…
Reference in New Issue
Block a user