#sql("doctor")
select name,header,hospitalname,departmentname,
title,starttime,endtime,expertise,
(select count(*) from t_qaorder b where b.doctorid=a.id and b.askid=0) ordernum,
(select TIMESTAMPDIFF(HOUR,addtime,NOW())
from t_user_credential c where c.user_id=a.id limit 0,1) HOUR
from t_users a
#for(x:cond)
#(for.index==0 ? "where":"and") #(x.key) #para(x.value)
#end
#end调用代码
Kv cond=Kv.by(" isdoctor= ",1);
SqlPara sp=Db.getSqlPara("doctor.doctor", Kv.by("cond", cond));
System.out.println(sp.getSql());打印结果
select name,header,hospitalname,departmentname, title,starttime,endtime,expertise, (select count(*) from t_qaorder b where b.doctorid=a.id and b.askid=0) ordernum, (select TIMESTAMPDIFF(HOUR,addtime,NOW()) from t_user_credential c where c.user_id=a.id limit 0,1) HOUR from t_users a where isdoctor= ?
不知道是不是那里写的有问题看了文档好像是这么调用
项目:JFinal