|
@@ -2,7 +2,11 @@ package com.ruoyi.system.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
|
import com.ruoyi.common.core.domain.PageQuery;
|
|
@@ -40,7 +44,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo<SysRole> selectPageRoleList(SysRole role, PageQuery pageQuery) {
|
|
|
- Page<SysRole> page = baseMapper.selectPageRoleList(pageQuery.build(), role);
|
|
|
+ Page<SysRole> page = baseMapper.selectPageRoleList(pageQuery.build(), this.buildQueryWrapper(role));
|
|
|
return TableDataInfo.build(page);
|
|
|
}
|
|
|
|
|
@@ -52,7 +56,21 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<SysRole> selectRoleList(SysRole role) {
|
|
|
- return baseMapper.selectRoleList(role);
|
|
|
+ return baseMapper.selectRoleList(this.buildQueryWrapper(role));
|
|
|
+ }
|
|
|
+
|
|
|
+ private Wrapper<SysRole> buildQueryWrapper(SysRole role) {
|
|
|
+ Map<String, Object> params = role.getParams();
|
|
|
+ QueryWrapper<SysRole> wrapper = Wrappers.query();
|
|
|
+ wrapper.eq("r.del_flag", UserConstants.ROLE_NORMAL)
|
|
|
+ .eq(ObjectUtil.isNotNull(role.getRoleId()), "r.role_id", role.getRoleId())
|
|
|
+ .like(StringUtils.isNotBlank(role.getRoleName()), "r.role_name", role.getRoleName())
|
|
|
+ .eq(StringUtils.isNotBlank(role.getStatus()), "r.status", role.getStatus())
|
|
|
+ .like(StringUtils.isNotBlank(role.getRoleKey()), "r.role_key", role.getRoleKey())
|
|
|
+ .between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
|
+ "r.create_time", params.get("beginTime"), params.get("endTime"))
|
|
|
+ .orderByAsc("r.role_sort");
|
|
|
+ return wrapper;
|
|
|
}
|
|
|
|
|
|
/**
|