2018-08-31 19:13:22
minidao 中使用FreeMarker
where 1=1
<#if roleCode =="HO"> and t.roleCode like '%HO%'</#if>
<#if vo.userName ?exists && vo.userName ?length gt 0> AND t.USERNAME like '%' ||:vo.userName|| '%' </#if>
<#if vo.realName ?exists && vo.realName ?length gt 0> AND t.REALNAME like '%' ||:vo.realName || '%' </#if>
select count(1) from ORDER where OTHERID='${itemId}' and DETAIL_ID='${id}'
不可以用 ':vo.userName' ,它是字符串 可以 '${id}' 最好使用 :vo.userName
freemarker 中文?号 会出现如下错误
Lexical error: encountered "\uff1f" (65311), after "".
freemarker.core.ParseException: Syntax error in template "sql_-1231282527" in line 50, column 53:
Lexical error: encountered "\uff1f" (65311), after "".
java util data
<#if (vo.datab?date)?exists>
AND to_char( m.datab ,'YYYY-MM-DD')= '${vo.datab?string["yyyy-MM-dd"]}'
</#if>
<#if (vo.datbi?date)?exists>
AND to_char( m.datbi ,'YYYY-MM-DD')='${vo.datbi?string["yyyy-MM-dd"]}'
</#if>