自己粗心问题,不好意思
<mapper namespace="com.arnold.rbac.dao.SysRoleMapper">
<resultMap id="RoleWithPermissionResultMap" type="com.arnold.rbac.model.SysRole">
<id column="sr_id" jdbcType="INTEGER" property="id"/>
<result column="role_name" jdbcType="VARCHAR" property="roleName"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="creater" jdbcType="VARCHAR" property="creater"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="editor" jdbcType="VARCHAR" property="editor"/>
<result column="editor_time" jdbcType="TIMESTAMP" property="editorTime"/>
<collection property="permission" javaType="java.util.ArrayList" columnPrefix="sp_" ofType="com.arnold.rbac.model.SysPermission" resultMap="com.arnold.rbac.dao.SysPermissionMapper.BaseResultMap">
</collection>
</resultMap>
<select id="getRoleWithPermission" resultMap="RoleWithPermissionResultMap">
select
sr.id as sr_id, role_name, sr.status as `status`, remark, sr.creater as creater, sr.create_time as create_time,
sr.editor as editor, sr.editor_time as editor_time,
sp.permission_name as sp_permission_name,
sp.permission_str as sp_permission_str,
sp.status as sp_status,
sp.is_del as sp_is_del,
sp.creater as sp_creater,
sp.create_time as sp_create_time,
sp.editor as sp_editor,
sp.edit_time as sp_edit_time
from sys_role sr
LEFT JOIN sys_role_permission srp ON srp.role_id = sr.id
LEFT JOIN sys_permission sp on sp.id = srp.permission_id
where sr.id = #{id,jdbcType=INTEGER}
</select>
</mapper>
<mapper namespace="com.arnold.rbac.dao.SysPermissionMapper">
<resultMap id="BaseResultMap" type="com.arnold.rbac.model.SysPermission">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="permission_name" jdbcType="VARCHAR" property="permissionName"/>
<result column="permission_str" jdbcType="VARCHAR" property="permissionStr"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="is_del" jdbcType="BIT" property="isDel"/>
<result column="creater" jdbcType="VARCHAR" property="creater"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="editor" jdbcType="VARCHAR" property="editor"/>
<result column="edit_time" jdbcType="TIMESTAMP" property="editTime"/>
</resultMap>
</mapper>
调用dao
其他参数都ok,只有id为null为什么?数据库查询出来也是有值得。
请输入代码
sql语句中漏写了id, 抱歉