问题:运行单元测试类时报错
原因:应该用resultMap来接收返回值,却用了resultType
总结:
1.当返回值为List<XXX>泛型时,使用resultType = "XXX" 的类型
2.当XXX 是PO类,且映射不完全,即表中operate_time,po中对应的映射字段为operateTime
使用resultMap
原因:应该用resultMap来接收返回值,却用了resultType
总结:
1.当返回值为List<XXX>泛型时,使用resultType = "XXX" 的类型
2.当XXX 是PO类,且映射不完全,即表中operate_time,po中对应的映射字段为operateTime
使用resultMap
public List<Long> selectParentIds() throws Exception ;
public List<Permission> selectPermissionsByPid(Long pid) throws Exception ;
<select id="selectParentIds" resultType="java.lang.Long" >
select
distinct parent_id
from usr_permissions
order by priority
</select>
<select id="selectPermissionsByPid" resultMap="BaseResultMap"
parameterType = "java.lang.Long" >
select
<include refid="Base_Column_List" />
from usr_permissions
where parent_id = #{parentId}
</select>