Skip to content

5.6.5.RC7 完成solon、spring aot的适配

Pre-release
Pre-release
Compare
Choose a tag to compare
@chenrenfei chenrenfei released this 19 Apr 02:22
· 208 commits to 5.6 since this release

1、完成solon、spring aot的适配
2、强化wrapTreeTable的参数合法性校验
3、支持非spring等框架下的事务
4、字段加密排除同时被脱敏场景,同时配置加密、脱敏则以加密为主
5、updateByQuery、deleteByQuery 只有where("1=1") 自动去除whre 1=1
6、增加H2数据库DDL创建支持
7、优化solon 集成数据库的事务适配

SqlToyContext sqlToyContext = new SqlToyContext();
sqlToyContext.setSqlResourcesDir("classpath:sqltoy/demo.sql.xml");
sqlToyContext.initialize();
Map<String, String> map = new HashMap<>();
map.put(DruidDataSourceFactory.PROP_URL, "jdbc:mysql://192.168.56.101:3306/sqltoy");
// 设置驱动Driver
map.put(DruidDataSourceFactory.PROP_DRIVERCLASSNAME, "com.mysql.jdbc.Driver");
// 设置用户名
map.put(DruidDataSourceFactory.PROP_USERNAME, "root");
// 设置密码
map.put(DruidDataSourceFactory.PROP_PASSWORD, "123456");
// 创建数据源
DataSource dataSource = DruidDataSourceFactory.createDataSource(map);
sqlToyContext.setDefaultDataSource(dataSource);
// 框架默认提供了DefaultLightDaoImpl实现
LightDao lightDao = new DefaultLightDaoImpl(sqlToyContext);
// 非事务
// lightDao.find("select * from staff_info where status=:status",
// MapKit.map("status", "1"), StaffInfo.class);
// 事务场景(代码是演示)
Object result = DBTransUtils.doTrans(lightDao.getDataSource(), () -> {
    // 这里可以多个操作行为
   lightDao.updateByQuery(StaffInfo.class,  EntityUpdate.create().set("sexType", "F").where("staffId=?").values("S0001"));
   return lightDao.find("select * from staff_info where status=:status", MapKit.map("status", "1"),StaffInfo.class);
});
<!-- 其他非spring框架可以基于sagacity-sqltoy 进行扩展 -->
<dependency>
	<groupId>com.sagframe</groupId>
	<artifactId>sagacity-sqltoy</artifactId>
        <!-- jdk8 对应的版本号为:5.6.5.RC7.jre8 -->
	<version>5.6.5.RC7</version>
</dependency>

<!-- springboot  -->
<dependency>
	<groupId>com.sagframe</groupId>
	<artifactId>sagacity-sqltoy-spring-starter</artifactId>
        <!-- jdk8 对应的版本号为:5.6.5.RC7.jre8 -->
	<version>5.6.5.RC7</version>
</dependency>

<!-- solon 插件  -->
<dependency>
	<groupId>com.sagframe</groupId>
	<artifactId>sagacity-sqltoy-solon-plugin</artifactId>
        <!-- jdk8 对应的版本号为:5.6.5.RC7.jre8 -->
	<version>5.6.5.RC7</version>
</dependency>