diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index e44c870..6e1043a 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -6,7 +6,7 @@ on: releaseversion: description: 'Release version' required: true - default: '0.3.0' + default: '0.4.0' jobs: diff --git a/README.md b/README.md index ef5464f..6b87199 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ application.properties 配置文件中 spring.datasource.platform 配置项选 |---------------|-------| | 2.2.0 - 2.3.0 | 0.0.2 | | 2.3.1 - 2.3.2 | 0.0.3 | +| 2.4.0 - 2.4.1 | 0.0.4 | ```xml diff --git a/pom.xml b/pom.xml index e6637ab..b63e053 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.15 + 2.7.18 @@ -11,7 +11,7 @@ 4.0.0 com.pig4cloud.plugin nacos-datasource-plugin-dm8 - 0.0.3 + 0.0.4 nacos-datasource-plugin-dm8 nacos-datasource-plugin-dm8 https://pig4cloud.com @@ -25,7 +25,7 @@ - 2.3.2 + 2.4.1 0.0.32 3.8.1 1.8 diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoAggrMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoAggrMapperByDm.java index 4b25b23..591be2b 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoAggrMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoAggrMapperByDm.java @@ -2,7 +2,6 @@ import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.plugin.datasource.constants.FieldConstant; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoAggrMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; @@ -10,7 +9,7 @@ import java.util.List; -public class ConfigInfoAggrMapperByDm extends AbstractMapper implements ConfigInfoAggrMapper { +public class ConfigInfoAggrMapperByDm extends DmAbstractMapper implements ConfigInfoAggrMapper { @Override public MapperResult findConfigInfoAggrByPageFetchRows(MapperContext context) { diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoBetaMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoBetaMapperByDm.java index 8ac73c7..7ee4e01 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoBetaMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoBetaMapperByDm.java @@ -1,6 +1,5 @@ package com.pig4cloud.plugin.impl.dm; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoBetaMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; @@ -9,7 +8,7 @@ import java.util.ArrayList; import java.util.List; -public class ConfigInfoBetaMapperByDm extends AbstractMapper implements ConfigInfoBetaMapper { +public class ConfigInfoBetaMapperByDm extends DmAbstractMapper implements ConfigInfoBetaMapper { @Override public MapperResult findAllConfigInfoBetaForDumpAllFetchRows(MapperContext context) { diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoMapperByDm.java index ce6ff13..bbe559e 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoMapperByDm.java @@ -21,7 +21,6 @@ import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.plugin.datasource.constants.ContextConstant; import com.alibaba.nacos.plugin.datasource.constants.FieldConstant; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; @@ -38,7 +37,7 @@ * @author hyx **/ -public class ConfigInfoMapperByDm extends AbstractMapper implements ConfigInfoMapper { +public class ConfigInfoMapperByDm extends DmAbstractMapper implements ConfigInfoMapper { private static final String DATA_ID = "dataId"; diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoTagMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoTagMapperByDm.java index 9f3eb69..d26369f 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoTagMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigInfoTagMapperByDm.java @@ -1,6 +1,5 @@ package com.pig4cloud.plugin.impl.dm; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoTagMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; @@ -8,7 +7,7 @@ import java.util.Collections; -public class ConfigInfoTagMapperByDm extends AbstractMapper implements ConfigInfoTagMapper { +public class ConfigInfoTagMapperByDm extends DmAbstractMapper implements ConfigInfoTagMapper { @Override public MapperResult findAllConfigInfoTagForDumpAllFetchRows(MapperContext context) { diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigTagsRelationMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigTagsRelationMapperByDm.java index db82dd5..99be427 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigTagsRelationMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/ConfigTagsRelationMapperByDm.java @@ -2,7 +2,6 @@ import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.plugin.datasource.constants.FieldConstant; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.ConfigTagsRelationMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; @@ -11,7 +10,7 @@ import java.util.ArrayList; import java.util.List; -public class ConfigTagsRelationMapperByDm extends AbstractMapper implements ConfigTagsRelationMapper { +public class ConfigTagsRelationMapperByDm extends DmAbstractMapper implements ConfigTagsRelationMapper { @Override public MapperResult findConfigInfo4PageFetchRows(MapperContext context) { diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/DmAbstractMapper.java b/src/main/java/com/pig4cloud/plugin/impl/dm/DmAbstractMapper.java new file mode 100644 index 0000000..bc81095 --- /dev/null +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/DmAbstractMapper.java @@ -0,0 +1,33 @@ +package com.pig4cloud.plugin.impl.dm; + +import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; +import com.pig4cloud.plugin.constants.DataSourceConstant; + +/** + * DM 抽象映射器 + * + * @author lengleng + * @date 2024/08/25 + */ +public abstract class DmAbstractMapper extends AbstractMapper { + + /** + * 获取数据源 + * @return {@link String } + */ + @Override + public String getDataSource() { + return DataSourceConstant.DM; + } + + /** + * get 函数 + * @param functionName 函数名称 + * @return {@link String } + */ + @Override + public String getFunction(String functionName) { + return "NOW()"; + } + +} diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/GroupCapacityMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/GroupCapacityMapperByDm.java index 96176a0..e06138a 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/GroupCapacityMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/GroupCapacityMapperByDm.java @@ -2,13 +2,12 @@ import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.plugin.datasource.constants.FieldConstant; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.GroupCapacityMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; import com.pig4cloud.plugin.constants.DataSourceConstant; -public class GroupCapacityMapperByDm extends AbstractMapper implements GroupCapacityMapper { +public class GroupCapacityMapperByDm extends DmAbstractMapper implements GroupCapacityMapper { @Override public MapperResult selectGroupInfoBySize(MapperContext context) { diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/HistoryConfigInfoMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/HistoryConfigInfoMapperByDm.java index e59cc7e..2b1fdbb 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/HistoryConfigInfoMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/HistoryConfigInfoMapperByDm.java @@ -2,13 +2,12 @@ import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.plugin.datasource.constants.FieldConstant; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.HistoryConfigInfoMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; import com.pig4cloud.plugin.constants.DataSourceConstant; -public class HistoryConfigInfoMapperByDm extends AbstractMapper implements HistoryConfigInfoMapper { +public class HistoryConfigInfoMapperByDm extends DmAbstractMapper implements HistoryConfigInfoMapper { @Override public MapperResult removeConfigHistory(MapperContext context) { diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/TenantCapacityMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/TenantCapacityMapperByDm.java index 98ad076..50fe925 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/TenantCapacityMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/TenantCapacityMapperByDm.java @@ -2,13 +2,12 @@ import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.plugin.datasource.constants.FieldConstant; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.TenantCapacityMapper; import com.alibaba.nacos.plugin.datasource.model.MapperContext; import com.alibaba.nacos.plugin.datasource.model.MapperResult; import com.pig4cloud.plugin.constants.DataSourceConstant; -public class TenantCapacityMapperByDm extends AbstractMapper implements TenantCapacityMapper { +public class TenantCapacityMapperByDm extends DmAbstractMapper implements TenantCapacityMapper { @Override public MapperResult getCapacityList4CorrectUsage(MapperContext context) { diff --git a/src/main/java/com/pig4cloud/plugin/impl/dm/TenantInfoMapperByDm.java b/src/main/java/com/pig4cloud/plugin/impl/dm/TenantInfoMapperByDm.java index ec805bf..6e259e6 100644 --- a/src/main/java/com/pig4cloud/plugin/impl/dm/TenantInfoMapperByDm.java +++ b/src/main/java/com/pig4cloud/plugin/impl/dm/TenantInfoMapperByDm.java @@ -1,20 +1,13 @@ package com.pig4cloud.plugin.impl.dm; import com.alibaba.nacos.plugin.datasource.constants.TableConstant; -import com.alibaba.nacos.plugin.datasource.mapper.AbstractMapper; import com.alibaba.nacos.plugin.datasource.mapper.TenantInfoMapper; -import com.pig4cloud.plugin.constants.DataSourceConstant; -public class TenantInfoMapperByDm extends AbstractMapper implements TenantInfoMapper { +public class TenantInfoMapperByDm extends DmAbstractMapper implements TenantInfoMapper { @Override public String getTableName() { return TableConstant.TENANT_INFO; } - @Override - public String getDataSource() { - return DataSourceConstant.DM; - } - }