From c18565cf21eb4617a503c1a0e1e570a4c0578969 Mon Sep 17 00:00:00 2001
From: tiger_zhou <123456>
Date: Wed, 7 Dec 2022 10:31:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=B8=8D=E8=B0=83=E7=94=A8?=
=?UTF-8?q?=20mapFunction=20=E7=94=9F=E6=88=90=E6=8E=A5=E5=8F=A3=EF=BC=8C?=
=?UTF-8?q?=E8=B0=83=E6=95=B4=E6=95=B0=E6=8D=AE=E6=B7=BB=E5=8A=A0=E9=80=9F?=
=?UTF-8?q?=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../rtss/dao/permission/RtsDistributeDAO.java | 11 +++++++++++
.../RtsPermissionDistributeRefDAO.java | 12 ++++++++++++
.../OldPermissionDataSyncService.java | 19 +++++++++++++++----
3 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/src/main/java/club/joylink/rtss/dao/permission/RtsDistributeDAO.java b/src/main/java/club/joylink/rtss/dao/permission/RtsDistributeDAO.java
index 74e1882c7..f9b7d0e2c 100644
--- a/src/main/java/club/joylink/rtss/dao/permission/RtsDistributeDAO.java
+++ b/src/main/java/club/joylink/rtss/dao/permission/RtsDistributeDAO.java
@@ -35,6 +35,17 @@ public interface RtsDistributeDAO {
" #{record.dsc,jdbcType=VARCHAR},#{record.isSync,jdbcType=BIT})")
void customerSyncInsert(@Param("record") RtsDistribute record);
+ @Insert("")
+ void customerSyncBatchInsert(@Param("list") List record);
/**
* 状态参考 {@link PermissionDistributeStatusEnum}
*/
diff --git a/src/main/java/club/joylink/rtss/dao/permission/RtsPermissionDistributeRefDAO.java b/src/main/java/club/joylink/rtss/dao/permission/RtsPermissionDistributeRefDAO.java
index 4c89dcae7..b27490028 100644
--- a/src/main/java/club/joylink/rtss/dao/permission/RtsPermissionDistributeRefDAO.java
+++ b/src/main/java/club/joylink/rtss/dao/permission/RtsPermissionDistributeRefDAO.java
@@ -5,6 +5,7 @@ import club.joylink.rtss.entity.permission.RtsPermissionDistributeRefExample;
import java.util.List;
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
+import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@@ -25,6 +26,17 @@ public interface RtsPermissionDistributeRefDAO {
" where 1 = 1 and A.distribute_id = #{disId}" +
"")
List selectTimeOut();
+
+ @Insert("")
+ void batchInsert(@Param("list") List refList);
+
long countByExample(RtsPermissionDistributeRefExample example);
int deleteByExample(RtsPermissionDistributeRefExample example);
diff --git a/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java b/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java
index 3ab698a24..2b31ca7c3 100644
--- a/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java
+++ b/src/main/java/club/joylink/rtss/services/permission/OldPermissionDataSyncService.java
@@ -98,12 +98,12 @@ public class OldPermissionDataSyncService {
SYNC_RESULT_LIST.clear();
try{
truncateAllTable();
- MapInfoExample example = new MapInfoExample();
+ /*MapInfoExample example = new MapInfoExample();
example.createCriteria().andStatusEqualTo("1" );
List mapInfoList = this.mapInfoDAO.selectByExample(example);
for (MapInfo mapInfo : mapInfoList) {
this.generate(mapInfo);
- }
+ }*/
this.abilityService.autoSynchMapSystemData(0L);
}catch (Exception e){
log.error("用户权限初始化失败 msg:" + e.getMessage(),e);
@@ -210,15 +210,26 @@ public class OldPermissionDataSyncService {
}
private void insertDistribute(List distributeDataVOList){
+ List allRefList = Lists.newArrayList();
+ List disList = Lists.newArrayList();
+
for (DistributeDataVO dataVO : distributeDataVOList) {
RtsDistribute rd = PermissionDistributeConvertor.convertDistributeDataVoTo(dataVO,dataVO.getCreatorId());
rd.setIsSync(true);
- this.rtsDistributeDAO.customerSyncInsert(rd);
+ disList.add(rd);
List refList = PermissionDistributeConvertor.convertDistributeRefListTo(dataVO.getPermissionIds(),null);
+
for (RtsPermissionDistributeRef ref : refList) {
ref.setIsSync(true);
- this.distributeRefDAO.insert(ref);
+ allRefList.add(ref);
}
+
+ }
+ if(!CollectionUtils.isEmpty(disList)){
+ rtsDistributeDAO.customerSyncBatchInsert(disList);
+ }
+ if(!CollectionUtils.isEmpty(allRefList)){
+ distributeRefDAO.batchInsert(allRefList);
}
}
private void insertUserPermission(List psList){