代码生成器系列(数据筛选)

在模板一章里介绍了数据筛选,如:

sql += "where <fieldlist split=" and " filter="主键=1">[name]=?[name]</fieldlist>"


通过 filter="主键=1" 来筛选数据,
为了实现数据与模板的分离,减轻模板工作量,让模板可读性更强,

单独增加一个数据筛选层,来实现数据筛选,如:

[Key] = select * from [FieldList] where [key] = 1

模板里就简单了:

sql += "where <Key split=" and ">[name]=?[name]</key>"

其他都可以筛选,如:

[List] = select * from [FieldList] where [list]=1
[View] = select * from [FieldList] where [view]=1

猜你喜欢

转载自blog.csdn.net/weishaolin13x/article/details/80701079