mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-19 03:30:06 +08:00
1. 同步 MySQL、PostgreSQL 最新的脚本
2. 修复单元测试的报错
This commit is contained in:
parent
30e886be6f
commit
45cbb56ea1
5657
sql/mysql/ruoyi-vue-pro.sql
Normal file
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
@ -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.controller.admin.db.vo.DataSourceConfigUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
|
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.jasypt.encryption.StringEncryptor;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.MockedStatic;
|
import org.mockito.MockedStatic;
|
||||||
@ -39,6 +40,9 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
|
|||||||
@MockBean
|
@MockBean
|
||||||
private StringEncryptor stringEncryptor;
|
private StringEncryptor stringEncryptor;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private DynamicDataSourceProperties dynamicDataSourceProperties;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDataSourceConfig_success() {
|
public void testCreateDataSourceConfig_success() {
|
||||||
try (MockedStatic<JdbcUtils> databaseUtilsMock = mockStatic(JdbcUtils.class)) {
|
try (MockedStatic<JdbcUtils> databaseUtilsMock = mockStatic(JdbcUtils.class)) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.mysql.permission;
|
package cn.iocoder.yudao.module.system.dal.mysql.permission;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
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.RoleExportReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||||
@ -19,29 +19,31 @@ import java.util.List;
|
|||||||
public interface RoleMapper extends BaseMapperX<RoleDO> {
|
public interface RoleMapper extends BaseMapperX<RoleDO> {
|
||||||
|
|
||||||
default PageResult<RoleDO> selectPage(RolePageReqVO reqVO) {
|
default PageResult<RoleDO> selectPage(RolePageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new QueryWrapperX<RoleDO>().likeIfPresent("name", reqVO.getName())
|
return selectPage(reqVO, new LambdaQueryWrapperX<RoleDO>()
|
||||||
.likeIfPresent("code", reqVO.getCode())
|
.likeIfPresent(RoleDO::getName, reqVO.getName())
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
.likeIfPresent(RoleDO::getCode, reqVO.getCode())
|
||||||
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
|
.eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(BaseDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<RoleDO> listRoles(RoleExportReqVO reqVO) {
|
default List<RoleDO> selectList(RoleExportReqVO reqVO) {
|
||||||
return selectList(new QueryWrapperX<RoleDO>().likeIfPresent("name", reqVO.getName())
|
return selectList(new LambdaQueryWrapperX<RoleDO>()
|
||||||
.likeIfPresent("code", reqVO.getCode())
|
.likeIfPresent(RoleDO::getName, reqVO.getName())
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
.likeIfPresent(RoleDO::getCode, reqVO.getCode())
|
||||||
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
|
.eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(BaseDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
default RoleDO selectByName(String name) {
|
default RoleDO selectByName(String name) {
|
||||||
return selectOne(new QueryWrapperX<RoleDO>().eq("name", name));
|
return selectOne(RoleDO::getName, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
default RoleDO selectByCode(String code) {
|
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) {
|
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")
|
@Select("SELECT id FROM system_role WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||||
|
@ -247,7 +247,7 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RoleDO> getRoleList(RoleExportReqVO reqVO) {
|
public List<RoleDO> getRoleList(RoleExportReqVO reqVO) {
|
||||||
return roleMapper.listRoles(reqVO);
|
return roleMapper.selectList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS "system_menu" (
|
|||||||
"component" varchar(255) DEFAULT NULL,
|
"component" varchar(255) DEFAULT NULL,
|
||||||
"status" tinyint NOT NULL DEFAULT '0',
|
"status" tinyint NOT NULL DEFAULT '0',
|
||||||
"visible" bit NOT NULL DEFAULT TRUE,
|
"visible" bit NOT NULL DEFAULT TRUE,
|
||||||
"hidden" bit NOT NULL DEFAULT TRUE,
|
"keep_alive" bit NOT NULL DEFAULT TRUE,
|
||||||
"creator" varchar(64) DEFAULT '',
|
"creator" varchar(64) DEFAULT '',
|
||||||
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"updater" varchar(64) DEFAULT '',
|
"updater" varchar(64) DEFAULT '',
|
||||||
@ -151,7 +151,7 @@ CREATE TABLE IF NOT EXISTS "system_notice" (
|
|||||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
"title" varchar(50) NOT NULL COMMENT '公告标题',
|
"title" varchar(50) NOT NULL COMMENT '公告标题',
|
||||||
"content" text 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关闭)',
|
"status" tinyint NOT NULL DEFAULT '0' COMMENT '公告状态(0正常 1关闭)',
|
||||||
"creator" varchar(64) DEFAULT '' COMMENT '创建者',
|
"creator" varchar(64) DEFAULT '' COMMENT '创建者',
|
||||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
@ -44,14 +44,14 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
name: ruoyi-vue-pro
|
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: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:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
slave: # 模拟从库,可根据自己需要修改
|
slave: # 模拟从库,可根据自己需要修改
|
||||||
name: ruoyi-vue-pro
|
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: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:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user