对于.sftl,其中写比较多的查询SQL,但是对于某些部分是一样的,我能提取出一个公共组件吗,然后在用的地方直接引入吗?避免写重复代码
例如:可以将where 1=1 提取出来,在用的地方再引用进来
--findSomeDevice
select * from tb_device t where 1=1
<#if deviceCode??>
and t.device_code = :deviceCode
</#if>
--findSomeUser
select * from tb_device t where 1=1
<#if areaCode??>
and t.area_code = :areaCode
</#if>
对于.sftl,其中写比较多的查询SQL,但是对于某些部分是一样的,我能提取出一个公共组件吗,然后在用的地方直接引入吗?避免写重复代码
例如:可以将where 1=1 提取出来,在用的地方再引用进来
--findSomeDevice
select * from tb_device t where 1=1
<#if deviceCode??>
and t.device_code = :deviceCode
</#if>
--findSomeUser
select * from tb_device t where 1=1
<#if areaCode??>
and t.area_code = :areaCode
</#if>