码上敲享录 > java常见报错解答 > 解决 Could not find value method on SQL annotation. The content of elements must consist of well-form

解决 Could not find value method on SQL annotation. The content of elements must consist of well-form

上一章章节目录下一章 2019-07-02已有8392人阅读 评论(0)

springboot + mybatis报错,报错如下:

Could not find value method on SQL annotation.  Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 19; The content of elements must consist of well-formed character data or markup.

语法看不出什么错,这里项目里面的sql,


@Select("<script> with temp (d_id,d_hospital,parentId) \n" +

           "   as \n" +

           "  (  \n" +

           "   select d_id,d_hospital,parentId\n" +

           "   from dept  \n" +

           "   where d_hospital = #{hospital}\n" +

           "   union all \n" +

           "   select a.d_id,a.d_hospital,a.parentId \n" +

           "   from dept a  \n" +

           "   inner join temp on a.parentId = temp.d_id \n" +

           "   )  \n" +

           "   SELECT * FROM (SELECT *,ROW_NUMBER() OVER(ORDER BY t2.c_a_date DESC) AS num FROM  \n" +

           "   (SELECT c.c_id,c.c_p_id,c.c_w_date,c.c_date,c.c_sid ,p.p_m_name,p.p_name,c.c_type,c.c_card_no," +

           "  c.c_s_sid,c.c_zh_flag,p.p_bithday,c.c_sample_date,p.p_hospital,p.p_in_no,c.c_sdate," +

           "  rptno = case \n" +

           "  when c_combine <> 'dp' and c_sample_type = 1 then 1\n" +

           "  when c_combine <> 'dp' and c_sample_type = 2  then 2\n" +

           "  when c_combine = 'dp' and c_sample_type = 1 and isnull(c_zh_flag,0) = 2 then 1\n" +

           "  when c_combine = 'dp' and c_sample_type = 1 and isnull(c_zh_flag,0) = 1 then 3\n" +

           "  when c_combine = 'dp' and c_sample_type = 2 and isnull(c_zh_flag,0) = 2 then 2\n" +

           "  when c_combine = 'dp' and c_sample_type = 2 and isnull(c_zh_flag,0) = 1 then 4\n" +

           "  else 0 end," +

           "  c.c_a_date,c.c_sample_type,c.c_flag,c.c_combine,c.c_d_flag,c.c_w_name,c.c_a_name,p.p_tel1" +

           "  from patients p LEFT JOIN checkinfo c on p.p_id = c.c_p_id\n" +

           "  INNER JOIN temp on p.p_hospital=temp.d_hospital) t2 where 1=1 \n" +

           "  <if test='p_name !=null &amp;&amp; p_name !=\"\"'> and p_name = #{p_name} </if>\n" +

           "   )\n" +

           "   AS t WHERE  t.num BETWEEN #{pageNo} AND #{pageSize} </script>")


经查找,是sql语句里面用了不等于符号<>,将<>改为!=,就不报错了,可能是在dao层写<>符号,识别不出这样的语法

0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交