Mybatis-Failed to parse mapping resource

2019年12月03日 19:40 · 阅读(1048) ·

问题描述

运行项目时,报下面的错误

  1. Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\v_hwhao\Code-Java\trunk\tax-foreign-payment\tax-foreign-server\target\classes\mapper\WorkbenchMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 58; columnNumber: 28; The content of elements must consist of well-formed character data or markup.

问题分析

查看 WorkbenchMapper.xml

发现 sql 如下:

  1. <!--获取待办事项列表-->
  2. <select id="getTodo" resultType="com.foreign.payment.vo.TodoVO" parameterType="com.foreign.payment.data.UserData">
  3. <!--税务人员-->
  4. <if test="param.staffType == 0">
  5. select '待新增台账' as name,count(1) as count
  6. from t_fpts_tax_account
  7. where op_type <> 'submit' and account_type = 0 and tax_handle_staffid = #{param.staffId} and is_delete=1
  8. union all
  9. select '待审批备案资料' as name,count(1) as count
  10. from t_fpts_record_doc_task
  11. where task_name='税务审核' and tax_handle_staffid = #{param.staffId} and is_delete=1
  12. union all
  13. select '待审批付款报税' as name,count(1) as count
  14. from t_fpts_pay_info
  15. where handle_status_name='未处理' and tax_handle_staffid = #{param.staffId} and is_delete=1
  16. </if>
  17. <!--业务人员-->
  18. <if test="param.staffType == 1">
  19. select '待上传备案资料' as name,count(1) as count
  20. from t_fpts_record_doc_task
  21. where task_name='资料上传' and upload_staffid =#{param.staffId} and is_delete=1
  22. </if>
  23. </select>

里面的 op_type <> 'submit' 中有特殊字符 <>

修改为 op_type != 'submit' 后解决