报错内容:
org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; The content of elements must consist of well-formed character data or markup.
报错sql语句:
SELECT DISTINCT patients.p_sid,checkinfo.c_jh_flag,checkinfo.c_sample_hg,checkinfo.c_card_no,wcjgs = (select count(*) from checkinfo c where c.c_sid = checkinfo.c_sidand isnull(c.c_flag,0) = 0) FROM patients inner join checkinfo on
patients.p_id = checkinfo.c_p_id and
isnull(checkinfo.c_sample_type,0) = 1 and
isnull(checkinfo.c_type,0) = 1 and isnull(patients.p_type,1) = 1
and checkinfo.c_sid not in (select dj_min_sid from sampledjmx where dj_xm_sum = -1)
and checkinfo.c_sid not in (select s_sy_sid from bhgbbdj where isnull(s_sy_sid,'') <>'');
解决方法:把上面 的 < 换成转义字符 < 、> 换成转义字符 >,或者把<>(不等于)改用 !=
本人项目使用的是mybatis的注解方式开发,如果sql加上script标签,代表该条sql以xml解析的方式解析映射,xml解析方式,< 或者 > 应该都用转义字符。
常用的一些需要转义的特殊字符:
< < 小于号 <= 和<=的表示是一个意思
> > 大于号
& & 和
' ’ 单引号
" " 双引号