错误示例:
select
id,
channel,
if(txntime='', createtime, STR_TO_DATE(txntime, '%Y%m%d%H%i%s')) onDate,
feeType,
amount bizAmount,
ROUND((case platform when '8' then if(amount*0.002<1,1,amount*0.002) when '6' then amount*0.003 else amount*0.003 end),2) fee,
't_union_order' refType,
id refValue,
'' memo,
isDeprecated,
createTime,
lastUpdateTime
from t_order
错误原因:mybatis查询的时候,需要用到运算符 小于号:< 和 大于号: >,在mybatis配置文件里面,这种会被认为是标签,所以解析错误.
解决方法,用<![CDATA[ ]]>将有<,>的代码包起来。
如下:
select
id,
channel,
if(txntime='', createtime, STR_TO_DATE(txntime, '%Y%m%d%H%i%s')) onDate,
'用户还款' feeType,
amount bizAmount,
<![CDATA[ROUND((case platform when '8' then if(amount*0.002<1,1,amount*0.002) when '6' then amount*0.003 else amount*0.003 end),2)]]> fee,
't_union_order' refType,
id refValue,
'' memo,
isDeprecated,
createTime,
lastUpdateTime
from t_order