提示错误:Mapper method 'com.kkb.mapper.TeamMapper.delete attempted to return null from a method with a primitive return type (int).
首先查看mapper映射文件的查询语句
<select id="queryById" parameterType="java.lang.Integer" resultType="com.kkb.pojo.Team">
select * from team where teamId=#{id}
</select>
<select id="add" parameterType="com.kkb.pojo.Team">
insert into team (teamName,location,createTime)
value (#{teamName},#{location},#{createTime})
</select>
注意:如果根据id查询的话 是成功运行的 <select /select>应该对应select语句 相应的 <insert /insert>对应 insert语句
正解:
<!---parameterType表示参数的类型 可以省略 框架可以自己去判断类型-->
<insert id="add" parameterType="com.kkb.pojo.Team">
insert into team (teamName,location,createTime)
value (#{teamName},#{location},#{createTime})
</insert>
<update id="update" parameterType="com.kkb.pojo.Team">
update team set teamName=#{teamName},location=#{location} where teamId=${teamId}
</update>
<delete id="delete" parameterType="com.kkb.pojo.Team">
delete from team where teamId=#{id}
</delete>