mytbatis mapper.xml报错:java.lang.UnsupportedOperationException] with root cause

女爷i 2023-10-01 19:54 97阅读 0赞

在这里插入图片描述

Cause: java.lang.UnsupportedOperationException] with root cause java.lang.UnsupportedOperationException: null

mapper层接口

  1. List selectRolePredict(@Param("organId") String organId,@Param("businessId") String businessId);

mybatis.xml sql结构

  1. <select id="selectRolePredict" resultType="list">
  2. select DISTINCT next_approval_role from business_node_approval_role
  3. <where>
  4. organ_id=#{
  5. organId} and business_id=#{
  6. businessId} and !isnull(next_approval_role)
  7. </where>
  8. </select>

解决方法:把resultType=“java.util.List” 改为String

原因:
resultType返回的是集合中的元素类型,而不是集合本身

  1. <select id="selectRolePredict" resultType="string">
  2. select DISTINCT next_approval_role from business_node_approval_role
  3. <where>
  4. organ_id=#{
  5. organId} and business_id=#{
  6. businessId} and !isnull(next_approval_role)
  7. </where>
  8. </select>

修改之后重新启动项目再次测试接口
在这里插入图片描述
解决

发表评论

表情:
评论列表 (有 0 条评论,97人围观)

还没有评论,来说两句吧...

相关阅读