优化查询条件,基于Lambda表达式实现
This commit is contained in:
parent
25b7865c12
commit
acd69963f3
|
@ -1,7 +1,7 @@
|
||||||
package net.maku.framework.common.service.impl;
|
package net.maku.framework.common.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
@ -99,7 +99,7 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
|
||||||
/**
|
/**
|
||||||
* MyBatis-Plus 数据权限
|
* MyBatis-Plus 数据权限
|
||||||
*/
|
*/
|
||||||
protected void dataScopeWrapper(QueryWrapper<T> queryWrapper) {
|
protected void dataScopeWrapper(LambdaQueryWrapper<T> queryWrapper) {
|
||||||
DataScope dataScope = getDataScope(null, null);
|
DataScope dataScope = getDataScope(null, null);
|
||||||
if (dataScope != null){
|
if (dataScope != null){
|
||||||
queryWrapper.apply(dataScope.getSqlFilter());
|
queryWrapper.apply(dataScope.getSqlFilter());
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package net.maku.system.dao;
|
package net.maku.system.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import net.maku.framework.common.dao.BaseDao;
|
import net.maku.framework.common.dao.BaseDao;
|
||||||
import net.maku.system.entity.SysOauthClientEntity;
|
import net.maku.system.entity.SysOauthClientEntity;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
@ -14,6 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
public interface SysOauthClientDao extends BaseDao<SysOauthClientEntity> {
|
public interface SysOauthClientDao extends BaseDao<SysOauthClientEntity> {
|
||||||
|
|
||||||
default SysOauthClientEntity getByClientId(String clientId){
|
default SysOauthClientEntity getByClientId(String clientId){
|
||||||
return this.selectOne(new QueryWrapper<SysOauthClientEntity>().eq("client_id", clientId));
|
return this.selectOne(new LambdaQueryWrapper<SysOauthClientEntity>().eq(SysOauthClientEntity::getClientId, clientId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.maku.framework.common.page.PageResult;
|
import net.maku.framework.common.page.PageResult;
|
||||||
|
@ -32,10 +33,10 @@ public class SysDictDataServiceImpl extends BaseServiceImpl<SysDictDataDao, SysD
|
||||||
return new PageResult<>(SysDictDataConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
return new PageResult<>(SysDictDataConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryWrapper<SysDictDataEntity> getWrapper(SysDictDataQuery query){
|
private Wrapper<SysDictDataEntity> getWrapper(SysDictDataQuery query){
|
||||||
QueryWrapper<SysDictDataEntity> wrapper = new QueryWrapper<>();
|
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq("dict_type_id", query.getDictTypeId());
|
wrapper.eq(SysDictDataEntity::getDictTypeId, query.getDictTypeId());
|
||||||
wrapper.orderByAsc("sort");
|
wrapper.orderByAsc(SysDictDataEntity::getSort);
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
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.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
@ -38,11 +40,11 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
|
||||||
return new PageResult<>(SysDictTypeConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
return new PageResult<>(SysDictTypeConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryWrapper<SysDictTypeEntity> getWrapper(SysDictTypeQuery query){
|
private Wrapper<SysDictTypeEntity> getWrapper(SysDictTypeQuery query){
|
||||||
QueryWrapper<SysDictTypeEntity> wrapper = new QueryWrapper<>();
|
LambdaQueryWrapper<SysDictTypeEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.like(StrUtil.isNotBlank(query.getDictType()), "dict_type", query.getDictType());
|
wrapper.like(StrUtil.isNotBlank(query.getDictType()), SysDictTypeEntity::getDictType, query.getDictType());
|
||||||
wrapper.like(StrUtil.isNotBlank(query.getDictName()), "dict_name", query.getDictName());
|
wrapper.like(StrUtil.isNotBlank(query.getDictName()), SysDictTypeEntity::getDictName, query.getDictName());
|
||||||
wrapper.orderByAsc("sort");
|
wrapper.orderByAsc(SysDictTypeEntity::getSort);
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.maku.framework.common.page.PageResult;
|
import net.maku.framework.common.page.PageResult;
|
||||||
|
@ -45,12 +46,12 @@ public class SysPostServiceImpl extends BaseServiceImpl<SysPostDao, SysPostEntit
|
||||||
return SysPostConvert.INSTANCE.convertList(entityList);
|
return SysPostConvert.INSTANCE.convertList(entityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryWrapper<SysPostEntity> getWrapper(SysPostQuery query){
|
private Wrapper<SysPostEntity> getWrapper(SysPostQuery query){
|
||||||
QueryWrapper<SysPostEntity> wrapper = new QueryWrapper<>();
|
LambdaQueryWrapper<SysPostEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.like(StrUtil.isNotBlank(query.getPostCode()), "post_code", query.getPostCode());
|
wrapper.like(StrUtil.isNotBlank(query.getPostCode()), SysPostEntity::getPostCode, query.getPostCode());
|
||||||
wrapper.like(StrUtil.isNotBlank(query.getPostName()), "post_name", query.getPostName());
|
wrapper.like(StrUtil.isNotBlank(query.getPostName()), SysPostEntity::getPostName, query.getPostName());
|
||||||
wrapper.eq(query.getStatus() != null, "status", query.getStatus());
|
wrapper.eq(query.getStatus() != null, SysPostEntity::getStatus, query.getStatus());
|
||||||
wrapper.orderByAsc("sort");
|
wrapper.orderByAsc(SysPostEntity::getSort);
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
||||||
import net.maku.system.dao.SysRoleDataScopeDao;
|
import net.maku.system.dao.SysRoleDataScopeDao;
|
||||||
import net.maku.system.entity.SysRoleDataScopeEntity;
|
import net.maku.system.entity.SysRoleDataScopeEntity;
|
||||||
|
@ -45,7 +45,11 @@ public class SysRoleDataScopeServiceImpl extends BaseServiceImpl<SysRoleDataScop
|
||||||
// 需要删除的机构ID
|
// 需要删除的机构ID
|
||||||
Collection<Long> deleteOrgIdList = CollUtil.subtract(dbOrgIdList, orgIdList);
|
Collection<Long> deleteOrgIdList = CollUtil.subtract(dbOrgIdList, orgIdList);
|
||||||
if (CollUtil.isNotEmpty(deleteOrgIdList)){
|
if (CollUtil.isNotEmpty(deleteOrgIdList)){
|
||||||
remove(new QueryWrapper<SysRoleDataScopeEntity>().eq("role_id", roleId).in("org_id", deleteOrgIdList));
|
LambdaQueryWrapper<SysRoleDataScopeEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysRoleDataScopeEntity::getRoleId, roleId);
|
||||||
|
queryWrapper.in(SysRoleDataScopeEntity::getOrgId, deleteOrgIdList);
|
||||||
|
|
||||||
|
remove(queryWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +60,6 @@ public class SysRoleDataScopeServiceImpl extends BaseServiceImpl<SysRoleDataScop
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByRoleIdList(List<Long> roleIdList) {
|
public void deleteByRoleIdList(List<Long> roleIdList) {
|
||||||
remove(new QueryWrapper<SysRoleDataScopeEntity>().in("role_id", roleIdList));
|
remove(new LambdaQueryWrapper<SysRoleDataScopeEntity>().in(SysRoleDataScopeEntity::getRoleId, roleIdList));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
||||||
import net.maku.system.dao.SysRoleMenuDao;
|
import net.maku.system.dao.SysRoleMenuDao;
|
||||||
import net.maku.system.entity.SysRoleMenuEntity;
|
import net.maku.system.entity.SysRoleMenuEntity;
|
||||||
|
@ -45,7 +45,8 @@ public class SysRoleMenuServiceImpl extends BaseServiceImpl<SysRoleMenuDao, SysR
|
||||||
// 需要删除的菜单ID
|
// 需要删除的菜单ID
|
||||||
Collection<Long> deleteMenuIdList = CollUtil.subtract(dbMenuIdList, menuIdList);
|
Collection<Long> deleteMenuIdList = CollUtil.subtract(dbMenuIdList, menuIdList);
|
||||||
if (CollUtil.isNotEmpty(deleteMenuIdList)){
|
if (CollUtil.isNotEmpty(deleteMenuIdList)){
|
||||||
remove(new QueryWrapper<SysRoleMenuEntity>().eq("role_id", roleId).in("menu_id", deleteMenuIdList));
|
LambdaQueryWrapper<SysRoleMenuEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
remove(queryWrapper.eq(SysRoleMenuEntity::getRoleId, roleId).in(SysRoleMenuEntity::getMenuId, deleteMenuIdList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,13 +58,13 @@ public class SysRoleMenuServiceImpl extends BaseServiceImpl<SysRoleMenuDao, SysR
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteByRoleIdList(List<Long> roleIdList) {
|
public void deleteByRoleIdList(List<Long> roleIdList) {
|
||||||
remove(new QueryWrapper<SysRoleMenuEntity>().in("role_id", roleIdList));
|
remove(new LambdaQueryWrapper<SysRoleMenuEntity>().in(SysRoleMenuEntity::getRoleId, roleIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteByMenuId(Long menuId) {
|
public void deleteByMenuId(Long menuId) {
|
||||||
remove(new QueryWrapper<SysRoleMenuEntity>().eq("menu_id", menuId));
|
remove(new LambdaQueryWrapper<SysRoleMenuEntity>().eq(SysRoleMenuEntity::getMenuId, menuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.maku.framework.common.page.PageResult;
|
import net.maku.framework.common.page.PageResult;
|
||||||
|
@ -10,11 +11,11 @@ import net.maku.system.convert.SysRoleConvert;
|
||||||
import net.maku.system.dao.SysRoleDao;
|
import net.maku.system.dao.SysRoleDao;
|
||||||
import net.maku.system.entity.SysRoleEntity;
|
import net.maku.system.entity.SysRoleEntity;
|
||||||
import net.maku.system.enums.DataScopeEnum;
|
import net.maku.system.enums.DataScopeEnum;
|
||||||
|
import net.maku.system.query.SysRoleQuery;
|
||||||
import net.maku.system.service.SysRoleDataScopeService;
|
import net.maku.system.service.SysRoleDataScopeService;
|
||||||
import net.maku.system.service.SysRoleMenuService;
|
import net.maku.system.service.SysRoleMenuService;
|
||||||
import net.maku.system.service.SysRoleService;
|
import net.maku.system.service.SysRoleService;
|
||||||
import net.maku.system.service.SysUserRoleService;
|
import net.maku.system.service.SysUserRoleService;
|
||||||
import net.maku.system.query.SysRoleQuery;
|
|
||||||
import net.maku.system.vo.SysRoleDataScopeVO;
|
import net.maku.system.vo.SysRoleDataScopeVO;
|
||||||
import net.maku.system.vo.SysRoleVO;
|
import net.maku.system.vo.SysRoleVO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -49,9 +50,9 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleDao, SysRoleEntit
|
||||||
return SysRoleConvert.INSTANCE.convertList(entityList);
|
return SysRoleConvert.INSTANCE.convertList(entityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryWrapper<SysRoleEntity> getWrapper(SysRoleQuery query){
|
private Wrapper<SysRoleEntity> getWrapper(SysRoleQuery query){
|
||||||
QueryWrapper<SysRoleEntity> wrapper = new QueryWrapper<>();
|
LambdaQueryWrapper<SysRoleEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.like(StrUtil.isNotBlank(query.getName()), "name", query.getName());
|
wrapper.like(StrUtil.isNotBlank(query.getName()), SysRoleEntity::getName, query.getName());
|
||||||
|
|
||||||
// 数据权限
|
// 数据权限
|
||||||
dataScopeWrapper(wrapper);
|
dataScopeWrapper(wrapper);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
||||||
import net.maku.system.dao.SysUserPostDao;
|
import net.maku.system.dao.SysUserPostDao;
|
||||||
import net.maku.system.entity.SysUserPostEntity;
|
import net.maku.system.entity.SysUserPostEntity;
|
||||||
|
@ -42,18 +42,19 @@ public class SysUserPostServiceImpl extends BaseServiceImpl<SysUserPostDao, SysU
|
||||||
// 需要删除的岗位ID
|
// 需要删除的岗位ID
|
||||||
Collection<Long> deletePostIdList = CollUtil.subtract(dbPostIdList, postIdList);
|
Collection<Long> deletePostIdList = CollUtil.subtract(dbPostIdList, postIdList);
|
||||||
if (CollUtil.isNotEmpty(deletePostIdList)){
|
if (CollUtil.isNotEmpty(deletePostIdList)){
|
||||||
remove(new QueryWrapper<SysUserPostEntity>().eq("user_id", userId).in("post_id", deletePostIdList));
|
LambdaQueryWrapper<SysUserPostEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
remove(queryWrapper.eq(SysUserPostEntity::getUserId, userId).in(SysUserPostEntity::getPostId, deletePostIdList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByPostIdList(List<Long> postIdList) {
|
public void deleteByPostIdList(List<Long> postIdList) {
|
||||||
remove(new QueryWrapper<SysUserPostEntity>().in("post_id", postIdList));
|
remove(new LambdaQueryWrapper<SysUserPostEntity>().in(SysUserPostEntity::getPostId, postIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByUserIdList(List<Long> userIdList) {
|
public void deleteByUserIdList(List<Long> userIdList) {
|
||||||
remove(new QueryWrapper<SysUserPostEntity>().in("user_id", userIdList));
|
remove(new LambdaQueryWrapper<SysUserPostEntity>().in(SysUserPostEntity::getUserId, userIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package net.maku.system.service.impl;
|
package net.maku.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
import net.maku.framework.common.service.impl.BaseServiceImpl;
|
||||||
import net.maku.system.dao.SysUserRoleDao;
|
import net.maku.system.dao.SysUserRoleDao;
|
||||||
import net.maku.system.entity.SysUserRoleEntity;
|
import net.maku.system.entity.SysUserRoleEntity;
|
||||||
|
@ -42,7 +42,8 @@ public class SysUserRoleServiceImpl extends BaseServiceImpl<SysUserRoleDao, SysU
|
||||||
// 需要删除的角色ID
|
// 需要删除的角色ID
|
||||||
Collection<Long> deleteRoleIdList = CollUtil.subtract(dbRoleIdList, roleIdList);
|
Collection<Long> deleteRoleIdList = CollUtil.subtract(dbRoleIdList, roleIdList);
|
||||||
if (CollUtil.isNotEmpty(deleteRoleIdList)){
|
if (CollUtil.isNotEmpty(deleteRoleIdList)){
|
||||||
remove(new QueryWrapper<SysUserRoleEntity>().eq("user_id", userId).in("role_id", deleteRoleIdList));
|
LambdaQueryWrapper<SysUserRoleEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
remove(queryWrapper.eq(SysUserRoleEntity::getUserId, userId).in(SysUserRoleEntity::getRoleId, deleteRoleIdList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,17 +62,18 @@ public class SysUserRoleServiceImpl extends BaseServiceImpl<SysUserRoleDao, SysU
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByRoleIdList(List<Long> roleIdList) {
|
public void deleteByRoleIdList(List<Long> roleIdList) {
|
||||||
remove(new QueryWrapper<SysUserRoleEntity>().in("role_id", roleIdList));
|
remove(new LambdaQueryWrapper<SysUserRoleEntity>().in(SysUserRoleEntity::getRoleId, roleIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByUserIdList(List<Long> userIdList) {
|
public void deleteByUserIdList(List<Long> userIdList) {
|
||||||
remove(new QueryWrapper<SysUserRoleEntity>().in("user_id", userIdList));
|
remove(new LambdaQueryWrapper<SysUserRoleEntity>().in(SysUserRoleEntity::getUserId, userIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByUserIdList(Long roleId, List<Long> userIdList) {
|
public void deleteByUserIdList(Long roleId, List<Long> userIdList) {
|
||||||
remove(new QueryWrapper<SysUserRoleEntity>().eq("role_id", roleId).in("user_id", userIdList));
|
LambdaQueryWrapper<SysUserRoleEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
remove(queryWrapper.eq(SysUserRoleEntity::getRoleId, roleId).in(SysUserRoleEntity::getUserId, userIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user