Compare commits
3 Commits
432feb11d2
...
1b81782767
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b81782767 | |||
| c4ea4650bf | |||
|
|
0cc088c51b |
@@ -120,6 +120,11 @@
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-sms</artifactId> <!-- 短信(腾讯云) -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.4.11</version> <!-- 请查看最新版本 -->
|
||||
</dependency>
|
||||
|
||||
<!-- 低代码 -->
|
||||
<dependency>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.lideeyunji.service.system.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
||||
import com.lideeyunji.service.system.entity.DictDataDO;
|
||||
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OAuth2ClientJoinMapper extends MPJBaseMapper<OAuth2ClientDO> {
|
||||
|
||||
/**
|
||||
* 分页查询(关联字典表)
|
||||
*/
|
||||
default PageResult<OAuth2ClientDO> selectPage(OAuth2ClientPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<OAuth2ClientDO> wrapper = buildQueryWrapper(reqVO);
|
||||
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<OAuth2ClientDO> page =
|
||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(
|
||||
reqVO.getPageNo(),
|
||||
reqVO.getPageSize()
|
||||
);
|
||||
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<OAuth2ClientDO> resultPage =
|
||||
selectJoinPage(page, OAuth2ClientDO.class, wrapper);
|
||||
|
||||
return new PageResult<>(resultPage.getRecords(), resultPage.getTotal());
|
||||
}
|
||||
|
||||
|
||||
default MPJLambdaWrapper<OAuth2ClientDO> buildQueryWrapper(OAuth2ClientPageReqVO reqVO) {
|
||||
MPJLambdaWrapper<OAuth2ClientDO> wrapper = new MPJLambdaWrapper<OAuth2ClientDO>()
|
||||
.selectAll(OAuth2ClientDO.class)
|
||||
.leftJoin(DictDataDO.class, on -> on
|
||||
.eq(DictDataDO::getValue, OAuth2ClientDO::getCategory)
|
||||
.eq(DictDataDO::getDictType, "app_category"));
|
||||
|
||||
applyQueryConditions(wrapper, reqVO);
|
||||
|
||||
wrapper.orderByAsc(DictDataDO::getSort)
|
||||
.orderByDesc(OAuth2ClientDO::getId);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
default void applyQueryConditions(MPJLambdaWrapper<OAuth2ClientDO> wrapper, OAuth2ClientPageReqVO reqVO) {
|
||||
if (reqVO.getName() != null && !reqVO.getName().isEmpty()) {
|
||||
wrapper.like(OAuth2ClientDO::getName, reqVO.getName());
|
||||
}
|
||||
if (reqVO.getStatus() != null) {
|
||||
wrapper.eq(OAuth2ClientDO::getStatus, reqVO.getStatus());
|
||||
}
|
||||
if (reqVO.getIds() != null && !reqVO.getIds().isEmpty()) {
|
||||
wrapper.in(OAuth2ClientDO::getId, reqVO.getIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,24 @@
|
||||
package com.lideeyunji.service.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.stream.CollectorUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.lideeyunji.service.system.entity.AdminUserDO;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
|
||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientSaveReqVO;
|
||||
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||
import com.lideeyunji.service.system.entity.UserRoleDO;
|
||||
import com.lideeyunji.service.system.mapper.OAuth2ClientJoinMapper;
|
||||
import com.lideeyunji.service.system.mapper.OAuth2ClientMapper;
|
||||
import com.lideeyunji.service.system.service.IAdminUserService;
|
||||
import com.lideeyunji.service.system.service.IClientPermissionService;
|
||||
import com.lideeyunji.service.system.service.IOAuth2ClientService;
|
||||
import com.lideeyunji.service.system.service.IPermissionService;
|
||||
import com.lideeyunji.tool.framework.common.enums.CommonStatusEnum;
|
||||
import com.lideeyunji.tool.framework.common.pojo.PageResult;
|
||||
import com.lideeyunji.tool.framework.common.util.object.BeanUtils;
|
||||
import com.lideeyunji.tool.framework.common.util.string.StrUtils;
|
||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientPageReqVO;
|
||||
import com.lideeyunji.service.system.controller.vo.oauth2.client.OAuth2ClientSaveReqVO;
|
||||
import com.lideeyunji.service.system.entity.OAuth2ClientDO;
|
||||
import com.lideeyunji.service.system.mapper.OAuth2ClientMapper;
|
||||
import com.lideeyunji.service.system.config.redis.RedisKeyConstants;
|
||||
import com.lideeyunji.service.system.service.IOAuth2ClientService;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.lideeyunji.tool.framework.security.core.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -35,10 +33,9 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.lideeyunji.tool.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.lideeyunji.service.system.constant.ErrorCodeConstants.*;
|
||||
import static com.lideeyunji.tool.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils.*;
|
||||
import static com.lideeyunji.tool.framework.security.core.util.SecurityFrameworkUtils.getLoginRoleId;
|
||||
|
||||
/**
|
||||
* OAuth2.0 Client Service 实现类
|
||||
@@ -53,6 +50,9 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
|
||||
@Resource
|
||||
private OAuth2ClientMapper oauth2ClientMapper;
|
||||
|
||||
@Resource
|
||||
private OAuth2ClientJoinMapper oAuth2ClientJoinMapper;
|
||||
|
||||
@Resource
|
||||
private IClientPermissionService clientPermissionService;
|
||||
@Resource
|
||||
@@ -163,7 +163,7 @@ public class OAuth2ClientServiceImpl implements IOAuth2ClientService {
|
||||
Set<Long> clientIds = clientPermissionService.getRoleClientListByRoleId(roleIds);
|
||||
pageReqVO.setIds(clientIds);
|
||||
}
|
||||
return oauth2ClientMapper.selectPage(pageReqVO);
|
||||
return oAuth2ClientJoinMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user