From 6722f2eeed0436f947c7de10578b83a6e785feeb Mon Sep 17 00:00:00 2001 From: AprilWind <2100166581@qq.com> Date: Fri, 27 Jun 2025 01:07:11 +0000 Subject: [PATCH] =?UTF-8?q?!703=20update=20=E4=BC=98=E5=8C=96=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E7=AE=A1=E7=90=86=20*=20update=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SysClientServiceImpl.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 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 4f6e676df..2b995beec 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 @@ -1,5 +1,6 @@ package org.dromara.system.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.crypto.SecureUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -43,11 +44,10 @@ public class SysClientServiceImpl implements ISysClientService { @Override public SysClientVo queryById(Long id) { SysClientVo vo = baseMapper.selectVoById(id); - vo.setGrantTypeList(List.of(vo.getGrantType().split(","))); + vo.setGrantTypeList(StringUtils.splitList(vo.getGrantType())); return vo; } - /** * 查询客户端管理 */ @@ -64,7 +64,7 @@ public class SysClientServiceImpl implements ISysClientService { public TableDataInfo queryPageList(SysClientBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - result.getRecords().forEach(r -> r.setGrantTypeList(List.of(r.getGrantType().split(",")))); + result.getRecords().forEach(r -> r.setGrantTypeList(StringUtils.splitList(r.getGrantType()))); return TableDataInfo.build(result); } @@ -93,8 +93,7 @@ public class SysClientServiceImpl implements ISysClientService { @Override public Boolean insertByBo(SysClientBo bo) { SysClient add = MapstructUtils.convert(bo, SysClient.class); - validEntityBeforeSave(add); - add.setGrantType(String.join(",", bo.getGrantTypeList())); + add.setGrantType(CollUtil.join(bo.getGrantTypeList(), StringUtils.SEPARATOR)); // 生成clientid String clientKey = bo.getClientKey(); String clientSecret = bo.getClientSecret(); @@ -113,7 +112,6 @@ public class SysClientServiceImpl implements ISysClientService { @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; } @@ -130,22 +128,12 @@ public class SysClientServiceImpl implements ISysClientService { .eq(SysClient::getClientId, clientId)); } - /** - * 保存前的数据校验 - */ - private void validEntityBeforeSave(SysClient entity) { - //TODO 做一些数据校验,如唯一约束 - } - /** * 批量删除客户端管理 */ @CacheEvict(cacheNames = CacheNames.SYS_CLIENT, allEntries = true) @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if (isValid) { - //TODO 做一些业务上的校验,判断是否需要校验 - } return baseMapper.deleteByIds(ids) > 0; } }