mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 06:51:23 +08:00
Added desc order by id to GroupManagement and RoleManagement
This commit is contained in:
@@ -2,6 +2,7 @@ package com.cfive.pinnacle.service.permission.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cfive.pinnacle.entity.permission.Group;
|
||||
@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,6 +45,7 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
|
||||
@Override
|
||||
public IPage<Group> getAllGroup(Long currentPage, Long pageSize, String searchName, List<Long> searchRole, Integer searchEnable, Integer searchRegex) {
|
||||
Page<Group> groupIPage = PageDTO.of(currentPage, pageSize);
|
||||
groupIPage.addOrder(OrderItem.desc("id"));
|
||||
searchName = searchName.trim();
|
||||
List<Long> groupList = groupMapper.filterGroupByRoleId(null, null, searchName, searchEnable, searchRegex);
|
||||
if (groupList.size() > 0) {
|
||||
@@ -57,7 +60,9 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
|
||||
if (groupList.size() > 0) {
|
||||
LambdaQueryWrapper<Group> wrapper = new LambdaQueryWrapper<Group>().in(Group::getId, groupList);
|
||||
groupIPage = groupMapper.selectPage(groupIPage, wrapper);
|
||||
groupIPage.setRecords(groupMapper.getAll(groupIPage.getRecords()));
|
||||
List<Group> groups = groupMapper.getAll(groupIPage.getRecords());
|
||||
Collections.reverse(groups);
|
||||
groupIPage.setRecords(groups);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.cfive.pinnacle.service.permission.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cfive.pinnacle.entity.permission.*;
|
||||
import com.cfive.pinnacle.exception.DataValidationFailedException;
|
||||
@@ -13,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -43,7 +46,8 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
||||
|
||||
@Override
|
||||
public IPage<Role> getAllRole(Long currentPage, Long pageSize, String searchName, List<Long> searchPower, Integer searchEnable, Integer searchRegex) {
|
||||
IPage<Role> roleIPage = PageDTO.of(currentPage, pageSize);
|
||||
Page<Role> roleIPage = PageDTO.of(currentPage, pageSize);
|
||||
roleIPage.addOrder(OrderItem.desc("id"));
|
||||
searchName = searchName.trim();
|
||||
List<Long> roleList = roleMapper.filterRoleByPowerId(null, null, searchName, searchEnable, searchRegex);
|
||||
if (roleList.size() > 0) {
|
||||
@@ -58,7 +62,9 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
||||
if (roleList.size() > 0) {
|
||||
LambdaQueryWrapper<Role> wrapper = new LambdaQueryWrapper<Role>().in(Role::getId, roleList);
|
||||
roleIPage = roleMapper.selectPage(roleIPage, wrapper);
|
||||
roleIPage.setRecords(roleMapper.getAll(roleIPage.getRecords()));
|
||||
List<Role> roles = roleMapper.getAll(roleIPage.getRecords());
|
||||
Collections.reverse(roles);
|
||||
roleIPage.setRecords(roles);
|
||||
}
|
||||
|
||||
return roleIPage;
|
||||
|
||||
Reference in New Issue
Block a user