Mapper method 'com.min.atcrowdfunding.manager.dao.RoleMapper.insertRolePermission attempted to return null from a method with a primitive return type (int).
这个我在XML里加resultType="int"也没有用····还是这个错,啥问题那
public int saveRolePermissionRelationship(Integer roleid, Data datas) {
roleMapper.deleteRolePermissionRelationship(roleid);
int totalCount = 0;
List<Integer> ids = datas.getIds();
for (Integer permissionid : ids) {
RolePermission rp = new RolePermission();
rp.setRoleid(roleid);
rp.setPermissionid(permissionid);
int count = roleMapper.insertRolePermission(rp);
totalCount += count;
}
return totalCount;
}
以上是在实现类里写的,下面是Mapper加入的方法
void deleteRolePermissionRelationship(Integer roleid);
int insertRolePermission(RolePermission rp);
下面是XML里的SQL语句
<select id="insertRolePermission">
insert into t_role_permission(roleid,permissionid) values(#{roleid},#{permissionid})