Skip to content

5.6.28 统一@if/@elseif/@else场景的逻辑

Compare
Choose a tag to compare
@chenrenfei chenrenfei released this 17 Oct 15:43
· 71 commits to 5.6 since this release
d247cdd

1、规范if/elseif/else的逻辑(历史版本:if场景,sql中无动态参数也会被剔除)

select * from table where name='测试'
-- 非if逻辑场景下,内部动态参数为null,最终为and status=1 也要自动剔除
#[and status=1 #[and type=:type] #[and orderName like :orderName] ]
-- flag==1成立,因为内容存在动态参数,所以继续变成#[and status=:status]参数为null剔除,不为null则保留
#[@if(:flag==1) and status=:status]
-- 成立,因为and status=1 没有动态参数,则保留and status=1
#[@if(:flag==1) and status=1 ]
#[@elseif(:flag==2) and status=2 ]
#[@else and status in (1,2)]
<!-- 其他非spring框架可以基于sagacity-sqltoy 进行扩展 -->
<dependency>
	<groupId>com.sagframe</groupId>
	<artifactId>sagacity-sqltoy</artifactId>
         <!-- jdk8 对应的版本号为:5.6.28.jre8 -->
	<version>5.6.28</version>
</dependency>

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

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