Skip to content

关于.sftl中sql能提取公共部分吗? #45

@wangawu

Description

@wangawu

对于.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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions