finereport sql动态传参
SELECT x.id,e.eventname,x.totaltext,x.schooltype,b.xd,b.name,x.schoolname,x.unitinfono,b.zz1,b.zz1xb,b.zz1xx,b.zz1by,b.zz1nj,x.xqrecstatus,x.srecstatus FROM xxb X
LEFT JOIN xxb_base b ON x.id=b.id
LEFT JOIN EVENTS e ON e.id=x.eventid
LEFT JOIN sys_units unit ON unit.id = x.SCHOOLID
LEFT JOIN xxb_score score ON x.id = score.id
where x.isdel="0" AND e.event_business_id= 'lwps'
AND unit.left_node >= '${leftNode}' AND unit.right_node <= '${rightNode}'
${if(len(eventid)==0,""," and e.id='"+eventid+"'")}
${if(len(xd)==0,""," and FIND_IN_SET (b.xd,'"+xd+"')")}
${if(len(schooltype)==0,""," and x.schooltype='"+schooltype+"'")}
${if(len(xqrecstatus)==0,""," and x.xqrecstatus='"+xqrecstatus+"'")}
${if(len(srecstatus)==0,""," and x.srecstatus='"+srecstatus+"'")}
${if(len(awards)==0,""," and IFNULL(score.awards, '0')='"+awards+"'")}
${if(len(awardtype)==0,""," and score.awardtype='"+awardtype+"'")}
${if(len(ktkeyword)==0,""," and ( b.name like '%"+keyword+"%' or zz1 like '%"+keyword+"%' or zz1xb like '%"+ktkeyword+"%' or zz1xx like '%"+keyword+"%' or zz1by like '%"+keyword+"%' or zz1nj like '%"+ktkeyword+"%' or x.totaltext like '%"+keyword+"%' or x.schoolcode like '%"+keyword+"%' or x.schoolname like '%"+keyword+"%' )")}
${if(len(orders)==0,"","order by "+orders+" ")}
注:
固定参数:'${leftNode}'
动态参数:${if(len(eventid)==0,""," and e.id='"+eventid+"'")}
in:${if(len(xd)==0,""," and FIND_IN_SET (b.xd,'"+xd+"')")}