Mybatis nested query error TooManyResultsException


        select
        <include refid="Base_Column_List"/>
        from sys_permission
        where id = -sharp{id,jdbcType=INTEGER}
    </select>
</mapper>

if you change dao to
List < SysRole > getRoleWithPermission (Integer id);
, three records are returned, and each role corresponds to a permission.

Mar.05,2021

because it is true that the sql statement finds three records
if you use < collection select= "> to find it, you can pass in only one value. So the result can only be one record.
if you use < collection resultMap >, mybatis will merge multiple checked results into collection by pressing the primary key id.


        </collection>
    </resultMap>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33c42-3426d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33c42-3426d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?