介绍
这期内容当中小编将会给大家带来有关mybatis中如果不能识别大写,或如何解决,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
mybatis报错:
Caused :, org.apache.ibatis.ognl.ParseException:, Encountered “,“以及”“,at line 1
错误代码:
& lt; select id=皊electAccountList", resultMap=癇aseResultMap"比; SELECT 才能ct.customer_name customerName sam.city_code, sam.user_name sam.account_name ,得到sys_account_manager sam  LEFT JOIN sys_customer ct 提醒ct.id =, sam.customer_id WHERE 才能;sam.deleted =0 & lt;才能if 测试=癱ustomerName !=, null 以及customerName !=, & # 39; & # 39;,“比; 以及才能ct.customer_name LIKE  concat (& # 39; % & # 39;, # {customerName}, & # 39; % & # 39;) & lt;才能/if> & lt;才能if 测试=癱ityCode !=, null 以及cityCode !=, & # 39; & # 39;,“比; 以及定位才能(# {cityCode}, sam.city_code) & lt;才能/if> order 才能;by 状态,account_validity_time DESC ,& lt;/select>
正确代码:
原因是:
如果条件中,为大写,大写不能识别,应改为小写。
& lt; select id=皊electAccountList", resultMap=癇aseResultMap"比; SELECT 才能ct.customer_name customerName sam.city_code, sam.user_name sam.account_name ,得到sys_account_manager sam  LEFT JOIN sys_customer ct 提醒ct.id =, sam.customer_id WHERE 才能;sam.deleted =0 & lt;才能if 测试=癱ustomerName !=, null 以及customerName !=, & # 39; & # 39;,“比; 以及才能ct.customer_name LIKE  concat (& # 39; % & # 39;, # {customerName}, & # 39; % & # 39;) & lt;才能/if> & lt;才能if 测试=癱ityCode !=, null 以及cityCode !=, & # 39; & # 39;,“比; 以及定位才能(# {cityCode}, sam.city_code) & lt;才能/if> order 才能;by 状态,account_validity_time DESC ,& lt;/select>
<强>补充:Mybatis中如果判断遇到的坑强>
最近在项目开发的过程中,遇到了Mybatis的一个坑(也许是Mybatis有意这样设计的),对于整数或者长这种引用数据类型,在做如果判断的时候,如果引用数据类型为0,则Mybatis将会视为“空字符串,所以走不进判断逻辑里。
以下余额字段为长类型,availableAmount值为0时,将走不进判断方法内的示例截图:
解决方法:
在试验判断条件中添加”或availableAmount==0”即可,以下是示例截图:
或者在业务场景允许的情况下,只判断availableAmount !=null
& lt; if 测试=癮vailableAmount !=null"比; ,,… & lt;/if>
上述就是小编为大家分享的mybatis中如果不能识别大写,或如何解决了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。