Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wangawu opened this issue Mar 1, 2019 · 1 comment
Open

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

wangawu opened this issue Mar 1, 2019 · 1 comment

Comments

@wangawu
Copy link

wangawu commented Mar 1, 2019

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

@stormning
Copy link
Collaborator

emmm....是个不错的建议,但是用到得地方不多吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants