mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
Added pagination to GroupManagement. Optimized get group list in UserManagement.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.cfive.pinnacle.controller.permission;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.cfive.pinnacle.entity.permission.Group;
|
||||
import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||
@@ -38,9 +39,17 @@ public class GroupController {
|
||||
|
||||
@Operation(summary = "获取所有用户组")
|
||||
@GetMapping
|
||||
@PreAuthorize("hasAnyAuthority('system:group:get', 'system:group:add', 'system:group:delete', 'system:group:modify', 'system:user:add', 'system:user:modify')")
|
||||
public ResponseResult<List<Group>> getAllGroup() {
|
||||
List<Group> groups = groupService.getAllGroup();
|
||||
@PreAuthorize("hasAuthority('system:group:get' )")
|
||||
public ResponseResult<IPage<Group>> getAllGroup(Long currentPage, Long pageSize) {
|
||||
IPage<Group> groups = groupService.getAllGroup(currentPage, pageSize);
|
||||
return ResponseResult.databaseSelectSuccess(groups);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取用户组列表")
|
||||
@GetMapping("list")
|
||||
@PreAuthorize("hasAnyAuthority('system:user:add', 'system:user:modify')")
|
||||
public ResponseResult<List<Group>> getGroupList() {
|
||||
List<Group> groups = groupService.list();
|
||||
return ResponseResult.databaseSelectSuccess(groups);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
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 接口
|
||||
@@ -17,7 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface GroupMapper extends BaseMapper<Group> {
|
||||
List<Group> getAll();
|
||||
IPage<Group> getAll(IPage<Group> groupIPage);
|
||||
|
||||
Group getOneById(@Param("id") long id);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.cfive.pinnacle.service.permission;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.cfive.pinnacle.entity.permission.Group;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组 服务类
|
||||
@@ -14,7 +13,7 @@ import java.util.List;
|
||||
* @since 2023-04-30
|
||||
*/
|
||||
public interface IGroupService extends IService<Group> {
|
||||
List<Group> getAllGroup();
|
||||
IPage<Group> getAllGroup(Long currentPage, Long pageSize);
|
||||
|
||||
Group getGroup(Long id);
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cfive.pinnacle.entity.permission.Group;
|
||||
import com.cfive.pinnacle.entity.permission.RoleGroup;
|
||||
import com.cfive.pinnacle.mapper.permission.GroupMapper;
|
||||
@@ -12,7 +15,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -38,8 +40,9 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> getAllGroup() {
|
||||
return groupMapper.getAll();
|
||||
public IPage<Group> getAllGroup(Long currentPage, Long pageSize) {
|
||||
Page<Group> groupIPage = PageDTO.of(currentPage, pageSize);
|
||||
return groupMapper.getAll(groupIPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
from 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 t_group.deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="getOneById" resultMap="groupMap">
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
left join t_element te on tp.id = te.power_id
|
||||
left join t_operation t on tp.id = t.power_id
|
||||
where t_role.deleted = 0
|
||||
and t_role.id = #{id};
|
||||
and t_role.id = #{id}
|
||||
</select>
|
||||
|
||||
<resultMap id="roleMap" type="role">
|
||||
|
||||
Reference in New Issue
Block a user