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){