From f1208474f771a1c233d7425c8ed13fbaa0d521ac Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期三, 12 三月 2025 09:35:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/5.X' into 5.X --- ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysClientServiceImpl.java | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysClientServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysClientServiceImpl.java index c635675..4f6e676 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysClientServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysClientServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.constant.CacheNames; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.PageQuery; @@ -16,11 +17,12 @@ import org.dromara.system.domain.vo.SysClientVo; import org.dromara.system.mapper.SysClientMapper; import org.dromara.system.service.ISysClientService; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.List; -import java.util.Map; /** * 瀹㈡埛绔鐞哠ervice涓氬姟灞傚鐞� @@ -49,9 +51,10 @@ /** * 鏌ヨ瀹㈡埛绔鐞� */ + @Cacheable(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId") @Override - public SysClient queryByClientId(String clientId) { - return baseMapper.selectOne(new LambdaQueryWrapper<SysClient>().eq(SysClient::getClientId, clientId)); + public SysClientVo queryByClientId(String clientId) { + return baseMapper.selectVoOne(new LambdaQueryWrapper<SysClient>().eq(SysClient::getClientId, clientId)); } /** @@ -75,12 +78,12 @@ } private LambdaQueryWrapper<SysClient> buildQueryWrapper(SysClientBo bo) { - Map<String, Object> params = bo.getParams(); LambdaQueryWrapper<SysClient> lqw = Wrappers.lambdaQuery(); lqw.eq(StringUtils.isNotBlank(bo.getClientId()), SysClient::getClientId, bo.getClientId()); lqw.eq(StringUtils.isNotBlank(bo.getClientKey()), SysClient::getClientKey, bo.getClientKey()); lqw.eq(StringUtils.isNotBlank(bo.getClientSecret()), SysClient::getClientSecret, bo.getClientSecret()); lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysClient::getStatus, bo.getStatus()); + lqw.orderByAsc(SysClient::getId); return lqw; } @@ -106,22 +109,25 @@ /** * 淇敼瀹㈡埛绔鐞� */ + @CacheEvict(cacheNames = CacheNames.SYS_CLIENT, key = "#bo.clientId") @Override public Boolean updateByBo(SysClientBo bo) { SysClient update = MapstructUtils.convert(bo, SysClient.class); validEntityBeforeSave(update); + update.setGrantType(String.join(",", bo.getGrantTypeList())); return baseMapper.updateById(update) > 0; } /** * 淇敼鐘舵�� */ + @CacheEvict(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId") @Override - public int updateUserStatus(Long id, String status) { + public int updateClientStatus(String clientId, String status) { return baseMapper.update(null, new LambdaUpdateWrapper<SysClient>() .set(SysClient::getStatus, status) - .eq(SysClient::getId, id)); + .eq(SysClient::getClientId, clientId)); } /** @@ -134,11 +140,12 @@ /** * 鎵归噺鍒犻櫎瀹㈡埛绔鐞� */ + @CacheEvict(cacheNames = CacheNames.SYS_CLIENT, allEntries = true) @Override public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { if (isValid) { //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� } - return baseMapper.deleteBatchIds(ids) > 0; + return baseMapper.deleteByIds(ids) > 0; } } -- Gitblit v1.9.3