From aac83bbb91a43c91008ee6636fc37ca418ec4a71 Mon Sep 17 00:00:00 2001
From: AprilWind <2100166581@qq.com>
Date: 星期一, 22 七月 2024 17:06:46 +0800
Subject: [PATCH] update 获取表元数据 字段是否必填 和 是否自增
---
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysClientServiceImpl.java | 20 +++++++++++++-------
1 files changed, 13 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 0670bc1..1c69243 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,6 +109,7 @@
/**
* 淇敼瀹㈡埛绔鐞�
*/
+ @CacheEvict(cacheNames = CacheNames.SYS_CLIENT, key = "#bo.clientId")
@Override
public Boolean updateByBo(SysClientBo bo) {
SysClient update = MapstructUtils.convert(bo, SysClient.class);
@@ -117,12 +121,13 @@
/**
* 淇敼鐘舵��
*/
+ @CacheEvict(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId")
@Override
- public int updateUserStatus(Long id, String status) {
+ public int updateUserStatus(String clientId, String status) {
return baseMapper.update(null,
new LambdaUpdateWrapper<SysClient>()
.set(SysClient::getStatus, status)
- .eq(SysClient::getId, id));
+ .eq(SysClient::getClientId, clientId));
}
/**
@@ -135,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