1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Fixed pagination in GroupManagement

This commit is contained in:
2023-06-01 20:55:34 +08:00
parent e58dd032c8
commit 381802c10c
3 changed files with 27 additions and 17 deletions

View File

@@ -1,11 +1,12 @@
package com.cfive.pinnacle.mapper.permission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cfive.pinnacle.entity.permission.Group;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 用户组 Mapper 接口
@@ -16,7 +17,7 @@ import org.apache.ibatis.annotations.Param;
*/
@Mapper
public interface GroupMapper extends BaseMapper<Group> {
IPage<Group> getAll(IPage<Group> groupIPage);
List<Group> getAll(@Param("groupList") List<Group> groupList);
Group getOneById(@Param("id") long id);
}

View File

@@ -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.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.cfive.pinnacle.entity.permission.Group;
@@ -42,7 +43,10 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
@Override
public IPage<Group> getAllGroup(Long currentPage, Long pageSize) {
Page<Group> groupIPage = PageDTO.of(currentPage, pageSize);
return groupMapper.getAll(groupIPage);
groupIPage = groupMapper.selectPage(groupIPage, Wrappers.emptyWrapper());
groupIPage.setRecords(groupMapper.getAll(groupIPage.getRecords()));
return groupIPage;
}
@Override

View File

@@ -3,7 +3,7 @@
<mapper namespace="com.cfive.pinnacle.mapper.permission.GroupMapper">
<select id="getAll" resultMap="groupMap">
select t_group.id as group_id,
select distinct t_group.id as group_id,
t_group.name as group_name,
t_group.enable as group_enable,
t_group.deleted as group_deleted,
@@ -12,10 +12,15 @@
tr.name as role_name,
tr.deleted as role_deleted,
tr.version as role_version
from t_group
from (select * from t_group where deleted = 0) as t_group
left join (select * from t_role_group where deleted = 0) as trg on t_group.id = trg.group_id
left join (select * from t_role where deleted = 0) as tr on tr.id = trg.role_id
where t_group.deleted = 0
<where>
<foreach collection="groupList" item="item" index="index" open="t_group.id in (" separator="," close=")"
nullable="true">
#{item.id}
</foreach>
</where>
</select>
<select id="getOneById" resultMap="groupMap">