diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 2b8e647d0..000000000
--- a/pom.xml
+++ /dev/null
@@ -1,165 +0,0 @@
-
-
- 4.0.0
- cn.iocoder.cloud
- yudao
- ${revision}
- pom
-
- yudao-dependencies
- yudao-gateway
- yudao-framework
-
- yudao-module-system
- yudao-module-infra
- yudao-module-member
- yudao-module-bpm
- yudao-module-pay
- yudao-module-report
- yudao-module-mp
- yudao-module-mall
- yudao-module-crm
- yudao-module-erp
- yudao-module-ai
-
-
- ${project.artifactId}
- 芋道项目基础脚手架
- https://github.com/YunaiV/ruoyi-vue-pro
-
-
- 2.2.0-snapshot
-
- 17
- ${java.version}
- ${java.version}
- 3.2.2
- 3.13.0
- 1.6.0
-
- 1.18.34
- 3.3.1
- 1.5.5.Final
- UTF-8
-
-
-
-
-
- cn.iocoder.cloud
- yudao-dependencies
- ${revision}
- pom
- import
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire-plugin.version}
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
-
-
- org.springframework.boot
- spring-boot-configuration-processor
- ${spring.boot.version}
-
-
- org.projectlombok
- lombok
- ${lombok.version}
-
-
- org.mapstruct
- mapstruct-processor
- ${mapstruct.version}
-
-
-
- false
-
- -parameters
-
-
-
-
-
-
-
-
-
- org.codehaus.mojo
- flatten-maven-plugin
- ${flatten-maven-plugin.version}
-
- resolveCiFriendliesOnly
- true
-
-
-
-
- flatten
-
- flatten
- process-resources
-
-
-
- clean
-
- flatten.clean
- clean
-
-
-
-
-
-
-
-
-
- huaweicloud
- huawei
- https://mirrors.huaweicloud.com/repository/maven/
-
-
- aliyunmaven
- aliyun
- https://maven.aliyun.com/repository/public
-
-
-
- spring-milestones
- Spring Milestones
- https://repo.spring.io/milestone
-
- false
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/snapshot
-
- false
-
-
-
-
-
diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml
index 5ca619768..600c140f1 100644
--- a/yudao-module-system/yudao-module-system-biz/pom.xml
+++ b/yudao-module-system/yudao-module-system-biz/pom.xml
@@ -152,6 +152,13 @@
hutool-extra
+
+
+ org.apache.shardingsphere
+ shardingsphere-jdbc-core-spring-boot-starter
+ 5.2.1
+
+
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java
index 14e308b56..56d149bc4 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java
@@ -6,9 +6,11 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogPageReqDTO;
import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO;
+import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;
@Mapper
+@DS("sharding")
public interface OperateLogMapper extends BaseMapperX {
default PageResult selectPage(OperateLogPageReqVO pageReqDTO) {
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/sharding/DataPreciseShardingAlgorithm.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/sharding/DataPreciseShardingAlgorithm.java
new file mode 100644
index 000000000..339523701
--- /dev/null
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/sharding/DataPreciseShardingAlgorithm.java
@@ -0,0 +1,90 @@
+package cn.iocoder.yudao.module.system.framework.sharding;
+
+import cn.hutool.core.date.DateUtil;
+import cn.iocoder.yudao.framework.common.exception.ServiceException;
+import com.google.common.collect.Range;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
+import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
+import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @Description
+ * 目前分页查询是有点问题,不过我项目里没有用到没有研究那块,貌似是selectPage会执行mp的查询count,会报错
+ *
+ * @Date 2024/6/13 10:07
+ * @Author tom
+ **/
+@Getter
+@Slf4j
+public class DataPreciseShardingAlgorithm implements StandardShardingAlgorithm {
+
+ @Override
+ public Collection doSharding(Collection collection, RangeShardingValue rangeShardingValue) {
+ Range valueRange = rangeShardingValue.getValueRange();
+ LocalDateTime lowerEndpoint = valueRange.lowerEndpoint();
+ LocalDateTime upperEndpoint = valueRange.upperEndpoint();
+
+ // 逻辑表名
+ String logicTableName = rangeShardingValue.getLogicTableName();
+ List tables = new ArrayList<>();
+
+ LocalDateTime now = LocalDateTime.now();
+ if (upperEndpoint.getYear() > now.getYear() || upperEndpoint.getMonthValue() > now.getMonthValue()) {
+ log.warn("时间区间异常 不能查询未来数据 {} {}",lowerEndpoint,upperEndpoint);
+ throw new ServiceException(40001,"不能查询未来数据");
+ }
+ while (lowerEndpoint.compareTo(upperEndpoint) <= 0) {
+ // 添加到集合
+ tables.add(buildTable(logicTableName, lowerEndpoint));
+ // 往后加一个月
+ lowerEndpoint = lowerEndpoint.plusMonths(1).withDayOfMonth(1);
+ }
+ return tables;
+ }
+
+ private String buildTable(String logicTableName, LocalDateTime startTime) {
+ String timeStr = DateUtil.formatLocalDateTime(startTime);
+ String year = timeStr.substring(2, 4);
+ String month = timeStr.substring(5, 7);
+
+ return logicTableName + "_" + year + month;
+ }
+
+ @Override
+ public String doSharding(Collection collection, PreciseShardingValue preciseShardingValue) {
+ String timeStr = DateUtil.formatLocalDateTime(preciseShardingValue.getValue());
+ String year = timeStr.substring(2, 4);
+ String month = timeStr.substring(5, 7);
+ String tableSuffix = year + month;
+ for (String s : collection) {
+ if (s.contains(tableSuffix)){
+ return s;
+ }
+ }
+ return null;
+ }
+
+
+ @Override
+ public Properties getProps() {
+ return null;
+ }
+
+ @Override
+ public void init(Properties properties) {
+
+ }
+
+ @Override
+ public String getType() {
+ return "HIS_DATA_SPI_BASED";
+ }
+}
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/sharding/MyDataSourceConfiguration.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/sharding/MyDataSourceConfiguration.java
new file mode 100644
index 000000000..b7b29f2d3
--- /dev/null
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/sharding/MyDataSourceConfiguration.java
@@ -0,0 +1,73 @@
+package cn.iocoder.yudao.module.system.framework.sharding;
+
+import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
+import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
+import com.baomidou.dynamic.datasource.provider.AbstractDataSourceProvider;
+import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
+import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
+import jakarta.annotation.Resource;
+import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+import javax.sql.DataSource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+public class MyDataSourceConfiguration {
+
+ @Resource
+ private DynamicDataSourceProperties properties;
+
+ /**
+ * 分片: shardingDataSource
+ * 主从: masterSlaveDataSource
+ * 根据自己场景修改注入
+ */
+// @Lazy
+// @Resource
+// private MasterSlaveDataSource masterSlaveDataSource;
+
+// @Lazy
+ @Resource
+ private ShardingSphereDataSource shardingSphereDataSource;
+
+ @Bean
+ public DynamicDataSourceProvider dynamicDataSourceProvider(DefaultDataSourceCreator dataSourceCreator) {
+ return new AbstractDataSourceProvider(dataSourceCreator) {
+
+ @Override
+ public Map loadDataSources() {
+ Map dataSourceMap = new HashMap<>();
+ dataSourceMap.put("sharding", shardingSphereDataSource);
+//下面的代码可以把 shardingJdbc 内部管理的子数据源也同时添加到动态数据源里 (根据自己需要选择开启+注解了@Lazy被代理了不可以)
+// Map shardingInnerDataSources = shardingSphereDataSource();
+// dataSourceMap.putAll(shardingInnerDataSources);
+ return dataSourceMap;
+ }
+ };
+ }
+
+ /**
+ * 将动态数据源设置为首选的
+ * 当spring存在多个数据源时, 自动注入的是首选的对象
+ * 设置为主要的数据源之后,就可以支持shardingjdbc原生的配置方式了
+ * 3.4.0版本及以上使用以下方式注入,老版本请阅读文档 进阶-手动注入多数据源
+ */
+ @Primary
+ @Bean
+ public DataSource dataSource(List providers) {
+ DynamicRoutingDataSource dataSource = new DynamicRoutingDataSource(providers);
+ dataSource.setPrimary(properties.getPrimary());
+ dataSource.setStrict(properties.getStrict());
+ dataSource.setStrategy(properties.getStrategy());
+ dataSource.setSeata(properties.getSeata());
+ dataSource.setP6spy(properties.getP6spy());
+ dataSource.setSeata(properties.getSeata());
+ return dataSource;
+ }
+
+}
\ No newline at end of file
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/org/yaml/snakeyaml/representer/Representer.java b/yudao-module-system/yudao-module-system-biz/src/main/java/org/yaml/snakeyaml/representer/Representer.java
new file mode 100644
index 000000000..104c6096d
--- /dev/null
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/org/yaml/snakeyaml/representer/Representer.java
@@ -0,0 +1,206 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package org.yaml.snakeyaml.representer;
+
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.DumperOptions.FlowStyle;
+import org.yaml.snakeyaml.TypeDescription;
+import org.yaml.snakeyaml.introspector.Property;
+import org.yaml.snakeyaml.introspector.PropertyUtils;
+import org.yaml.snakeyaml.nodes.*;
+
+import java.util.*;
+
+public class Representer extends SafeRepresenter {
+ protected Map, TypeDescription> typeDefinitions = Collections.emptyMap();
+
+
+ public Representer() {
+ super(new DumperOptions());
+ this.representers.put(null, new RepresentJavaBean());
+ }
+
+ public Representer(DumperOptions options) {
+ super(options);
+ this.representers.put(null, new RepresentJavaBean());
+ }
+
+ public TypeDescription addTypeDescription(TypeDescription td) {
+ if (Collections.EMPTY_MAP == this.typeDefinitions) {
+ this.typeDefinitions = new HashMap();
+ }
+
+ if (td.getTag() != null) {
+ this.addClassTag(td.getType(), td.getTag());
+ }
+
+ td.setPropertyUtils(this.getPropertyUtils());
+ return (TypeDescription)this.typeDefinitions.put(td.getType(), td);
+ }
+
+ public void setPropertyUtils(PropertyUtils propertyUtils) {
+ super.setPropertyUtils(propertyUtils);
+ Collection tds = this.typeDefinitions.values();
+ Iterator var3 = tds.iterator();
+
+ while(var3.hasNext()) {
+ TypeDescription typeDescription = (TypeDescription)var3.next();
+ typeDescription.setPropertyUtils(propertyUtils);
+ }
+
+ }
+
+ protected MappingNode representJavaBean(Set properties, Object javaBean) {
+ List value = new ArrayList(properties.size());
+ Tag customTag = (Tag)this.classTags.get(javaBean.getClass());
+ Tag tag = customTag != null ? customTag : new Tag(javaBean.getClass());
+ MappingNode node = new MappingNode(tag, value, FlowStyle.AUTO);
+ this.representedObjects.put(javaBean, node);
+ FlowStyle bestStyle = FlowStyle.FLOW;
+ Iterator var8 = properties.iterator();
+
+ while(true) {
+ NodeTuple tuple;
+ do {
+ if (!var8.hasNext()) {
+ if (this.defaultFlowStyle != FlowStyle.AUTO) {
+ node.setFlowStyle(this.defaultFlowStyle);
+ } else {
+ node.setFlowStyle(bestStyle);
+ }
+
+ return node;
+ }
+
+ Property property = (Property)var8.next();
+ Object memberValue = property.get(javaBean);
+ Tag customPropertyTag = memberValue == null ? null : (Tag)this.classTags.get(memberValue.getClass());
+ tuple = this.representJavaBeanProperty(javaBean, property, memberValue, customPropertyTag);
+ } while(tuple == null);
+
+ if (!((ScalarNode)tuple.getKeyNode()).isPlain()) {
+ bestStyle = FlowStyle.BLOCK;
+ }
+
+ Node nodeValue = tuple.getValueNode();
+ if (!(nodeValue instanceof ScalarNode) || !((ScalarNode)nodeValue).isPlain()) {
+ bestStyle = FlowStyle.BLOCK;
+ }
+
+ value.add(tuple);
+ }
+ }
+
+ protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) {
+ ScalarNode nodeKey = (ScalarNode)this.representData(property.getName());
+ boolean hasAlias = this.representedObjects.containsKey(propertyValue);
+ Node nodeValue = this.representData(propertyValue);
+ if (propertyValue != null && !hasAlias) {
+ NodeId nodeId = nodeValue.getNodeId();
+ if (customTag == null) {
+ if (nodeId == NodeId.scalar) {
+ if (property.getType() != Enum.class && propertyValue instanceof Enum) {
+ nodeValue.setTag(Tag.STR);
+ }
+ } else {
+ if (nodeId == NodeId.mapping && property.getType() == propertyValue.getClass() && !(propertyValue instanceof Map) && !nodeValue.getTag().equals(Tag.SET)) {
+ nodeValue.setTag(Tag.MAP);
+ }
+
+ this.checkGlobalTag(property, nodeValue, propertyValue);
+ }
+ }
+ }
+
+ return new NodeTuple(nodeKey, nodeValue);
+ }
+
+ protected void checkGlobalTag(Property property, Node node, Object object) {
+ if (!object.getClass().isArray() || !object.getClass().getComponentType().isPrimitive()) {
+ Class>[] arguments = property.getActualTypeArguments();
+ if (arguments != null) {
+ Class t;
+ Iterator iter;
+ Iterator var9;
+ if (node.getNodeId() == NodeId.sequence) {
+ t = arguments[0];
+ SequenceNode snode = (SequenceNode)node;
+ Iterable