Commit 30e886be6f0ab3275b8244b82a83537694e4ba6f
1 parent
e24c8c34
解决 PostgreSQL 集成 Quartz 时的报错
Showing
18 changed files
with
98 additions
and
68 deletions
sql/ruoyi-vue-pro.sql
| @@ -1672,7 +1672,7 @@ CREATE TABLE `infra_codegen_column` ( | @@ -1672,7 +1672,7 @@ CREATE TABLE `infra_codegen_column` ( | ||
| 1672 | `column_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段描述', | 1672 | `column_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段描述', |
| 1673 | `nullable` bit(1) NOT NULL COMMENT '是否允许为空', | 1673 | `nullable` bit(1) NOT NULL COMMENT '是否允许为空', |
| 1674 | `primary_key` bit(1) NOT NULL COMMENT '是否主键', | 1674 | `primary_key` bit(1) NOT NULL COMMENT '是否主键', |
| 1675 | - `auto_Increment` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '是否自增', | 1675 | + `auto_increment` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '是否自增', |
| 1676 | `ordinal_position` int NOT NULL COMMENT '排序', | 1676 | `ordinal_position` int NOT NULL COMMENT '排序', |
| 1677 | `java_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性类型', | 1677 | `java_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性类型', |
| 1678 | `java_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性名', | 1678 | `java_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性名', |
yudao-framework/yudao-spring-boot-starter-job/pom.xml
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/IdTypeEnvironmentPostProcessor.java
| @@ -24,22 +24,28 @@ public class IdTypeEnvironmentPostProcessor implements EnvironmentPostProcessor | @@ -24,22 +24,28 @@ public class IdTypeEnvironmentPostProcessor implements EnvironmentPostProcessor | ||
| 24 | 24 | ||
| 25 | private static final String DATASOURCE_DYNAMIC_KEY = "spring.datasource.dynamic"; | 25 | private static final String DATASOURCE_DYNAMIC_KEY = "spring.datasource.dynamic"; |
| 26 | 26 | ||
| 27 | + private static final String QUARTZ_JOB_STORE_DRIVER_KEY = "spring.quartz.properties.org.quartz.jobStore.driverDelegateClass"; | ||
| 28 | + | ||
| 27 | private static final Set<DbType> INPUT_ID_TYPES = SetUtils.asSet(DbType.ORACLE, DbType.ORACLE_12C, | 29 | private static final Set<DbType> INPUT_ID_TYPES = SetUtils.asSet(DbType.ORACLE, DbType.ORACLE_12C, |
| 28 | DbType.POSTGRE_SQL, DbType.KINGBASE_ES, DbType.DB2, DbType.H2); | 30 | DbType.POSTGRE_SQL, DbType.KINGBASE_ES, DbType.DB2, DbType.H2); |
| 29 | 31 | ||
| 30 | @Override | 32 | @Override |
| 31 | public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { | 33 | public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { |
| 32 | - // 如果非 NONE,则不进行处理 | ||
| 33 | - IdType idType = getIdType(environment); | ||
| 34 | - if (idType != IdType.NONE) { | ||
| 35 | - return; | ||
| 36 | - } | ||
| 37 | // 如果获取不到 DbType,则不进行处理 | 34 | // 如果获取不到 DbType,则不进行处理 |
| 38 | DbType dbType = getDbType(environment); | 35 | DbType dbType = getDbType(environment); |
| 39 | if (dbType == null) { | 36 | if (dbType == null) { |
| 40 | return; | 37 | return; |
| 41 | } | 38 | } |
| 42 | 39 | ||
| 40 | + // 设置 Quartz JobStore 对应的 Driver | ||
| 41 | + // TODO 芋艿:暂时没有找到特别合适的地方,先放在这里 | ||
| 42 | + setJobStoreDriverIfPresent(environment, dbType); | ||
| 43 | + | ||
| 44 | + // 如果非 NONE,则不进行处理 | ||
| 45 | + IdType idType = getIdType(environment); | ||
| 46 | + if (idType != IdType.NONE) { | ||
| 47 | + return; | ||
| 48 | + } | ||
| 43 | // 情况一,用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库 | 49 | // 情况一,用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库 |
| 44 | if (INPUT_ID_TYPES.contains(dbType)) { | 50 | if (INPUT_ID_TYPES.contains(dbType)) { |
| 45 | setIdType(environment, IdType.INPUT); | 51 | setIdType(environment, IdType.INPUT); |
| @@ -58,6 +64,28 @@ public class IdTypeEnvironmentPostProcessor implements EnvironmentPostProcessor | @@ -58,6 +64,28 @@ public class IdTypeEnvironmentPostProcessor implements EnvironmentPostProcessor | ||
| 58 | log.info("[setIdType][修改 MyBatis Plus 的 idType 为({})]", idType); | 64 | log.info("[setIdType][修改 MyBatis Plus 的 idType 为({})]", idType); |
| 59 | } | 65 | } |
| 60 | 66 | ||
| 67 | + public void setJobStoreDriverIfPresent(ConfigurableEnvironment environment, DbType dbType) { | ||
| 68 | + String driverClass = environment.getProperty(QUARTZ_JOB_STORE_DRIVER_KEY); | ||
| 69 | + if (StrUtil.isNotEmpty(driverClass)) { | ||
| 70 | + return; | ||
| 71 | + } | ||
| 72 | + // 根据 dbType 类型,获取对应的 driverClass | ||
| 73 | + switch (dbType) { | ||
| 74 | + case POSTGRE_SQL: | ||
| 75 | + driverClass = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate"; | ||
| 76 | + break; | ||
| 77 | + case ORACLE: | ||
| 78 | + case ORACLE_12C: | ||
| 79 | + driverClass = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate"; | ||
| 80 | + break; | ||
| 81 | + } | ||
| 82 | + // 设置 driverClass 变量 | ||
| 83 | + if (StrUtil.isNotEmpty(driverClass)) { | ||
| 84 | + environment.getSystemProperties().put(QUARTZ_JOB_STORE_DRIVER_KEY, driverClass); | ||
| 85 | + | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 61 | public static DbType getDbType(ConfigurableEnvironment environment) { | 89 | public static DbType getDbType(ConfigurableEnvironment environment) { |
| 62 | String primary = environment.getProperty(DATASOURCE_DYNAMIC_KEY + "." + "primary"); | 90 | String primary = environment.getProperty(DATASOURCE_DYNAMIC_KEY + "." + "primary"); |
| 63 | if (StrUtil.isEmpty(primary)) { | 91 | if (StrUtil.isEmpty(primary)) { |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/SqlConstants.java
| @@ -5,7 +5,6 @@ package cn.iocoder.yudao.framework.mybatis.core.enums; | @@ -5,7 +5,6 @@ package cn.iocoder.yudao.framework.mybatis.core.enums; | ||
| 5 | */ | 5 | */ |
| 6 | public interface SqlConstants { | 6 | public interface SqlConstants { |
| 7 | 7 | ||
| 8 | - | ||
| 9 | String LIMIT1 = "LIMIT 1"; | 8 | String LIMIT1 = "LIMIT 1"; |
| 10 | 9 | ||
| 11 | } | 10 | } |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java
| @@ -43,7 +43,7 @@ public class BpmOALeaveDO extends BaseDO { | @@ -43,7 +43,7 @@ public class BpmOALeaveDO extends BaseDO { | ||
| 43 | * 请假类型 | 43 | * 请假类型 |
| 44 | */ | 44 | */ |
| 45 | @TableField("\"type\"") | 45 | @TableField("\"type\"") |
| 46 | - private String type; | 46 | + private Integer type; |
| 47 | /** | 47 | /** |
| 48 | * 原因 | 48 | * 原因 |
| 49 | */ | 49 | */ |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/definition/BpmFormMapper.java
| 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.definition; | 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.definition; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 8 | -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; | ||
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| @@ -17,9 +17,9 @@ import org.apache.ibatis.annotations.Mapper; | @@ -17,9 +17,9 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 17 | public interface BpmFormMapper extends BaseMapperX<BpmFormDO> { | 17 | public interface BpmFormMapper extends BaseMapperX<BpmFormDO> { |
| 18 | 18 | ||
| 19 | default PageResult<BpmFormDO> selectPage(BpmFormPageReqVO reqVO) { | 19 | default PageResult<BpmFormDO> selectPage(BpmFormPageReqVO reqVO) { |
| 20 | - return selectPage(reqVO, new QueryWrapperX<BpmFormDO>() | ||
| 21 | - .likeIfPresent("name", reqVO.getName()) | ||
| 22 | - .orderByDesc("id")); | 20 | + return selectPage(reqVO, new LambdaQueryWrapperX<BpmFormDO>() |
| 21 | + .likeIfPresent(BpmFormDO::getName, reqVO.getName()) | ||
| 22 | + .orderByDesc(BpmFormDO::getId)); | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | } | 25 | } |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/definition/BpmProcessDefinitionExtMapper.java
| 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.definition; | 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.definition; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 4 | -import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; | ||
| 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; | ||
| 6 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 6 | ||
| 8 | import java.util.Collection; | 7 | import java.util.Collection; |
| @@ -12,11 +11,11 @@ import java.util.List; | @@ -12,11 +11,11 @@ import java.util.List; | ||
| 12 | public interface BpmProcessDefinitionExtMapper extends BaseMapperX<BpmProcessDefinitionExtDO> { | 11 | public interface BpmProcessDefinitionExtMapper extends BaseMapperX<BpmProcessDefinitionExtDO> { |
| 13 | 12 | ||
| 14 | default List<BpmProcessDefinitionExtDO> selectListByProcessDefinitionIds(Collection<String> processDefinitionIds) { | 13 | default List<BpmProcessDefinitionExtDO> selectListByProcessDefinitionIds(Collection<String> processDefinitionIds) { |
| 15 | - return selectList("process_definition_id", processDefinitionIds); | 14 | + return selectList(BpmProcessDefinitionExtDO::getProcessDefinitionId, processDefinitionIds); |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 18 | default BpmProcessDefinitionExtDO selectByProcessDefinitionId(String processDefinitionId) { | 17 | default BpmProcessDefinitionExtDO selectByProcessDefinitionId(String processDefinitionId) { |
| 19 | - return selectOne("process_definition_id", processDefinitionId); | 18 | + return selectOne(BpmProcessDefinitionExtDO::getProcessDefinitionId, processDefinitionId); |
| 20 | } | 19 | } |
| 21 | 20 | ||
| 22 | } | 21 | } |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/task/BpmProcessInstanceExtMapper.java
| 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.task; | 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.task; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceMyPageReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 7 | -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | ||
| 8 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceMyPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO; | ||
| 9 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 9 | ||
| 11 | @Mapper | 10 | @Mapper |
| 12 | public interface BpmProcessInstanceExtMapper extends BaseMapperX<BpmProcessInstanceExtDO> { | 11 | public interface BpmProcessInstanceExtMapper extends BaseMapperX<BpmProcessInstanceExtDO> { |
| 13 | 12 | ||
| 14 | default PageResult<BpmProcessInstanceExtDO> selectPage(Long userId, BpmProcessInstanceMyPageReqVO reqVO) { | 13 | default PageResult<BpmProcessInstanceExtDO> selectPage(Long userId, BpmProcessInstanceMyPageReqVO reqVO) { |
| 15 | - return selectPage(reqVO, new QueryWrapperX<BpmProcessInstanceExtDO>() | ||
| 16 | - .eqIfPresent("start_user_id", userId) | ||
| 17 | - .likeIfPresent("name", reqVO.getName()) | ||
| 18 | - .eqIfPresent("process_definition_id", reqVO.getProcessDefinitionId()) | ||
| 19 | - .eqIfPresent("category", reqVO.getCategory()) | ||
| 20 | - .eqIfPresent("status", reqVO.getStatus()) | ||
| 21 | - .eqIfPresent("result", reqVO.getResult()) | ||
| 22 | - .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 23 | - .orderByDesc("id")); | 14 | + return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessInstanceExtDO>() |
| 15 | + .eqIfPresent(BpmProcessInstanceExtDO::getStartUserId, userId) | ||
| 16 | + .likeIfPresent(BpmProcessInstanceExtDO::getName, reqVO.getName()) | ||
| 17 | + .eqIfPresent(BpmProcessInstanceExtDO::getProcessDefinitionId, reqVO.getProcessDefinitionId()) | ||
| 18 | + .eqIfPresent(BpmProcessInstanceExtDO::getCategory, reqVO.getCategory()) | ||
| 19 | + .eqIfPresent(BpmProcessInstanceExtDO::getStatus, reqVO.getStatus()) | ||
| 20 | + .eqIfPresent(BpmProcessInstanceExtDO::getResult, reqVO.getResult()) | ||
| 21 | + .betweenIfPresent(BpmProcessInstanceExtDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 22 | + .orderByDesc(BpmProcessInstanceExtDO::getId)); | ||
| 24 | } | 23 | } |
| 25 | 24 | ||
| 26 | default BpmProcessInstanceExtDO selectByProcessInstanceId(String processDefinitionId) { | 25 | default BpmProcessInstanceExtDO selectByProcessInstanceId(String processDefinitionId) { |
| 27 | - return selectOne("process_instance_id", processDefinitionId); | 26 | + return selectOne(BpmProcessInstanceExtDO::getProcessInstanceId, processDefinitionId); |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | default void updateByProcessInstanceId(BpmProcessInstanceExtDO updateObj) { | 29 | default void updateByProcessInstanceId(BpmProcessInstanceExtDO updateObj) { |
| 31 | - update(updateObj, new QueryWrapper<BpmProcessInstanceExtDO>() | ||
| 32 | - .eq("process_instance_id", updateObj.getProcessInstanceId())); | 30 | + update(updateObj, new LambdaQueryWrapperX<BpmProcessInstanceExtDO>() |
| 31 | + .eq(BpmProcessInstanceExtDO::getProcessInstanceId, updateObj.getProcessInstanceId())); | ||
| 33 | } | 32 | } |
| 34 | 33 | ||
| 35 | } | 34 | } |
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/task/BpmTaskExtMapper.java
| 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.task; | 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.task; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; | ||
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; | ||
| 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 7 | ||
| @@ -20,6 +20,6 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> { | @@ -20,6 +20,6 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> { | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | default List<BpmTaskExtDO> selectListByProcessInstanceId(String processInstanceId) { | 22 | default List<BpmTaskExtDO> selectListByProcessInstanceId(String processInstanceId) { |
| 23 | - return selectList("process_instance_id", processInstanceId); | 23 | + return selectList(BpmTaskExtDO::getProcessInstanceId, processInstanceId); |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileDO.java
| @@ -47,7 +47,7 @@ public class FileDO extends BaseDO { | @@ -47,7 +47,7 @@ public class FileDO extends BaseDO { | ||
| 47 | * | 47 | * |
| 48 | * 通过 {@link cn.hutool.core.io.FileTypeUtil#getType(InputStream)} 获取 | 48 | * 通过 {@link cn.hutool.core.io.FileTypeUtil#getType(InputStream)} 获取 |
| 49 | */ | 49 | */ |
| 50 | - @TableField(value = "`type`") | 50 | + @TableField("\"type\"") |
| 51 | private String type; | 51 | private String type; |
| 52 | /** | 52 | /** |
| 53 | * 文件大小 | 53 | * 文件大小 |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/codegen/CodegenColumnMapper.java
| 1 | package cn.iocoder.yudao.module.infra.dal.mysql.codegen; | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.codegen; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 4 | import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenColumnDO; | 5 | import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenColumnDO; |
| 5 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
| 6 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 7 | ||
| 8 | import java.util.List; | 8 | import java.util.List; |
| @@ -11,12 +11,14 @@ import java.util.List; | @@ -11,12 +11,14 @@ import java.util.List; | ||
| 11 | public interface CodegenColumnMapper extends BaseMapperX<CodegenColumnDO> { | 11 | public interface CodegenColumnMapper extends BaseMapperX<CodegenColumnDO> { |
| 12 | 12 | ||
| 13 | default List<CodegenColumnDO> selectListByTableId(Long tableId) { | 13 | default List<CodegenColumnDO> selectListByTableId(Long tableId) { |
| 14 | - return selectList(new QueryWrapper<CodegenColumnDO>().eq("table_id", tableId) | ||
| 15 | - .orderByAsc("ordinal_position")); | 14 | + return selectList(new LambdaQueryWrapperX<CodegenColumnDO>() |
| 15 | + .eq(CodegenColumnDO::getTableId, tableId) | ||
| 16 | + .orderByAsc(CodegenColumnDO::getId)); | ||
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | default void deleteListByTableId(Long tableId) { | 19 | default void deleteListByTableId(Long tableId) { |
| 19 | - delete(new QueryWrapper<CodegenColumnDO>().eq("table_id", tableId)); | 20 | + delete(new LambdaQueryWrapperX<CodegenColumnDO>() |
| 21 | + .eq(CodegenColumnDO::getTableId, tableId)); | ||
| 20 | } | 22 | } |
| 21 | 23 | ||
| 22 | } | 24 | } |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/codegen/CodegenTableMapper.java
| @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.codegen; | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.codegen; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.table.CodegenTablePageReqVO; | 6 | import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.table.CodegenTablePageReqVO; |
| 7 | import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenTableDO; | 7 | import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenTableDO; |
| 8 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| @@ -18,10 +18,10 @@ public interface CodegenTableMapper extends BaseMapperX<CodegenTableDO> { | @@ -18,10 +18,10 @@ public interface CodegenTableMapper extends BaseMapperX<CodegenTableDO> { | ||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | default PageResult<CodegenTableDO> selectPage(CodegenTablePageReqVO pageReqVO) { | 20 | default PageResult<CodegenTableDO> selectPage(CodegenTablePageReqVO pageReqVO) { |
| 21 | - return selectPage(pageReqVO, new QueryWrapperX<CodegenTableDO>() | ||
| 22 | - .likeIfPresent("table_name", pageReqVO.getTableName()) | ||
| 23 | - .likeIfPresent("table_comment", pageReqVO.getTableComment()) | ||
| 24 | - .betweenIfPresent("create_time", pageReqVO.getBeginCreateTime(), pageReqVO.getEndCreateTime())); | 21 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<CodegenTableDO>() |
| 22 | + .likeIfPresent(CodegenTableDO::getTableName, pageReqVO.getTableName()) | ||
| 23 | + .likeIfPresent(CodegenTableDO::getTableComment, pageReqVO.getTableComment()) | ||
| 24 | + .betweenIfPresent(CodegenTableDO::getCreateTime, pageReqVO.getBeginCreateTime(), pageReqVO.getEndCreateTime())); | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | default List<CodegenTableDO> selectListByDataSourceConfigId(Long dataSourceConfigId) { | 27 | default List<CodegenTableDO> selectListByDataSourceConfigId(Long dataSourceConfigId) { |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java
| @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.file; | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.file; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO; | 6 | import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO; |
| 7 | import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; | 7 | import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; |
| 8 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| @@ -16,11 +16,11 @@ import org.apache.ibatis.annotations.Mapper; | @@ -16,11 +16,11 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 16 | public interface FileMapper extends BaseMapperX<FileDO> { | 16 | public interface FileMapper extends BaseMapperX<FileDO> { |
| 17 | 17 | ||
| 18 | default PageResult<FileDO> selectPage(FilePageReqVO reqVO) { | 18 | default PageResult<FileDO> selectPage(FilePageReqVO reqVO) { |
| 19 | - return selectPage(reqVO, new QueryWrapperX<FileDO>() | ||
| 20 | - .likeIfPresent("path", reqVO.getPath()) | ||
| 21 | - .likeIfPresent("type", reqVO.getType()) | ||
| 22 | - .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 23 | - .orderByDesc("create_time")); | 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<FileDO>() |
| 20 | + .likeIfPresent(FileDO::getPath, reqVO.getPath()) | ||
| 21 | + .likeIfPresent(FileDO::getType, reqVO.getType()) | ||
| 22 | + .betweenIfPresent(FileDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 23 | + .orderByDesc(FileDO::getId)); | ||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | } | 26 | } |
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/DefaultDatabaseQueryTest.java
| 1 | package cn.iocoder.yudao.module.infra.service; | 1 | package cn.iocoder.yudao.module.infra.service; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.util.StrUtil; | ||
| 3 | import com.baomidou.mybatisplus.generator.IDatabaseQuery.DefaultDatabaseQuery; | 4 | import com.baomidou.mybatisplus.generator.IDatabaseQuery.DefaultDatabaseQuery; |
| 4 | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; | 5 | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; |
| 5 | import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder; | 6 | import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder; |
| @@ -10,7 +11,9 @@ import java.util.List; | @@ -10,7 +11,9 @@ import java.util.List; | ||
| 10 | public class DefaultDatabaseQueryTest { | 11 | public class DefaultDatabaseQueryTest { |
| 11 | 12 | ||
| 12 | public static void main(String[] args) { | 13 | public static void main(String[] args) { |
| 13 | - DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder("jdbc:oracle:thin:@127.0.0.1:1521:xe", | 14 | +// DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder("jdbc:oracle:thin:@127.0.0.1:1521:xe", |
| 15 | +// "root", "123456").build(); | ||
| 16 | + DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder("jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro", | ||
| 14 | "root", "123456").build(); | 17 | "root", "123456").build(); |
| 15 | // StrategyConfig strategyConfig = new StrategyConfig.Builder().build(); | 18 | // StrategyConfig strategyConfig = new StrategyConfig.Builder().build(); |
| 16 | 19 | ||
| @@ -21,6 +24,9 @@ public class DefaultDatabaseQueryTest { | @@ -21,6 +24,9 @@ public class DefaultDatabaseQueryTest { | ||
| 21 | long time = System.currentTimeMillis(); | 24 | long time = System.currentTimeMillis(); |
| 22 | List<TableInfo> tableInfos = query.queryTables(); | 25 | List<TableInfo> tableInfos = query.queryTables(); |
| 23 | for (TableInfo tableInfo : tableInfos) { | 26 | for (TableInfo tableInfo : tableInfos) { |
| 27 | + if (StrUtil.startWithAny(tableInfo.getName().toLowerCase(), "act_", "flw_", "qrtz_")) { | ||
| 28 | + continue; | ||
| 29 | + } | ||
| 24 | System.out.println(String.format("CREATE SEQUENCE %s_seq MINVALUE 0;", tableInfo.getName())); | 30 | System.out.println(String.format("CREATE SEQUENCE %s_seq MINVALUE 0;", tableInfo.getName())); |
| 25 | } | 31 | } |
| 26 | System.out.println(tableInfos.size()); | 32 | System.out.println(tableInfos.size()); |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapper.java
| @@ -32,7 +32,6 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | @@ -32,7 +32,6 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | ||
| 32 | .eqIfPresent("fee_rate", reqVO.getFeeRate()) | 32 | .eqIfPresent("fee_rate", reqVO.getFeeRate()) |
| 33 | .eqIfPresent("merchant_id", reqVO.getMerchantId()) | 33 | .eqIfPresent("merchant_id", reqVO.getMerchantId()) |
| 34 | .eqIfPresent("app_id", reqVO.getAppId()) | 34 | .eqIfPresent("app_id", reqVO.getAppId()) |
| 35 | - // .eqIfPresent("config", reqVO.getConfig()) | ||
| 36 | .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | 35 | .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) |
| 37 | .orderByDesc("id") ); | 36 | .orderByDesc("id") ); |
| 38 | } | 37 | } |
| @@ -45,7 +44,6 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | @@ -45,7 +44,6 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> { | ||
| 45 | .eqIfPresent("fee_rate", reqVO.getFeeRate()) | 44 | .eqIfPresent("fee_rate", reqVO.getFeeRate()) |
| 46 | .eqIfPresent("merchant_id", reqVO.getMerchantId()) | 45 | .eqIfPresent("merchant_id", reqVO.getMerchantId()) |
| 47 | .eqIfPresent("app_id", reqVO.getAppId()) | 46 | .eqIfPresent("app_id", reqVO.getAppId()) |
| 48 | - // .eqIfPresent("config", reqVO.getConfig()) | ||
| 49 | .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | 47 | .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) |
| 50 | .orderByDesc("id") ); | 48 | .orderByDesc("id") ); |
| 51 | } | 49 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsChannelMapper.java
| @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms; | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; | 6 | import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; |
| 7 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | 7 | import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; |
| 8 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| @@ -14,11 +14,11 @@ import java.util.Date; | @@ -14,11 +14,11 @@ import java.util.Date; | ||
| 14 | public interface SmsChannelMapper extends BaseMapperX<SmsChannelDO> { | 14 | public interface SmsChannelMapper extends BaseMapperX<SmsChannelDO> { |
| 15 | 15 | ||
| 16 | default PageResult<SmsChannelDO> selectPage(SmsChannelPageReqVO reqVO) { | 16 | default PageResult<SmsChannelDO> selectPage(SmsChannelPageReqVO reqVO) { |
| 17 | - return selectPage(reqVO, new QueryWrapperX<SmsChannelDO>() | ||
| 18 | - .likeIfPresent("signature", reqVO.getSignature()) | ||
| 19 | - .eqIfPresent("status", reqVO.getStatus()) | ||
| 20 | - .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 21 | - .orderByDesc("id")); | 17 | + return selectPage(reqVO, new LambdaQueryWrapperX<SmsChannelDO>() |
| 18 | + .likeIfPresent(SmsChannelDO::getSignature, reqVO.getSignature()) | ||
| 19 | + .eqIfPresent(SmsChannelDO::getStatus, reqVO.getStatus()) | ||
| 20 | + .betweenIfPresent(SmsChannelDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ||
| 21 | + .orderByDesc(SmsChannelDO::getId)); | ||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | @Select("SELECT id FROM system_sms_channel WHERE update_time > #{maxUpdateTime} LIMIT 1") | 24 | @Select("SELECT id FROM system_sms_channel WHERE update_time > #{maxUpdateTime} LIMIT 1") |
yudao-server/pom.xml
| @@ -43,11 +43,11 @@ | @@ -43,11 +43,11 @@ | ||
| 43 | <version>${revision}</version> | 43 | <version>${revision}</version> |
| 44 | </dependency> | 44 | </dependency> |
| 45 | <!-- 默认引入 yudao-module-bpm-biz-flowable 实现,可以替换为 yudao-module-bpm-biz-activiti 实现--> | 45 | <!-- 默认引入 yudao-module-bpm-biz-flowable 实现,可以替换为 yudao-module-bpm-biz-activiti 实现--> |
| 46 | -<!-- <dependency>--> | ||
| 47 | -<!-- <groupId>cn.iocoder.boot</groupId>--> | ||
| 48 | -<!-- <artifactId>yudao-module-bpm-biz-flowable</artifactId>--> | ||
| 49 | -<!-- <version>${revision}</version>--> | ||
| 50 | -<!-- </dependency>--> | 46 | + <dependency> |
| 47 | + <groupId>cn.iocoder.boot</groupId> | ||
| 48 | + <artifactId>yudao-module-bpm-biz-flowable</artifactId> | ||
| 49 | + <version>${revision}</version> | ||
| 50 | + </dependency> | ||
| 51 | <!-- <dependency>--> | 51 | <!-- <dependency>--> |
| 52 | <!-- <groupId>cn.iocoder.boot</groupId>--> | 52 | <!-- <groupId>cn.iocoder.boot</groupId>--> |
| 53 | <!-- <artifactId>yudao-module-bpm-biz-activiti</artifactId>--> | 53 | <!-- <artifactId>yudao-module-bpm-biz-activiti</artifactId>--> |
yudao-server/src/main/resources/application.yaml
| @@ -39,7 +39,7 @@ spring: | @@ -39,7 +39,7 @@ spring: | ||
| 39 | 39 | ||
| 40 | # 工作流 Flowable 配置 | 40 | # 工作流 Flowable 配置 |
| 41 | flowable: | 41 | flowable: |
| 42 | - # 1. false: 默认值,activiti启动时,对比数据库表中保存的版本,如果不匹配。将抛出异常 | 42 | + # 1. false: 默认值,Flowable 启动时,对比数据库表中保存的版本,如果不匹配。将抛出异常 |
| 43 | # 2. true: 启动时会对数据库中所有表进行更新操作,如果表存在,不做处理,反之,自动创建表 | 43 | # 2. true: 启动时会对数据库中所有表进行更新操作,如果表存在,不做处理,反之,自动创建表 |
| 44 | # 3. create_drop: 启动时自动创建表,关闭时自动删除表 | 44 | # 3. create_drop: 启动时自动创建表,关闭时自动删除表 |
| 45 | # 4. drop_create: 启动时,删除旧表,再创建新表 | 45 | # 4. drop_create: 启动时,删除旧表,再创建新表 |