diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java index 5a093be1..575df10f 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java @@ -1,5 +1,6 @@ package com.aizuda.easy.retry.template.datasource.config; +import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; import com.aizuda.easy.retry.template.datasource.enums.DbTypeEnum; import com.aizuda.easy.retry.template.datasource.utils.DbUtils; @@ -17,10 +18,12 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; +import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import javax.sql.DataSource; import java.text.MessageFormat; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -38,7 +41,13 @@ public class EasyRetryTemplateAutoConfiguration { MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); factoryBean.setDataSource(dataSource); DbTypeEnum dbTypeEnum = DbUtils.getDbType(); - factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MessageFormat.format("classpath*:/{0}/mapper/*.xml", dbTypeEnum.getDb()))); + PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); + Resource[] resources1 = resolver.getResources("classpath*:/template/mapper/*.xml"); + Resource[] resources2 = resolver.getResources(MessageFormat.format("classpath*:/{0}/mapper/*.xml", dbTypeEnum.getDb())); + List resources = new ArrayList<>(); + resources.addAll(Arrays.asList(resources1)); + resources.addAll(Arrays.asList(resources2)); + factoryBean.setMapperLocations(resources.toArray(new Resource[0])); factoryBean.setPlugins(mybatisPlusInterceptor); factoryBean.setTypeAliasesPackage(mybatisPlusProperties.getTypeAliasesPackage()); factoryBean.setGlobalConfig(mybatisPlusProperties.getGlobalConfig()); diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobNotifyConfigMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobNotifyConfigMapper.java index 9f2d0e4e..ca459945 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobNotifyConfigMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobNotifyConfigMapper.java @@ -4,6 +4,7 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotif import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.po.JobNotifyConfig; import com.aizuda.easy.retry.template.datasource.persistence.po.NotifyConfig; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; @@ -15,5 +16,5 @@ import java.util.List; * @author zuoJunLin */ public interface JobNotifyConfigMapper extends BaseMapper { - List selectJobNotifyConfigList(IPage iPage, @Param("queryDO") JobNotifyConfigQueryDO queryDO); + List selectJobNotifyConfigList(IPage iPage, @Param("ew") Wrapper wrapper); } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java index 2efd0326..b0839bf9 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java @@ -3,7 +3,10 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO; +import com.aizuda.easy.retry.template.datasource.persistence.po.Job; +import com.aizuda.easy.retry.template.datasource.persistence.po.JobNotifyConfig; import com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -23,25 +26,11 @@ public interface JobSummaryMapper extends BaseMapper { int insertOrUpdate(@Param("list") List list); - IPage jobTaskList(@Param("namespaceId") String namespaceId, @Param("groupNames") List groupNames, Page page); + IPage jobTaskList(@Param("ew") Wrapper wrapper, Page page); - List jobLineList( - @Param("systemTaskType") Integer systemTaskType, - @Param("namespaceId") String namespaceId, - @Param("groupNames") List groupNames, - @Param("groupName") String groupName, - @Param("dateFormat") String dateFormat, - @Param("from") LocalDateTime from, - @Param("to") LocalDateTime to); + List jobLineList(@Param("ew") Wrapper wrapper); - List dashboardRank( - @Param("systemTaskType") Integer systemTaskType, - @Param("namespaceId") String namespaceId, - @Param("groupNames") List groupNames, - @Param("groupName") String groupName, - @Param("startTime") LocalDateTime startTime, - @Param("endTime") LocalDateTime endTime - ); + List dashboardRank(@Param("ew") Wrapper wrapper); - DashboardCardResponseDO.JobTask toJobTask(@Param("systemTaskType") Integer systemTaskType, @Param("namespaceId") String namespaceId, @Param("groupNames") List groupNames); + DashboardCardResponseDO.JobTask toJobTask(@Param("ew") Wrapper wrapper); } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobTaskBatchMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobTaskBatchMapper.java index e238f9cb..938f0ecc 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobTaskBatchMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobTaskBatchMapper.java @@ -3,7 +3,10 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchQueryDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchSummaryResponseDO; +import com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary; import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch; +import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowTaskBatch; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Mapper; @@ -23,11 +26,11 @@ import java.util.List; @Mapper public interface JobTaskBatchMapper extends BaseMapper { - List selectJobBatchPageList(IPage iPage, @Param("queryDO") JobBatchQueryDO queryDO); + List selectJobBatchPageList(IPage iPage, @Param("ew") Wrapper wrapper); - List selectJobBatchListByIds(@Param("ids") List ids); + List selectJobBatchListByIds(@Param("ew") Wrapper wrapper); - List summaryJobBatchList(@Param("systemTaskType") Integer systemTaskType, @Param("from") LocalDateTime todayFrom, @Param("to") LocalDateTime to); + List summaryJobBatchList(@Param("ew") Wrapper wrapper); - List summaryWorkflowTaskBatchList(@Param("from") LocalDateTime todayFrom, @Param("to") LocalDateTime to); + List summaryWorkflowTaskBatchList(@Param("ew") Wrapper wrapper); } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java index bc0839f9..7d0c13b2 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java @@ -3,7 +3,10 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO; +import com.aizuda.easy.retry.template.datasource.persistence.po.Job; import com.aizuda.easy.retry.template.datasource.persistence.po.RetrySummary; +import com.aizuda.easy.retry.template.datasource.persistence.po.SceneConfig; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -23,24 +26,13 @@ public interface RetrySummaryMapper extends BaseMapper { int insertOrUpdate(@Param("list") List list); - DashboardCardResponseDO.RetryTask retryTask(@Param("namespaceId") String namespaceId, @Param("groupNames") List groupNames); + DashboardCardResponseDO.RetryTask retryTask(@Param("ew") Wrapper wrapper); - List retryTaskBarList(@Param("namespaceId") String namespaceId, @Param("groupNames") List groupNames); + List retryTaskBarList(@Param("ew") Wrapper wrapper); - IPage retryTaskList(@Param("namespaceId") String namespaceId, @Param("groupNames") List groupNames, Page page); + IPage retryTaskList(@Param("ew") Wrapper wrapper, Page page); - List retryLineList(@Param("namespaceId") String namespaceId, - @Param("groupNames") List groupNames, - @Param("groupName") String groupName, - @Param("type") String type, - @Param("from") LocalDateTime from, - @Param("to") LocalDateTime to); + List retryLineList(@Param("ew") Wrapper wrapper); - - List dashboardRank(@Param("namespaceId") String namespaceId, - @Param("groupNames") List groupNames, - @Param("groupName") String groupName, - @Param("startTime") LocalDateTime startTime, - @Param("endTime") LocalDateTime endTime - ); + List dashboardRank(@Param("ew") Wrapper wrapper); } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java index 3c2580b2..2d93dacd 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java @@ -2,7 +2,9 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryResponseDO; +import com.aizuda.easy.retry.template.datasource.persistence.po.RetrySummary; import com.aizuda.easy.retry.template.datasource.persistence.po.RetryTaskLog; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; @@ -13,5 +15,5 @@ public interface RetryTaskLogMapper extends BaseMapper { int batchInsert(List list); - List retrySummaryRetryTaskLogList(@Param("from") LocalDateTime from, @Param("to") LocalDateTime to); + List retrySummaryRetryTaskLogList(@Param("ew") Wrapper wrapper); } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/SequenceAllocMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/SequenceAllocMapper.java index 64135db9..5385f9b3 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/SequenceAllocMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/SequenceAllocMapper.java @@ -17,20 +17,4 @@ import org.apache.ibatis.annotations.Param; @Mapper public interface SequenceAllocMapper extends BaseMapper { - /** - * 更新业务类型下的最大id - * - * @param step 步长 - * @param groupName - * @return 更新结果 - */ - Integer updateMaxIdByCustomStep(@Param("step") Integer step, @Param("groupName") String groupName, @Param("namespaceId") String namespaceId); - - /** - * 更新最大id - * - * @param groupName 组名称 - * @return 更新结果 - */ - Integer updateMaxId(@Param("groupName") String groupName, @Param("namespaceId") String namespaceId); } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/ServerNodeMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/ServerNodeMapper.java index 4b337496..4b2b1b30 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/ServerNodeMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/ServerNodeMapper.java @@ -2,6 +2,7 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -15,8 +16,6 @@ public interface ServerNodeMapper extends BaseMapper { int insertOrUpdate(@Param("records") List records); - int deleteByExpireAt(@Param("endTime") LocalDateTime endTime); - - List countActivePod(@Param("namespaceIds") List namespaceIds); + List countActivePod(@Param("ew") Wrapper wrapper); } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/WorkflowTaskBatchMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/WorkflowTaskBatchMapper.java index 509d494d..4ee08295 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/WorkflowTaskBatchMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/WorkflowTaskBatchMapper.java @@ -4,6 +4,8 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.Workflow import com.aizuda.easy.retry.template.datasource.persistence.dataobject.WorkflowBatchResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch; import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowTaskBatch; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import org.apache.ibatis.annotations.Mapper; @@ -22,5 +24,5 @@ import java.util.List; @Mapper public interface WorkflowTaskBatchMapper extends BaseMapper { - List selectWorkflowBatchPageList(PageDTO pageDTO,@Param("queryDO") WorkflowBatchQueryDO workflowBatchQueryDO); + List selectWorkflowBatchPageList(PageDTO pageDTO,@Param("ew") Wrapper wrapper); } diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/DistributedLockMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/DistributedLockMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/DistributedLockMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/DistributedLockMapper.xml diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/GroupConfigMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/GroupConfigMapper.xml similarity index 89% rename from easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/GroupConfigMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/GroupConfigMapper.xml index 7feadbf0..1f5bedd3 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/GroupConfigMapper.xml +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/GroupConfigMapper.xml @@ -7,7 +7,6 @@ - @@ -15,7 +14,7 @@ - id, `group_name`, group_status, version, `group_partition`, route_key, id_generator_mode, init_scene, description, create_dt, update_dt + id, `group_name`, group_status, version, `group_partition`, id_generator_mode, init_scene, description, create_dt, update_dt diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobNotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobNotifyConfigMapper.xml similarity index 81% rename from easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobNotifyConfigMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobNotifyConfigMapper.xml index 5efeb6f1..04bfba9a 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobNotifyConfigMapper.xml +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobNotifyConfigMapper.xml @@ -25,18 +25,6 @@ resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigResponseDO"> SELECT a.*, b.job_name FROM job_notify_config a join job b on a.job_id = b.id - - a.namespace_id = #{queryDO.namespaceId} - - and a.job_id = #{queryDO.jobId} - - - and a.group_name IN - - #{groupName} - - - order by a.id desc - + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobTaskBatchMapper.xml similarity index 73% rename from easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobTaskBatchMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobTaskBatchMapper.xml index 182bccd9..c080296d 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobTaskBatchMapper.xml +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobTaskBatchMapper.xml @@ -18,28 +18,7 @@ resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO"> SELECT a.*, b.job_name, b.task_type, b.block_strategy, b.trigger_type FROM job_task_batch a join job b on a.job_id = b.id - - a.namespace_id = #{queryDO.namespaceId} - and a.system_task_type = 3 - - and a.job_id = #{queryDO.jobId} - - - and a.group_name IN - - #{groupName} - - - - and task_batch_status = #{queryDO.taskBatchStatus} - - - and job_name like #{queryDO.jobName} - - and a.deleted = 0 - order by a.id desc - - + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobTaskMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobTaskMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobTaskMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/JobTaskMapper.xml diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/NamespaceMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/NamespaceMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/NamespaceMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/NamespaceMapper.xml diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/NotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/NotifyConfigMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/NotifyConfigMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/NotifyConfigMapper.xml diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SceneConfigMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SceneConfigMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SceneConfigMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SceneConfigMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserPermissionMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SequenceAllocMapper.xml similarity index 68% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserPermissionMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SequenceAllocMapper.xml index 5e59edae..482f6ac9 100644 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserPermissionMapper.xml +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SequenceAllocMapper.xml @@ -1,13 +1,13 @@ - + - + - - + + diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SystemUserMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SystemUserMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SystemUserMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SystemUserMapper.xml diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SystemUserPermissionMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SystemUserPermissionMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SystemUserPermissionMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/SystemUserPermissionMapper.xml diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/WorkflowNodeMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/WorkflowNodeMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/WorkflowNodeMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/WorkflowNodeMapper.xml diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/WorkflowTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/WorkflowTaskBatchMapper.xml similarity index 63% rename from easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/WorkflowTaskBatchMapper.xml rename to easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/WorkflowTaskBatchMapper.xml index 9b59b27d..7b464b21 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/WorkflowTaskBatchMapper.xml +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/resources/template/mapper/WorkflowTaskBatchMapper.xml @@ -21,26 +21,7 @@ resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.WorkflowBatchResponseDO"> SELECT a.*, b.workflow_name FROM workflow_task_batch a join workflow b on a.workflow_id = b.id - - a.namespace_id = #{queryDO.namespaceId} - - and a.workflow_id = #{queryDO.workflowId} - - - and a.group_name IN - - #{groupName} - - - - and task_batch_status = #{queryDO.taskBatchStatus} - - - and b.workflow_name like #{queryDO.workflowName} - - and a.deleted = 0 - order by a.id desc - + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/DistributedLockMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/DistributedLockMapper.xml deleted file mode 100644 index 646adda0..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/DistributedLockMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - id, name, lock_until, locked_at, locked_by, create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/GroupConfigMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/GroupConfigMapper.xml deleted file mode 100644 index 7feadbf0..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/GroupConfigMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - id, `group_name`, group_status, version, `group_partition`, route_key, id_generator_mode, init_scene, description, create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobNotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobNotifyConfigMapper.xml deleted file mode 100644 index 5efeb6f1..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobNotifyConfigMapper.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - id,namespace_id, group_name,job_id,notify_status,notify_type, notify_attribute, notify_threshold, notify_scene,rate_limiter_status,rate_limiter_threshold, description, - create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobSummaryMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobSummaryMapper.xml index 6edc1ff8..82009ad4 100644 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobSummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobSummaryMapper.xml @@ -61,18 +61,7 @@ ifnull(SUM(fail_num + stop_num + cancel_num), 0) AS fail, ifnull(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total FROM job_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to} - + ${ew.customSqlSegment} GROUP BY DATE_FORMAT(trigger_at, #{dateFormat}) @@ -84,13 +73,7 @@ ifnull(sum(fail_num), 0) AS failNum, ifnull(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum FROM job_summary - WHERE system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -128,13 +97,7 @@ SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run, COUNT(*) AS total FROM job - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobTaskBatchMapper.xml deleted file mode 100644 index b5f38ab1..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/JobTaskBatchMapper.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetrySummaryMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetrySummaryMapper.xml index fffcd07a..aab261f3 100644 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetrySummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetrySummaryMapper.xml @@ -47,13 +47,7 @@ ifnull(sum(suspend_num), 0) AS suspendNum, ifnull(sum(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum FROM retry_summary - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -117,21 +94,9 @@ resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank"> SELECT CONCAT(group_name, '/', scene_name) `name`, - SUM(running_num + finish_num + max_count_num + suspend_num) AS total FROM retry_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND namespace_id = #{namespaceId} - AND trigger_at >= #{startTime} AND trigger_at <= #{endTime} - - GROUP BY namespace_id, group_name, scene_name + SUM(running_num + finish_num + max_count_num + suspend_num) AS total + FROM retry_summary + ${ew.customSqlSegment} HAVING total > 0 ORDER BY total DESC LIMIT 10 @@ -143,12 +108,7 @@ count(*) AS total FROM scene_config WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetryTaskLogMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetryTaskLogMapper.xml index 3cd0a1f4..b42dc32f 100644 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetryTaskLogMapper.xml +++ b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/RetryTaskLogMapper.xml @@ -43,7 +43,6 @@ SUM(CASE WHEN (retry_status = 2) THEN 1 ELSE 0 END) AS maxCountNum, SUM(CASE WHEN (retry_status = 3) THEN 1 ELSE 0 END) AS suspendNum FROM retry_task_log - WHERE create_dt between #{from} and #{to} - GROUP BY namespace_id, group_name, scene_name + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SequenceAllocMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SequenceAllocMapper.xml deleted file mode 100644 index 2131f9cd..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SequenceAllocMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - UPDATE sequence_alloc - SET max_id = max_id + #{step}, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - - - UPDATE sequence_alloc - SET max_id = max_id + step, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/ServerNodeMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/ServerNodeMapper.xml index efe654dc..e225ffa2 100644 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/ServerNodeMapper.xml +++ b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/ServerNodeMapper.xml @@ -29,16 +29,9 @@ ON DUPLICATE KEY UPDATE expire_at = values(`expire_at`) - - delete from server_node - where expire_at <= #{endTime,jdbcType=TIMESTAMP} - diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SystemUserPermissionMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SystemUserPermissionMapper.xml deleted file mode 100644 index 5e59edae..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/SystemUserPermissionMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/WorkflowTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/WorkflowTaskBatchMapper.xml deleted file mode 100644 index 9b59b27d..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/mariadb/mapper/WorkflowTaskBatchMapper.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml index 2906f463..f17fdff3 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml @@ -60,18 +60,7 @@ ifnull(SUM(fail_num), 0) AS fail, ifnull(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total FROM job_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to} - + ${ew.customSqlSegment} GROUP BY DATE_FORMAT(trigger_at, #{dateFormat}) @@ -84,13 +73,7 @@ ifnull(sum(fail_num), 0) AS failNum, ifnull(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum FROM job_summary - WHERE system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -128,13 +97,7 @@ SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run, count(*) AS total FROM job - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobTaskMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobTaskMapper.xml deleted file mode 100644 index fc8de3df..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobTaskMapper.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/NotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/NotifyConfigMapper.xml deleted file mode 100644 index 9450936b..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/NotifyConfigMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - id, group_name, notify_type, notify_attribute, notify_threshold, notify_scene, description, - create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetrySummaryMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetrySummaryMapper.xml index dbf2b433..df730e0f 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetrySummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetrySummaryMapper.xml @@ -48,13 +48,7 @@ IFNULL(SUM(suspend_num), 0) AS suspendNum, IFNULL(SUM(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum FROM retry_summary - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -118,21 +95,9 @@ resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank"> SELECT CONCAT(group_name, '/', scene_name) `name`, - SUM(running_num + finish_num + max_count_num + suspend_num) AS total FROM retry_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND namespace_id = #{namespaceId} - AND trigger_at >= #{startTime} AND trigger_at <= #{endTime} - - GROUP BY namespace_id, group_name, scene_name + SUM(running_num + finish_num + max_count_num + suspend_num) AS total + FROM retry_summary + ${ew.customSqlSegment} HAVING total > 0 ORDER BY total DESC LIMIT 10 @@ -143,13 +108,7 @@ SUM(CASE WHEN (scene_status = 1) THEN 1 ELSE 0 END) AS run, COUNT(*) AS total FROM scene_config - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetryTaskLogMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetryTaskLogMapper.xml index 3e945bd0..cda70617 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetryTaskLogMapper.xml +++ b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/RetryTaskLogMapper.xml @@ -45,7 +45,6 @@ SUM(CASE WHEN (retry_status = 2) THEN 1 ELSE 0 END) AS maxCountNum, SUM(CASE WHEN (retry_status = 3) THEN 1 ELSE 0 END) AS suspendNum FROM retry_task_log - WHERE create_dt between #{from} and #{to} - GROUP BY namespace_id, group_name, scene_name + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SceneConfigMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SceneConfigMapper.xml deleted file mode 100644 index c692b86b..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SceneConfigMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - id, scene_name, group_name, scene_status, max_retry_count, back_off, `trigger_interval`, deadline_request, description, create_dt, update_dt - - diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SequenceAllocMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SequenceAllocMapper.xml deleted file mode 100644 index 2131f9cd..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SequenceAllocMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - UPDATE sequence_alloc - SET max_id = max_id + #{step}, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - - - UPDATE sequence_alloc - SET max_id = max_id + step, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/ServerNodeMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/ServerNodeMapper.xml index 6224c11f..7e89e305 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/ServerNodeMapper.xml +++ b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/ServerNodeMapper.xml @@ -30,17 +30,10 @@ ON DUPLICATE KEY UPDATE expire_at = values(`expire_at`) - - delete from server_node - where expire_at <= #{endTime,jdbcType=TIMESTAMP} - diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SystemUserMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SystemUserMapper.xml deleted file mode 100644 index 651b54e1..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/SystemUserMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/WorkflowNodeMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/WorkflowNodeMapper.xml deleted file mode 100644 index f0d72eff..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/WorkflowNodeMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/DistributedLockMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/DistributedLockMapper.xml deleted file mode 100644 index 646adda0..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/DistributedLockMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - id, name, lock_until, locked_at, locked_by, create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/GroupConfigMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/GroupConfigMapper.xml deleted file mode 100644 index 92e86f37..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/GroupConfigMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - id, group_name, group_status, version, group_partition, route_key, id_generator_mode, init_scene, description, create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobNotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobNotifyConfigMapper.xml deleted file mode 100644 index a5fb2470..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobNotifyConfigMapper.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - id,namespace_id, group_name,job_id,notify_status,notify_type, notify_attribute, notify_threshold, notify_scene,rate_limiter_status,rate_limiter_threshold, description, - create_dt, update_dt - - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobSummaryMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobSummaryMapper.xml index 29097370..f8b169c7 100644 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobSummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobSummaryMapper.xml @@ -89,18 +89,7 @@ stop_num, cancel_num FROM job_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to} - + ${ew.customSqlSegment} ) GROUP BY DATE_FORMAT(trigger_at, #{dateFormat}) @@ -113,13 +102,7 @@ COALESCE(sum(fail_num), 0) AS failNum, COALESCE(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum FROM job_summary - WHERE system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobTaskBatchMapper.xml deleted file mode 100644 index 16a0198f..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobTaskBatchMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobTaskMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobTaskMapper.xml deleted file mode 100644 index 0cbf78f3..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/JobTaskMapper.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/NotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/NotifyConfigMapper.xml deleted file mode 100644 index 9450936b..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/NotifyConfigMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - id, group_name, notify_type, notify_attribute, notify_threshold, notify_scene, description, - create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetrySummaryMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetrySummaryMapper.xml index 59c57b80..2eee2d4e 100644 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetrySummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetrySummaryMapper.xml @@ -67,13 +67,7 @@ COALESCE(sum(suspend_num), 0) AS suspendNum, COALESCE(sum(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum FROM retry_summary - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -129,18 +116,7 @@ max_count_num, suspend_num FROM retry_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to} - + ${ew.customSqlSegment} ) GROUP BY createDt @@ -155,20 +131,7 @@ group_name || '/' || scene_name AS name, SUM(running_num + finish_num + max_count_num + suspend_num) AS total FROM retry_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND namespace_id = #{namespaceId} - AND trigger_at BETWEEN #{startTime} AND #{endTime} - - GROUP BY namespace_id, group_name, scene_name + ${ew.customSqlSegment} HAVING SUM(running_num + finish_num + max_count_num + suspend_num) > 0 ORDER BY SUM(running_num + finish_num + max_count_num + suspend_num) DESC ) @@ -181,13 +144,7 @@ SUM(CASE WHEN (scene_status = 1) THEN 1 ELSE 0 END) AS run, COUNT(*) AS total FROM scene_config - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetryTaskLogMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetryTaskLogMapper.xml index 19c28ac0..e3e149f4 100644 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetryTaskLogMapper.xml +++ b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/RetryTaskLogMapper.xml @@ -48,7 +48,6 @@ SUM(CASE WHEN (retry_status = 2) THEN 1 ELSE 0 END) AS maxCountNum, SUM(CASE WHEN (retry_status = 3) THEN 1 ELSE 0 END) AS suspendNum FROM retry_task_log - WHERE create_dt between #{from} and #{to} - GROUP BY namespace_id, group_name, scene_name + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SceneConfigMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SceneConfigMapper.xml deleted file mode 100644 index cad5f79e..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SceneConfigMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - id, scene_name, group_name, scene_status, max_retry_count, back_off, trigger_interval, deadline_request, description, create_dt, update_dt - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SequenceAllocMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SequenceAllocMapper.xml deleted file mode 100644 index 6461e8d6..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SequenceAllocMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - UPDATE sequence_alloc - SET max_id = max_id + #{step}, update_dt = CURRENT_TIMESTAMP - WHERE group_name = #{groupName} AND namespace_id = #{namespaceId} - - - - UPDATE sequence_alloc - SET max_id = max_id + step, update_dt = CURRENT_TIMESTAMP - WHERE group_name = #{groupName} AND namespace_id = #{namespaceId} - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/ServerNodeMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/ServerNodeMapper.xml index eaa51a6e..a1df2dfc 100644 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/ServerNodeMapper.xml +++ b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/ServerNodeMapper.xml @@ -53,23 +53,13 @@ - - DELETE - FROM server_node - WHERE expire_at <= #{endTime,jdbcType=TIMESTAMP} - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SystemUserMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SystemUserMapper.xml deleted file mode 100644 index 651b54e1..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SystemUserMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SystemUserPermissionMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SystemUserPermissionMapper.xml deleted file mode 100644 index 5e59edae..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/SystemUserPermissionMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/WorkflowNodeMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/WorkflowNodeMapper.xml deleted file mode 100644 index f0d72eff..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/WorkflowNodeMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/WorkflowTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/WorkflowTaskBatchMapper.xml deleted file mode 100644 index 0829cf9b..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/oracle/mapper/WorkflowTaskBatchMapper.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/DistributedLockMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/DistributedLockMapper.xml deleted file mode 100644 index 646adda0..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/DistributedLockMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - id, name, lock_until, locked_at, locked_by, create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/GroupConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/GroupConfigMapper.xml deleted file mode 100644 index 7feadbf0..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/GroupConfigMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - id, `group_name`, group_status, version, `group_partition`, route_key, id_generator_mode, init_scene, description, create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobNotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobNotifyConfigMapper.xml deleted file mode 100644 index 751e37b8..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobNotifyConfigMapper.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - id,namespace_id, group_name,job_id,notify_status,notify_type, notify_attribute, notify_threshold, notify_scene,rate_limiter_status,rate_limiter_threshold, description, - create_dt, update_dt - - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobSummaryMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobSummaryMapper.xml index 3e74d0be..bba3e3c5 100644 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobSummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobSummaryMapper.xml @@ -61,18 +61,7 @@ COALESCE(SUM(fail_num + stop_num + cancel_num), 0) AS fail, COALESCE(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total FROM job_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to} - + ${ew.customSqlSegment} GROUP BY DATE_FORMAT(trigger_at, #{dateFormat}) @@ -84,13 +73,7 @@ COALESCE(sum(fail_num), 0) AS failNum, COALESCE(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum FROM job_summary - WHERE system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -128,13 +97,7 @@ SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run, count(*) AS total FROM job - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskBatchMapper.xml deleted file mode 100644 index 1364b047..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskBatchMapper.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskMapper.xml deleted file mode 100644 index 0cbf78f3..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskMapper.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/NotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/NotifyConfigMapper.xml deleted file mode 100644 index 9450936b..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/NotifyConfigMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - id, group_name, notify_type, notify_attribute, notify_threshold, notify_scene, description, - create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetrySummaryMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetrySummaryMapper.xml index d6d33525..04f90469 100644 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetrySummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetrySummaryMapper.xml @@ -47,13 +47,7 @@ COALESCE(sum(suspend_num), 0) AS suspendNum, COALESCE(sum(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum FROM retry_summary - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -117,21 +94,9 @@ resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank"> SELECT CONCAT(group_name, '/', scene_name) name, - SUM(running_num + finish_num + max_count_num + suspend_num) AS total FROM retry_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND namespace_id = #{namespaceId} - AND trigger_at >= #{startTime} AND trigger_at <= #{endTime} - - GROUP BY namespace_id, group_name, scene_name + SUM(running_num + finish_num + max_count_num + suspend_num) AS total + FROM retry_summary + ${ew.customSqlSegment} HAVING SUM(running_num + finish_num + max_count_num + suspend_num) > 0 ORDER BY total DESC LIMIT 10 @@ -142,13 +107,7 @@ sum(CASE WHEN (scene_status = 1) THEN 1 ELSE 0 END) AS run, count(*) AS total FROM scene_config - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMapper.xml index d476c178..5a6be0b0 100644 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMapper.xml +++ b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMapper.xml @@ -44,7 +44,6 @@ SUM(CASE WHEN (retry_status = 2) THEN 1 ELSE 0 END) AS maxCountNum, SUM(CASE WHEN (retry_status = 3) THEN 1 ELSE 0 END) AS suspendNum FROM retry_task_log - WHERE create_dt between #{from} and #{to} - GROUP BY namespace_id, group_name, scene_name + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SceneConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SceneConfigMapper.xml deleted file mode 100644 index c692b86b..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SceneConfigMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - id, scene_name, group_name, scene_status, max_retry_count, back_off, `trigger_interval`, deadline_request, description, create_dt, update_dt - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SequenceAllocMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SequenceAllocMapper.xml deleted file mode 100644 index 2131f9cd..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SequenceAllocMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - UPDATE sequence_alloc - SET max_id = max_id + #{step}, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - - - UPDATE sequence_alloc - SET max_id = max_id + step, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/ServerNodeMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/ServerNodeMapper.xml index 72ec5d32..cd65014c 100644 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/ServerNodeMapper.xml +++ b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/ServerNodeMapper.xml @@ -30,18 +30,10 @@ ON CONFLICT (host_id, host_ip) DO UPDATE SET expire_at = EXCLUDED.expire_at - - delete - from server_node - where expire_at <= #{endTime,jdbcType=TIMESTAMP} - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserMapper.xml deleted file mode 100644 index 651b54e1..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowNodeMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowNodeMapper.xml deleted file mode 100644 index f0d72eff..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowNodeMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowTaskBatchMapper.xml deleted file mode 100644 index 9b59b27d..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowTaskBatchMapper.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/DistributedLockMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/DistributedLockMapper.xml deleted file mode 100644 index 29df3b13..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/DistributedLockMapper.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - id, name, lock_until, locked_at, locked_by, create_dt, update_dt - - - - UPDATE distributed_lock SET locked_by = #{lockedBy}, - lock_until = #{lockUntil}, - locked_at = #{lockedAt} - WHERE name = #{name} AND lock_until #{lockedAt} - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/GroupConfigMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/GroupConfigMapper.xml deleted file mode 100644 index 5f12a346..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/GroupConfigMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - id, `group_name`, group_status, version, `group_partition`, route_key, id_generator_mode, init_scene, description, create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobNotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobNotifyConfigMapper.xml deleted file mode 100644 index bb915da8..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobNotifyConfigMapper.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - id,namespace_id, group_name,job_id,notify_status,notify_type, notify_attribute, notify_threshold, notify_scene,rate_limiter_status,rate_limiter_threshold, description, - create_dt, update_dt - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobSummaryMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobSummaryMapper.xml index f1e38ff7..2755bdbe 100644 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobSummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobSummaryMapper.xml @@ -77,20 +77,7 @@ cancel_num, fail_num FROM job_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND system_task_type = #{systemTaskType} - AND namespace_id = #{namespaceId} - AND trigger_at BETWEEN #{from} AND #{to} - + ${ew.customSqlSegment} ) AS subquery GROUP BY DATE_FORMAT(trigger_at, #{dateFormat}) @@ -104,13 +91,7 @@ ISNULL(sum(fail_num), 0) AS failNum, ISNULL(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum FROM job_summary - WHERE system_task_type = #{systemTaskType} AND namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -152,13 +119,7 @@ SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run, COUNT(*) AS total FROM job - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name ORDER BY group_name @@ -169,12 +130,6 @@ resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task"> SELECT COUNT(DISTINCT group_name) FROM job - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobTaskBatchMapper.xml deleted file mode 100644 index 883f1fbf..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobTaskBatchMapper.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobTaskMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobTaskMapper.xml deleted file mode 100644 index fc8de3df..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/JobTaskMapper.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/NamespaceMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/NamespaceMapper.xml deleted file mode 100644 index d6effaa0..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/NamespaceMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/NotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/NotifyConfigMapper.xml deleted file mode 100644 index e28fa3d5..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/NotifyConfigMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - id, group_name, notify_type, notify_attribute, notify_threshold, notify_scene, description, - create_dt, update_dt - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetrySummaryMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetrySummaryMapper.xml index 0fed27de..978ef7a8 100644 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetrySummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetrySummaryMapper.xml @@ -59,13 +59,7 @@ ISNULL(SUM(suspend_num), 0) AS suspendNum, ISNULL(SUM(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum FROM retry_summary - WHERE namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} @@ -144,20 +118,7 @@ CONCAT(group_name, '/', scene_name) AS name, SUM(running_num + finish_num + max_count_num + suspend_num) AS total FROM retry_summary - - - AND group_name IN - - #{groupName} - - - - AND group_name = #{groupName} - - AND namespace_id = #{namespaceId} - AND trigger_at BETWEEN #{startTime} AND #{endTime} - - GROUP BY namespace_id, group_name, scene_name + ${ew.customSqlSegment} HAVING SUM(running_num + finish_num + max_count_num + suspend_num) > 0 ORDER BY total DESC @@ -170,14 +131,7 @@ SUM(CASE WHEN (scene_status = 1) THEN 1 ELSE 0 END) AS run, COUNT(*) AS total FROM scene_config - WHERE - namespace_id = #{namespaceId} - - AND group_name IN - - #{groupName} - - + ${ew.customSqlSegment} GROUP BY namespace_id, group_name ORDER BY group_name @@ -186,13 +140,7 @@ SQL Server SELECT COUNT(*) FROM (... ORDER BY group_name) 会报错 --> diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetryTaskLogMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetryTaskLogMapper.xml index 4d2df8b4..6a6c398c 100644 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetryTaskLogMapper.xml +++ b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/RetryTaskLogMapper.xml @@ -45,7 +45,6 @@ SUM(CASE WHEN (retry_status = 2) THEN 1 ELSE 0 END) AS maxCountNum, SUM(CASE WHEN (retry_status = 3) THEN 1 ELSE 0 END) AS suspendNum FROM retry_task_log - WHERE create_dt between #{from} and #{to} - GROUP BY namespace_id, group_name, scene_name + ${ew.customSqlSegment} diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SceneConfigMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SceneConfigMapper.xml deleted file mode 100644 index acb2f092..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SceneConfigMapper.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - id, scene_name, group_name, scene_status, max_retry_count, back_off, `trigger_interval`, deadline_request, description, create_dt, update_dt - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SequenceAllocMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SequenceAllocMapper.xml deleted file mode 100644 index 2131f9cd..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SequenceAllocMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - UPDATE sequence_alloc - SET max_id = max_id + #{step}, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - - - UPDATE sequence_alloc - SET max_id = max_id + step, update_dt = now() - WHERE group_name = #{groupName} and namespace_id = #{namespaceId} - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/ServerNodeMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/ServerNodeMapper.xml index d7a1d67f..a4b139db 100644 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/ServerNodeMapper.xml +++ b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/ServerNodeMapper.xml @@ -47,21 +47,12 @@ source.expire_at, source.node_type, source.ext_attrs, source.context_path, source.create_dt, GETDATE()); - - DELETE FROM server_node - WHERE expire_at <= #{endTime,jdbcType=TIMESTAMP} - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SystemUserMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SystemUserMapper.xml deleted file mode 100644 index 651b54e1..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SystemUserMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SystemUserPermissionMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SystemUserPermissionMapper.xml deleted file mode 100644 index cc26e118..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/SystemUserPermissionMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/WorkflowNodeMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/WorkflowNodeMapper.xml deleted file mode 100644 index f0d72eff..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/WorkflowNodeMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/WorkflowTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/WorkflowTaskBatchMapper.xml deleted file mode 100644 index 419a0c74..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/sqlserver/mapper/WorkflowTaskBatchMapper.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/generator/id/SegmentIdGenerator.java b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/generator/id/SegmentIdGenerator.java index febaf47e..26a7b61b 100644 --- a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/generator/id/SegmentIdGenerator.java +++ b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/generator/id/SegmentIdGenerator.java @@ -8,16 +8,13 @@ import com.aizuda.easy.retry.server.common.util.DateUtils; import com.aizuda.easy.retry.template.datasource.persistence.mapper.SequenceAllocMapper; import com.aizuda.easy.retry.template.datasource.persistence.po.SequenceAlloc; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingDeque; @@ -186,13 +183,18 @@ public class SegmentIdGenerator implements IdGenerator, Lifecycle { public void updateSegmentFromDb(Pair key, Segment segment) { SegmentBuffer buffer = segment.getBuffer(); SequenceAlloc sequenceAlloc; + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() + .set(SequenceAlloc::getMaxId, "max_id + step") + .set(SequenceAlloc::getUpdateDt, new Date()) + .eq(SequenceAlloc::getGroupName, key.getKey()) + .eq(SequenceAlloc::getNamespaceId, key.getValue()); if (!buffer.isInitOk()) { - sequenceAllocMapper.updateMaxId(key.getKey(), key.getValue()); + sequenceAllocMapper.update(wrapper); sequenceAlloc = sequenceAllocMapper.selectOne(new LambdaQueryWrapper().eq(SequenceAlloc::getGroupName, key)); buffer.setStep(sequenceAlloc.getStep()); buffer.setMinStep(sequenceAlloc.getStep());//leafAlloc中的step为DB中的step } else if (buffer.getUpdateTimestamp() == 0) { - sequenceAllocMapper.updateMaxId(key.getKey(), key.getValue()); + sequenceAllocMapper.update(wrapper); sequenceAlloc = sequenceAllocMapper.selectOne(new LambdaQueryWrapper().eq(SequenceAlloc::getGroupName, key)); buffer.setUpdateTimestamp(System.currentTimeMillis()); buffer.setStep(sequenceAlloc.getStep()); @@ -211,9 +213,13 @@ public class SegmentIdGenerator implements IdGenerator, Lifecycle { } else { nextStep = nextStep / 2 >= buffer.getMinStep() ? nextStep / 2 : nextStep; } - EasyRetryLog.LOCAL.debug("leafKey[{}], step[{}], duration[{}mins], nextStep[{}]", key, buffer.getStep(), String.format("%.2f", ((double) duration / (1000 * 60))), nextStep); - - sequenceAllocMapper.updateMaxIdByCustomStep(nextStep, key.getKey(), key.getValue()); + EasyRetryLog.LOCAL.debug("leafKey[{}], step[{}], duration[{}mins], nextStep[{}]", key, buffer.getStep(), String.format("%.2f", ((double) duration / (1000 * 60))), nextStep); + LambdaUpdateWrapper wrapper1 = new LambdaUpdateWrapper() + .set(SequenceAlloc::getMaxId, "max_id + " + nextStep) + .set(SequenceAlloc::getUpdateDt, new Date()) + .eq(SequenceAlloc::getGroupName, key.getKey()) + .eq(SequenceAlloc::getNamespaceId, key.getValue()); + sequenceAllocMapper.update(wrapper1); sequenceAlloc = sequenceAllocMapper .selectOne(new LambdaQueryWrapper().eq(SequenceAlloc::getGroupName, key)); buffer.setUpdateTimestamp(System.currentTimeMillis()); diff --git a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/listener/JobTaskFailAlarmListener.java b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/listener/JobTaskFailAlarmListener.java index 782aa2e7..570b7828 100644 --- a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/listener/JobTaskFailAlarmListener.java +++ b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/listener/JobTaskFailAlarmListener.java @@ -13,6 +13,8 @@ import com.aizuda.easy.retry.server.common.util.DateUtils; import com.aizuda.easy.retry.server.job.task.support.event.JobTaskFailAlarmEvent; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskBatchMapper; +import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -57,8 +59,9 @@ public class JobTaskFailAlarmListener extends AbstractJobAlarm jobTaskBatchIds = Lists.newArrayList(jobTaskBatchId); queue.drainTo(jobTaskBatchIds, 200); - - List jobTaskBatchList = jobTaskBatchMapper.selectJobBatchListByIds(jobTaskBatchIds); + QueryWrapper wrapper = new QueryWrapper() + .in("a.id", jobTaskBatchIds).eq("a.deleted", 0); + List jobTaskBatchList = jobTaskBatchMapper.selectJobBatchListByIds(wrapper); return AlarmInfoConverter.INSTANCE.toJobAlarmInfos(jobTaskBatchList); } diff --git a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/JobSummarySchedule.java b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/JobSummarySchedule.java index 79126e3f..5e73e937 100644 --- a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/JobSummarySchedule.java +++ b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/JobSummarySchedule.java @@ -12,6 +12,8 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatch import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobSummaryMapper; import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskBatchMapper; import com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary; +import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -63,7 +65,12 @@ public class JobSummarySchedule extends AbstractSchedule implements Lifecycle { // 定时按日实时查询统计数据(00:00:00 - 23:59:59) LocalDateTime todayFrom = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(-i); LocalDateTime todayTo = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).plusDays(-i); - List summaryResponseDOList = jobTaskBatchMapper.summaryJobBatchList(SyetemTaskTypeEnum.JOB.getType(), todayFrom, todayTo); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(JobTaskBatch::getSystemTaskType, SyetemTaskTypeEnum.JOB.getType()) + .between(JobTaskBatch::getCreateDt, todayFrom, todayTo) + .groupBy(JobTaskBatch::getNamespaceId, JobTaskBatch::getGroupName, + JobTaskBatch::getJobId, JobTaskBatch::getTaskBatchStatus, JobTaskBatch::getOperationReason); + List summaryResponseDOList = jobTaskBatchMapper.summaryJobBatchList(wrapper); if (summaryResponseDOList == null || summaryResponseDOList.size() < 1) { continue; } diff --git a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/WorkflowJobSummarySchedule.java b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/WorkflowJobSummarySchedule.java index 3c02c0e4..16a12ae5 100644 --- a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/WorkflowJobSummarySchedule.java +++ b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/schedule/WorkflowJobSummarySchedule.java @@ -12,6 +12,9 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatch import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobSummaryMapper; import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobTaskBatchMapper; import com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary; +import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch; +import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowTaskBatch; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -66,7 +69,11 @@ public class WorkflowJobSummarySchedule extends AbstractSchedule implements Life // 定时按日实时查询统计数据(00:00:00 - 23:59:59) LocalDateTime todayFrom = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(-i); LocalDateTime todayTo = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).plusDays(-i); - List summaryWorkflowResponseDOList = jobTaskBatchMapper.summaryWorkflowTaskBatchList(todayFrom, todayTo); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .between(WorkflowTaskBatch::getCreateDt, todayFrom, todayTo) + .groupBy(WorkflowTaskBatch::getNamespaceId, WorkflowTaskBatch::getGroupName, + WorkflowTaskBatch::getWorkflowId, WorkflowTaskBatch::getTaskBatchStatus, WorkflowTaskBatch::getOperationReason); + List summaryWorkflowResponseDOList = jobTaskBatchMapper.summaryWorkflowTaskBatchList(wrapper); if (summaryWorkflowResponseDOList == null || summaryWorkflowResponseDOList.size() < 1) { continue; } diff --git a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetrySummarySchedule.java b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetrySummarySchedule.java index 96fd7a2e..1fb05316 100644 --- a/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetrySummarySchedule.java +++ b/easy-retry-server/easy-retry-server-retry-task/src/main/java/com/aizuda/easy/retry/server/retry/task/support/schedule/RetrySummarySchedule.java @@ -8,6 +8,8 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.Dashboar import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetrySummaryMapper; import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetryTaskLogMapper; import com.aizuda.easy.retry.template.datasource.persistence.po.RetrySummary; +import com.aizuda.easy.retry.template.datasource.persistence.po.RetryTaskLog; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -60,7 +62,10 @@ public class RetrySummarySchedule extends AbstractSchedule implements Lifecycle // 重试按日实时查询统计数据(00:00:00 - 23:59:59) LocalDateTime todayFrom = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(-i); LocalDateTime todayTo = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).plusDays(-i); - List dashboardRetryResponseDOList = retryTaskLogMapper.retrySummaryRetryTaskLogList(todayFrom, todayTo); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .between(RetryTaskLog::getCreateDt, todayFrom, todayTo) + .groupBy(RetryTaskLog::getNamespaceId, RetryTaskLog::getGroupName, RetryTaskLog::getSceneName); + List dashboardRetryResponseDOList = retryTaskLogMapper.retrySummaryRetryTaskLogList(wrapper); if (dashboardRetryResponseDOList == null || dashboardRetryResponseDOList.size() < 1) { continue; } diff --git a/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/schedule/OfflineNodeSchedule.java b/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/schedule/OfflineNodeSchedule.java index f7dafac2..9ce9d8b2 100644 --- a/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/schedule/OfflineNodeSchedule.java +++ b/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/schedule/OfflineNodeSchedule.java @@ -8,6 +8,8 @@ import com.aizuda.easy.retry.server.common.cache.CacheRegisterTable; import com.aizuda.easy.retry.server.common.register.ServerRegister; import com.aizuda.easy.retry.server.common.schedule.AbstractSchedule; import com.aizuda.easy.retry.template.datasource.persistence.mapper.ServerNodeMapper; +import com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -41,7 +43,7 @@ public class OfflineNodeSchedule extends AbstractSchedule implements Lifecycle { ServerRegister.DELAY_TIME + (ServerRegister.DELAY_TIME / 3)); // 先删除DB中需要下线的机器 - serverNodeMapper.deleteByExpireAt(endTime); + serverNodeMapper.delete(new LambdaQueryWrapper().le(ServerNode::getExpireAt, endTime)); Set allPods = CacheRegisterTable.getAllPods(); Set waitOffline = allPods.stream().filter(registerNodeInfo -> registerNodeInfo.getExpireAt().isBefore(endTime)).collect( diff --git a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java index cad94a13..ca2ce6cd 100644 --- a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java +++ b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java @@ -1,5 +1,6 @@ package com.aizuda.easy.retry.server.web.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.aizuda.easy.retry.common.core.enums.NodeTypeEnum; import com.aizuda.easy.retry.common.core.model.Result; @@ -8,7 +9,6 @@ import com.aizuda.easy.retry.common.core.util.NetUtil; import com.aizuda.easy.retry.common.log.EasyRetryLog; import com.aizuda.easy.retry.server.common.dto.DistributeInstance; import com.aizuda.easy.retry.server.common.dto.ServerNodeExtAttrs; -import com.aizuda.easy.retry.server.common.enums.DashboardLineEnum; import com.aizuda.easy.retry.server.common.enums.SyetemTaskTypeEnum; import com.aizuda.easy.retry.server.common.enums.SystemModeEnum; import com.aizuda.easy.retry.server.common.register.ServerRegister; @@ -32,7 +32,7 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.Dashboar import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobSummaryMapper; import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetrySummaryMapper; import com.aizuda.easy.retry.template.datasource.persistence.mapper.ServerNodeMapper; -import com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode; +import com.aizuda.easy.retry.template.datasource.persistence.po.*; import com.aizuda.easy.retry.template.datasource.utils.DbUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -79,15 +79,26 @@ public class DashBoardServiceImpl implements DashBoardService { List groupNames = userSessionVO.isUser() ? userSessionVO.getGroupNames() : new ArrayList<>(); DashboardCardResponseVO dashboardCardResponseVO = new DashboardCardResponseVO(); // 重试任务 - DashboardCardResponseDO.RetryTask retryTaskDO = retrySummaryMapper.retryTask(namespaceId, groupNames); + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper() + .eq(RetrySummary::getNamespaceId, namespaceId) + .in(CollUtil.isNotEmpty(groupNames), RetrySummary::getGroupName, groupNames); + DashboardCardResponseDO.RetryTask retryTaskDO = retrySummaryMapper.retryTask(wrapper2); DashboardCardResponseVO.RetryTask retryTaskVO = RetrySummaryResponseVOConverter.INSTANCE.toRetryTask(retryTaskDO); dashboardCardResponseVO.setRetryTask(retryTaskVO); // 定时任务 - DashboardCardResponseDO.JobTask jobTaskDO = jobSummaryMapper.toJobTask(SyetemTaskTypeEnum.JOB.getType(), namespaceId, groupNames); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(JobSummary::getSystemTaskType, SyetemTaskTypeEnum.JOB.getType()) + .eq(JobSummary::getNamespaceId, namespaceId) + .in(CollUtil.isNotEmpty(groupNames), JobSummary::getGroupName, groupNames); + DashboardCardResponseDO.JobTask jobTaskDO = jobSummaryMapper.toJobTask(wrapper); DashboardCardResponseVO.JobTask jobTaskVO = JobSummaryResponseVOConverter.INSTANCE.toTaskJob(jobTaskDO); dashboardCardResponseVO.setJobTask(jobTaskVO); // 工作流任务 - DashboardCardResponseDO.JobTask workFlowTaskDO = jobSummaryMapper.toJobTask(SyetemTaskTypeEnum.WORKFLOW.getType(), namespaceId, groupNames); + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper() + .eq(JobSummary::getSystemTaskType, SyetemTaskTypeEnum.WORKFLOW.getType()) + .eq(JobSummary::getNamespaceId, namespaceId) + .in(CollUtil.isNotEmpty(groupNames), JobSummary::getGroupName, groupNames); + DashboardCardResponseDO.JobTask workFlowTaskDO = jobSummaryMapper.toJobTask(wrapper1); DashboardCardResponseVO.WorkFlowTask workFlowTaskVO = JobSummaryResponseVOConverter.INSTANCE.toWorkFlowTask(workFlowTaskDO); dashboardCardResponseVO.setWorkFlowTask(workFlowTaskVO); // 重试任务柱状图 @@ -96,8 +107,11 @@ public class DashBoardServiceImpl implements DashBoardService { DashboardCardResponseVO.RetryTaskBar retryTaskBar = new DashboardCardResponseVO.RetryTaskBar().setX(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(-i).toLocalDate().toString()).setTaskTotal(0L); retryTaskBarMap.put(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(-i), retryTaskBar); } - - List retryTaskList = retrySummaryMapper.retryTaskBarList(namespaceId, groupNames); + LambdaQueryWrapper wrapper3 = new LambdaQueryWrapper() + .eq(RetrySummary::getNamespaceId, namespaceId) + .in(CollUtil.isNotEmpty(groupNames), RetrySummary::getGroupName, groupNames) + .orderByDesc(RetrySummary::getId); + List retryTaskList = retrySummaryMapper.retryTaskBarList(wrapper3); Map summaryStatisticsMap = retryTaskList.stream().collect(Collectors.groupingBy(DashboardCardResponseDO.RetryTask::getTriggerAt, Collectors.summarizingLong(i -> i.getMaxCountNum() + i.getRunningNum() + i.getSuspendNum() + i.getFinishNum()))); for (Map.Entry map : summaryStatisticsMap.entrySet()) { @@ -108,7 +122,10 @@ public class DashBoardServiceImpl implements DashBoardService { } dashboardCardResponseVO.setRetryTaskBarList(new ArrayList<>(retryTaskBarMap.values())); // 在线Pods - List activePodQuantityDO = serverNodeMapper.countActivePod(Lists.newArrayList(userSessionVO.getNamespaceId(), ServerRegister.NAMESPACE_ID)); + LambdaQueryWrapper wrapper4 = new LambdaQueryWrapper() + .in(ServerNode::getNamespaceId, Lists.newArrayList(userSessionVO.getNamespaceId(), ServerRegister.NAMESPACE_ID)) + .groupBy(ServerNode::getNodeType); + List activePodQuantityDO = serverNodeMapper.countActivePod(wrapper4); Map map = activePodQuantityDO.stream().collect(Collectors.toMap(ActivePodQuantityResponseDO::getNodeType, ActivePodQuantityResponseDO::getTotal)); Long clientTotal = map.getOrDefault(NodeTypeEnum.CLIENT.getType(), 0L); Long serverTotal = map.getOrDefault(NodeTypeEnum.SERVER.getType(), 0L); @@ -133,7 +150,10 @@ public class DashBoardServiceImpl implements DashBoardService { if (DbTypeEnum.SQLSERVER == DbUtils.getDbType()) { pager.setCountId("sqlServer_jobTaskList_Count"); } - IPage IPage = retrySummaryMapper.retryTaskList(namespaceId, groupNames, pager); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(SceneConfig::getNamespaceId, namespaceId) + .in(CollUtil.isNotEmpty(groupNames), SceneConfig::getGroupName, groupNames); + IPage IPage = retrySummaryMapper.retryTaskList(wrapper, pager); List taskList = JobSummaryResponseVOConverter.INSTANCE.toDashboardRetryLineResponseVO(IPage.getRecords()); PageResult> pageResult = new PageResult<>(new PageDTO(IPage.getCurrent(), IPage.getSize(), IPage.getTotal()), taskList); dashboardRetryLineResponseVO.setTaskList(pageResult); @@ -142,14 +162,26 @@ public class DashBoardServiceImpl implements DashBoardService { DateTypeEnum dateTypeEnum = DateTypeEnum.valueOf(type); LocalDateTime startDateTime = dateTypeEnum.getStartTime().apply(StrUtil.isNotBlank(startTime) ? LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null); LocalDateTime endDateTime = dateTypeEnum.getEndTime().apply(StrUtil.isNotBlank(endTime) ? LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null); - List dashboardRetryLinkeResponseDOList = retrySummaryMapper.retryLineList(namespaceId, groupNames, groupName, type, startDateTime, endDateTime); + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper() + .in(CollUtil.isNotEmpty(groupNames), RetrySummary::getGroupName, groupNames) + .eq(StrUtil.isNotBlank(groupName), RetrySummary::getGroupName, groupNames) + .eq(RetrySummary::getNamespaceId, namespaceId) + .between(RetrySummary::getTriggerAt, startDateTime, endDateTime); + List dashboardRetryLinkeResponseDOList = retrySummaryMapper.retryLineList(wrapper1); List dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardRetryLinkeResponseDOList); dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList); dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt())); dashboardRetryLineResponseVO.setDashboardLineResponseDOList(dashboardLineResponseVOList); // 排行榜 - List rankList = retrySummaryMapper.dashboardRank(namespaceId, groupNames, groupName, startDateTime, endDateTime); + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper() + .in(CollUtil.isNotEmpty(groupNames), RetrySummary::getGroupName, groupNames) + .eq(StrUtil.isNotBlank(groupName), RetrySummary::getGroupName, groupNames) + .eq(RetrySummary::getNamespaceId, namespaceId) + .ge(RetrySummary::getTriggerAt, startDateTime) + .le(RetrySummary::getTriggerAt, endDateTime) + .groupBy(RetrySummary::getNamespaceId, RetrySummary::getGroupName, RetrySummary::getSceneName); + List rankList = retrySummaryMapper.dashboardRank(wrapper2); List ranks = SceneQuantityRankResponseVOConverter.INSTANCE.toDashboardRetryLineResponseVORank(rankList); dashboardRetryLineResponseVO.setRankList(ranks); return dashboardRetryLineResponseVO; @@ -171,7 +203,10 @@ public class DashBoardServiceImpl implements DashBoardService { } // 任务类型 Integer systemTaskType = SystemModeEnum.JOB.name().equals(mode) ? SyetemTaskTypeEnum.JOB.getType() : SyetemTaskTypeEnum.WORKFLOW.getType(); - IPage IPage = jobSummaryMapper.jobTaskList(namespaceId, groupNames, pager); + LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper() + .eq(Job::getNamespaceId, namespaceId) + .in(CollUtil.isNotEmpty(groupNames), Job::getGroupName, groupNames); + IPage IPage = jobSummaryMapper.jobTaskList(wrapper1, pager); List taskList = JobSummaryResponseVOConverter.INSTANCE.toDashboardRetryLineResponseVO(IPage.getRecords()); PageResult> pageResult = new PageResult<>(new PageDTO(IPage.getCurrent(), IPage.getSize(), IPage.getTotal()), taskList); dashboardRetryLineResponseVO.setTaskList(pageResult); @@ -180,14 +215,27 @@ public class DashBoardServiceImpl implements DashBoardService { DateTypeEnum dateTypeEnum = DateTypeEnum.valueOf(type); LocalDateTime startDateTime = dateTypeEnum.getStartTime().apply(StrUtil.isNotBlank(startTime) ? LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null); LocalDateTime endDateTime = dateTypeEnum.getEndTime().apply(StrUtil.isNotBlank(endTime) ? LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null); - List dashboardLineResponseDOList = jobSummaryMapper.jobLineList(systemTaskType, namespaceId, groupNames, groupName, DashboardLineEnum.modeOf(type).getDateFormat(), startDateTime, endDateTime); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .in(CollUtil.isNotEmpty(groupNames), JobSummary::getGroupName, groupNames) + .eq(StrUtil.isNotBlank(groupName), JobSummary::getGroupName, groupName) + .eq(JobSummary::getSystemTaskType, systemTaskType) + .eq(JobSummary::getNamespaceId, namespaceId) + .between(JobSummary::getTriggerAt, startDateTime, endDateTime); + List dashboardLineResponseDOList = jobSummaryMapper.jobLineList(queryWrapper); List dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardLineResponseDOList); dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList); dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt())); dashboardRetryLineResponseVO.setDashboardLineResponseDOList(dashboardLineResponseVOList); // 排行榜 - List rankList = jobSummaryMapper.dashboardRank(systemTaskType, namespaceId, groupNames, groupName, startDateTime, endDateTime); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .in(CollUtil.isNotEmpty(groupNames), JobSummary::getGroupName, groupNames) + .eq(StrUtil.isNotBlank(groupName), JobSummary::getGroupName, groupName) + .ge(JobSummary::getTriggerAt, startDateTime).le(JobSummary::getTriggerAt, endDateTime) + .eq(JobSummary::getSystemTaskType, systemTaskType) + .eq(JobSummary::getNamespaceId, namespaceId) + .groupBy(JobSummary::getNamespaceId, JobSummary::getGroupName, JobSummary::getBusinessId); + List rankList = jobSummaryMapper.dashboardRank(wrapper); List ranks = SceneQuantityRankResponseVOConverter.INSTANCE.toDashboardRetryLineResponseVORank(rankList); dashboardRetryLineResponseVO.setRankList(ranks); return dashboardRetryLineResponseVO; diff --git a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobBatchServiceImpl.java b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobBatchServiceImpl.java index 8c4e27a9..d144f0f7 100644 --- a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobBatchServiceImpl.java +++ b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobBatchServiceImpl.java @@ -1,5 +1,6 @@ package com.aizuda.easy.retry.server.web.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import com.aizuda.easy.retry.client.model.ExecuteResult; @@ -42,6 +43,7 @@ import com.aizuda.easy.retry.template.datasource.persistence.po.JobTask; import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch; import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowNode; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.google.common.collect.Lists; import lombok.RequiredArgsConstructor; @@ -87,17 +89,25 @@ public class JobBatchServiceImpl implements JobBatchService { } } - JobBatchQueryDO jobBatchQueryDO = new JobBatchQueryDO(); + JobBatchQueryDO queryDO = new JobBatchQueryDO(); if (StrUtil.isNotBlank(queryVO.getJobName())) { - jobBatchQueryDO.setJobName(queryVO.getJobName() + "%"); + queryDO.setJobName(queryVO.getJobName() + "%"); } - jobBatchQueryDO.setJobId(queryVO.getJobId()); - jobBatchQueryDO.setTaskBatchStatus(queryVO.getTaskBatchStatus()); - jobBatchQueryDO.setGroupNames(groupNames); - jobBatchQueryDO.setNamespaceId(userSessionVO.getNamespaceId()); - List batchResponseDOList = jobTaskBatchMapper.selectJobBatchPageList(pageDTO, - jobBatchQueryDO); + queryDO.setJobId(queryVO.getJobId()); + queryDO.setTaskBatchStatus(queryVO.getTaskBatchStatus()); + queryDO.setGroupNames(groupNames); + queryDO.setNamespaceId(userSessionVO.getNamespaceId()); + QueryWrapper wrapper = new QueryWrapper() + .eq("a.namespace_id", queryDO.getNamespaceId()) + .eq("a.system_task_type", 3) + .eq(queryDO.getJobId() != null, "a.job_id", queryDO.getJobId()) + .in(CollUtil.isNotEmpty(queryDO.getGroupNames()), "a.group_name", queryDO.getGroupNames()) + .eq(queryDO.getTaskBatchStatus() != null, "task_batch_status", queryDO.getTaskBatchStatus()) + .eq(StrUtil.isNotBlank(queryDO.getJobName()), "job_name", queryDO.getJobName()) + .eq("a.deleted", 0) + .orderByDesc("a.id"); + List batchResponseDOList = jobTaskBatchMapper.selectJobBatchPageList(pageDTO, wrapper); List batchResponseVOList = JobBatchResponseVOConverter.INSTANCE.toJobBatchResponseVOs( batchResponseDOList); diff --git a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobNotifyConfigServiceImpl.java b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobNotifyConfigServiceImpl.java index 0813906f..506df349 100644 --- a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobNotifyConfigServiceImpl.java +++ b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/JobNotifyConfigServiceImpl.java @@ -1,5 +1,6 @@ package com.aizuda.easy.retry.server.web.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import com.aizuda.easy.retry.common.core.util.JsonUtil; @@ -13,14 +14,12 @@ import com.aizuda.easy.retry.server.web.service.JobNotifyConfigService; import com.aizuda.easy.retry.server.web.service.convert.JobNotifyConfigConverter; import com.aizuda.easy.retry.server.web.service.convert.JobNotifyConfigResponseVOConverter; import com.aizuda.easy.retry.server.web.util.UserSessionUtils; -import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchQueryDO; -import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigQueryDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobNotifyConfigMapper; -import com.aizuda.easy.retry.template.datasource.persistence.po.Job; import com.aizuda.easy.retry.template.datasource.persistence.po.JobNotifyConfig; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; @@ -46,8 +45,8 @@ public class JobNotifyConfigServiceImpl implements JobNotifyConfigService { public PageResult> getJobNotifyConfigList(JobNotifyConfigQueryVO queryVO) { PageDTO pageDTO = new PageDTO<>(); UserSessionVO userSessionVO = UserSessionUtils.currentUserSession(); - JobNotifyConfigQueryDO jobNotifyConfigQueryDO = new JobNotifyConfigQueryDO(); - jobNotifyConfigQueryDO.setNamespaceId(userSessionVO.getNamespaceId()); + JobNotifyConfigQueryDO queryDO = new JobNotifyConfigQueryDO(); + queryDO.setNamespaceId(userSessionVO.getNamespaceId()); List groupNames = Lists.newArrayList(); if (userSessionVO.isUser()) { @@ -63,11 +62,16 @@ public class JobNotifyConfigServiceImpl implements JobNotifyConfigService { } } - jobNotifyConfigQueryDO.setGroupNames(groupNames); + queryDO.setGroupNames(groupNames); if (Objects.nonNull(queryVO.getJobId())) { - jobNotifyConfigQueryDO.setJobId(queryVO.getJobId()); + queryDO.setJobId(queryVO.getJobId()); } - List batchResponseDOList = jobNotifyConfigMapper.selectJobNotifyConfigList(pageDTO, jobNotifyConfigQueryDO); + QueryWrapper queryWrapper = new QueryWrapper() + .eq("a.namespace_id", queryDO.getNamespaceId()) + .eq(queryDO.getJobId() != null, "a.job_id", queryDO.getJobId()) + .in(CollUtil.isNotEmpty(queryDO.getGroupNames()), "a.group_name", queryDO.getGroupNames()) + .orderByDesc("a.id"); + List batchResponseDOList = jobNotifyConfigMapper.selectJobNotifyConfigList(pageDTO, queryWrapper); return new PageResult<>(pageDTO, JobNotifyConfigResponseVOConverter.INSTANCE.batchConvert(batchResponseDOList)); } diff --git a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/WorkflowBatchServiceImpl.java b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/WorkflowBatchServiceImpl.java index 6ede249e..3dfd4983 100644 --- a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/WorkflowBatchServiceImpl.java +++ b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/WorkflowBatchServiceImpl.java @@ -1,5 +1,6 @@ package com.aizuda.easy.retry.server.web.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import com.aizuda.easy.retry.common.core.constant.SystemConstants; @@ -35,6 +36,7 @@ import com.aizuda.easy.retry.template.datasource.persistence.po.Workflow; import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowNode; import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowTaskBatch; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -85,16 +87,24 @@ public class WorkflowBatchServiceImpl implements WorkflowBatchService { } } - WorkflowBatchQueryDO workflowBatchQueryDO = new WorkflowBatchQueryDO(); + WorkflowBatchQueryDO queryDO = new WorkflowBatchQueryDO(); if (StrUtil.isNotBlank(queryVO.getWorkflowName())) { - workflowBatchQueryDO.setWorkflowName(queryVO.getWorkflowName() + "%"); + queryDO.setWorkflowName(queryVO.getWorkflowName() + "%"); } - workflowBatchQueryDO.setWorkflowId(queryVO.getWorkflowId()); - workflowBatchQueryDO.setTaskBatchStatus(queryVO.getTaskBatchStatus()); - workflowBatchQueryDO.setGroupNames(groupNames); - workflowBatchQueryDO.setNamespaceId(userSessionVO.getNamespaceId()); - List batchResponseDOList = workflowTaskBatchMapper.selectWorkflowBatchPageList(pageDTO, workflowBatchQueryDO); + queryDO.setWorkflowId(queryVO.getWorkflowId()); + queryDO.setTaskBatchStatus(queryVO.getTaskBatchStatus()); + queryDO.setGroupNames(groupNames); + queryDO.setNamespaceId(userSessionVO.getNamespaceId()); + QueryWrapper wrapper = new QueryWrapper() + .eq("a.namespace_id", queryDO.getNamespaceId()) + .eq(queryDO.getWorkflowId() != null, "a.workflow_id", queryVO.getWorkflowId()) + .in(CollUtil.isNotEmpty(groupNames), "a.group_name", groupNames) + .eq(queryDO.getTaskBatchStatus() != null, "task_batch_status", queryDO.getTaskBatchStatus()) + .eq(StrUtil.isNotBlank(queryDO.getWorkflowName()), "b.workflow_name", queryDO.getWorkflowName()) + .eq("a.deleted", 0) + .orderByDesc("a.id"); + List batchResponseDOList = workflowTaskBatchMapper.selectWorkflowBatchPageList(pageDTO, wrapper); List batchResponseVOList = WorkflowConverter.INSTANCE.toWorkflowBatchResponseVO(batchResponseDOList);