|
|
@@ -1,10 +1,13 @@
|
|
|
package com.xunmei.system.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.UserConstants;
|
|
|
import com.xunmei.common.core.exception.ServiceException;
|
|
|
import com.xunmei.common.core.utils.SpringUtils;
|
|
|
import com.xunmei.common.core.utils.StringUtils;
|
|
|
+import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import com.xunmei.common.datascope.annotation.DataScope;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.system.api.domain.SysRole;
|
|
|
@@ -49,9 +52,22 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|
|
*/
|
|
|
@Override
|
|
|
@DataScope(deptAlias = "d")
|
|
|
- public List<SysRole> selectRoleList(SysRole role)
|
|
|
+ public TableDataInfo selectRoleList(SysRole role)
|
|
|
{
|
|
|
- return roleMapper.selectRoleList(role);
|
|
|
+ Page<SysRole> page;
|
|
|
+ if (role.getPageNum()!=null&&role.getPageSize()!=null)
|
|
|
+ {
|
|
|
+ page = new Page<>(role.getPageNum(), role.getPageSize());
|
|
|
+ }else{
|
|
|
+ page = new Page<>();
|
|
|
+ }
|
|
|
+ page = roleMapper.selectPage( page,new QueryWrapper<>(role));
|
|
|
+ TableDataInfo tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setMsg("操作成功");
|
|
|
+ tableDataInfo.setCode(200);
|
|
|
+ tableDataInfo.setTotal(page.getTotal());
|
|
|
+ tableDataInfo.setRows(page.getRecords());
|
|
|
+ return tableDataInfo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -108,7 +124,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|
|
@Override
|
|
|
public List<SysRole> selectRoleAll()
|
|
|
{
|
|
|
- return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
|
|
|
+ return roleMapper.selectList(new QueryWrapper<>());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -197,7 +213,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|
|
{
|
|
|
SysRole role = new SysRole();
|
|
|
role.setId(roleId);
|
|
|
- List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role);
|
|
|
+ List<SysRole> roles = roleMapper.selectList(new QueryWrapper<>(role));
|
|
|
if (StringUtils.isEmpty(roles))
|
|
|
{
|
|
|
throw new ServiceException("没有权限访问角色数据!");
|