1. 同步 MySQL、PostgreSQL 最新的脚本

2. 修复单元测试的报错
pull/2/head
YunaiV 2022-04-30 23:11:37 +08:00
parent 30e886be6f
commit 45cbb56ea1
10 changed files with 5683 additions and 5620 deletions

5657
sql/mysql/ruoyi-vue-pro.sql Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCrea
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
import org.jasypt.encryption.StringEncryptor;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;
@ -39,6 +40,9 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
@MockBean
private StringEncryptor stringEncryptor;
@MockBean
private DynamicDataSourceProperties dynamicDataSourceProperties;
@Test
public void testCreateDataSourceConfig_success() {
try (MockedStatic<JdbcUtils> databaseUtilsMock = mockStatic(JdbcUtils.class)) {

View File

@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.system.dal.mysql.permission;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleExportReqVO;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
@ -19,29 +19,31 @@ import java.util.List;
public interface RoleMapper extends BaseMapperX<RoleDO> {
default PageResult<RoleDO> selectPage(RolePageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<RoleDO>().likeIfPresent("name", reqVO.getName())
.likeIfPresent("code", reqVO.getCode())
.eqIfPresent("status", reqVO.getStatus())
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
return selectPage(reqVO, new LambdaQueryWrapperX<RoleDO>()
.likeIfPresent(RoleDO::getName, reqVO.getName())
.likeIfPresent(RoleDO::getCode, reqVO.getCode())
.eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
.betweenIfPresent(BaseDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()));
}
default List<RoleDO> listRoles(RoleExportReqVO reqVO) {
return selectList(new QueryWrapperX<RoleDO>().likeIfPresent("name", reqVO.getName())
.likeIfPresent("code", reqVO.getCode())
.eqIfPresent("status", reqVO.getStatus())
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
default List<RoleDO> selectList(RoleExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<RoleDO>()
.likeIfPresent(RoleDO::getName, reqVO.getName())
.likeIfPresent(RoleDO::getCode, reqVO.getCode())
.eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
.betweenIfPresent(BaseDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()));
}
default RoleDO selectByName(String name) {
return selectOne(new QueryWrapperX<RoleDO>().eq("name", name));
return selectOne(RoleDO::getName, name);
}
default RoleDO selectByCode(String code) {
return selectOne(new QueryWrapperX<RoleDO>().eq("code", code));
return selectOne(RoleDO::getCode, code);
}
default List<RoleDO> selectListByStatus(@Nullable Collection<Integer> statuses) {
return selectList(new LambdaQueryWrapperX<RoleDO>().inIfPresent(RoleDO::getStatus, statuses));
return selectList(RoleDO::getStatus, statuses);
}
@Select("SELECT id FROM system_role WHERE update_time > #{maxUpdateTime} LIMIT 1")

View File

@ -247,7 +247,7 @@ public class RoleServiceImpl implements RoleService {
@Override
public List<RoleDO> getRoleList(RoleExportReqVO reqVO) {
return roleMapper.listRoles(reqVO);
return roleMapper.selectList(reqVO);
}
/**

View File

@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS "system_menu" (
"component" varchar(255) DEFAULT NULL,
"status" tinyint NOT NULL DEFAULT '0',
"visible" bit NOT NULL DEFAULT TRUE,
"hidden" bit NOT NULL DEFAULT TRUE,
"keep_alive" bit NOT NULL DEFAULT TRUE,
"creator" varchar(64) DEFAULT '',
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar(64) DEFAULT '',
@ -151,7 +151,7 @@ CREATE TABLE IF NOT EXISTS "system_notice" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"title" varchar(50) NOT NULL COMMENT '',
"content" text NOT NULL COMMENT '',
"notice_type" tinyint NOT NULL COMMENT '1 2',
"type" tinyint NOT NULL COMMENT '1 2',
"status" tinyint NOT NULL DEFAULT '0' COMMENT '0 1',
"creator" varchar(64) DEFAULT '' COMMENT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',

View File

@ -44,14 +44,14 @@ spring:
datasource:
master:
name: ruoyi-vue-pro
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL 连接的示例
url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
username: root
password: 123456
slave: # 模拟从库,可根据自己需要修改
name: ruoyi-vue-pro
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL 连接的示例
url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
username: root
password: 123456