@Mapper
使用@Mapper注解要定义成一个接口interface
作用:1.使用@Mapper将NewsDAO接口交给Spring进行管理
2.不用写Mapper映射文件(XML)
3.为这个NewsDAO接口生成一个实现类,让别的类进行引用
@param
当有多个参数的时候使用@param注解.
在mapper.xml中使用的时候,#{对象别名.属性名},如#{user.userName}
注意,使用了@pram注解的话在mapper.xml不加parameterType。
public List<UserExtension> selectUser( @Param("user") UserExtension user);
<select id=" selectUser" resultMap="BaseResultMap">
select * from user_user_t where user_name = #{user.userName,jdbcType=VARCHAR} and user_area=#{user.userArea,jdbcType=VARCHAR}
</select>