在接口中增加 @Param(“id”)
String selectDepatmentName(@Param("id") int id);
在Mapper.xml中
<select id="selectDepatmentName" resultType="String" parameterType="int">
select depatment from depatment where depatment_id = #{0};
<where>
<if test="id !=0">
depatment_id = #{0};
</if>
</where>
</select>