feat: 优化mybatis测试用例,避免下划线影响识别

This commit is contained in:
wangyu 2022-12-09 17:24:32 +08:00
parent a0da723f5e
commit 1cf36280ec
4 changed files with 6 additions and 4 deletions

View File

@ -37,7 +37,7 @@ public class FluentJdbcTest {
new Driver(), new Driver(),
"jdbc:mysql://127.0.0.1:3306/epi_project?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai", "jdbc:mysql://127.0.0.1:3306/epi_project?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai",
"root", "root",
"Unicom#2018" "oI3WtMO8h%mSYARp"
); );
// 准备待测试用例 // 准备待测试用例
List<TestCase<?>> cases = Arrays.asList( List<TestCase<?>> cases = Arrays.asList(

View File

@ -33,7 +33,7 @@ public class FluentSqlTestCase extends AbstractTestCase<List<TenantContext>> {
// 基于构造器自动绑定注册在实际应用中使用@Bean声明即可可参考下面的demo // 基于构造器自动绑定注册在实际应用中使用@Bean声明即可可参考下面的demo
new JdbcTemplateFluentSQLOperations(new JdbcTemplate(dataSource)); new JdbcTemplateFluentSQLOperations(new JdbcTemplate(dataSource));
// 启用调试 // 启用调试
FluentSqlDebugger.enable(); // FluentSqlDebugger.enable();
} }
/** /**

View File

@ -1,6 +1,7 @@
package group.flyfish.framework.cases; package group.flyfish.framework.cases;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import group.flyfish.fluent.utils.data.ObjectMappers;
import group.flyfish.framework.TestCase; import group.flyfish.framework.TestCase;
import group.flyfish.framework.entity.SaasQuota; import group.flyfish.framework.entity.SaasQuota;
import group.flyfish.framework.entity.SaasTenant; import group.flyfish.framework.entity.SaasTenant;
@ -40,6 +41,7 @@ public class MybatisTestCase extends AbstractTestCase<List<TenantContext>> {
Configuration configuration = new Configuration(environment); Configuration configuration = new Configuration(environment);
configuration.addMapper(TenantContextMapper.class); configuration.addMapper(TenantContextMapper.class);
TypeHandlerRegistry registry = configuration.getTypeHandlerRegistry(); TypeHandlerRegistry registry = configuration.getTypeHandlerRegistry();
JacksonTypeHandler.setObjectMapper(ObjectMappers.shared());
registry.register(SaasTenant.DataSourceConfig.class, JacksonTypeHandler.class); registry.register(SaasTenant.DataSourceConfig.class, JacksonTypeHandler.class);
registry.register(SaasQuota.class, JacksonTypeHandler.class); registry.register(SaasQuota.class, JacksonTypeHandler.class);
registry.register(SaasTenant.StorageConfig.class, JacksonTypeHandler.class); registry.register(SaasTenant.StorageConfig.class, JacksonTypeHandler.class);

View File

@ -10,7 +10,7 @@
<result column="storage" property="storage" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> <result column="storage" property="storage" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
<result column="status" property="status" /> <result column="status" property="status" />
<result column="enable" property="enable" /> <result column="enable" property="enable" />
<result column="quotaConfig" property="quota" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" /> <result column="quota" property="quota" jdbcType="LONGVARCHAR" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
<result column="orderTime" property="orderTime" /> <result column="orderTime" property="orderTime" />
<result column="expireTime" property="expireTime" /> <result column="expireTime" property="expireTime" />
<result column="orderType" property="orderType" /> <result column="orderType" property="orderType" />
@ -24,7 +24,7 @@
t1.`storage` as `storage`, t1.`storage` as `storage`,
t1.`status` as `status`, t1.`status` as `status`,
t1.`enable` as `enable`, t1.`enable` as `enable`,
t2.`quota_config` as `quotaConfig`, t2.`quota_config` as `quota`,
t2.`order_time` as `orderTime`, t2.`order_time` as `orderTime`,
t2.`expire_time` as `expireTime`, t2.`expire_time` as `expireTime`,
t2.`order_type` as `orderType` t2.`order_type` as `orderType`