mybaits nor a Result Map was specified,以及transcation对应的@Transcational

来源:互联网 发布:手机看高清网络电视 编辑:程序博客网 时间:2024/05/18 01:37

org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.project.modules.admin.dao.mapper.SysRolePermissionMapper.UpdatePermissionByRole'. It's likely that neither a Result Type nor a Result Map was specified.


当出现这个错误时,需要在mapper.xml文件中的select 标签处添加resultType="java.lang.Integer",红色部分请填入相应的参数了;

在xml中如下加入begin transcation 时,需要在server层,加入@Transactional;

 <selectid="UpdatePermissionByRole"resultType="java.lang.Integer">

    begin transaction

begin try

delete from sys_role_permission where role_code = #{role_code};

insert into sys_role_permission(role_code,permission_code) 

select #{role_code} as role_code,p.permission_code from sys_permission p where p.permission_code in(${permission_codes});

select 1 success;

commit transaction

end try

begin catch

select 0 success;

rollback transaction

end catch

    </select>


阅读全文
0 0
原创粉丝点击