一,@Select注解
@Select("select * from smbms_user")
public List<IUser> getAllUser();
二,@Select和@Results注解的联用
@Results(id="userMapper",value={
@Result(property="id",column="id",id=true),
@Result(property="userName",column="userName"),
})
@Select("select * from smbms_user")
public List<IUser> getAllUser();
@ResultMap("userMapper")//引入@Results定义的resultMap
@Select("select * from user")
List<Student> getAll();
}
三,@Insert注解
@Insert("INSERT INTO smbms_user(userCode,userName,userPassword)\n" +
" VALUES (#{userCode},#{userName},#{userPassword})")
public int addUser(IUser user);
四,@Update注解
@Update("update smbms_user set userCode=#{userCode} where id=#{id}")
public int updateUser(IUser user);
五,@Delete
@Delete(" delete from smbms_user where id=#{id}")
public int deleteUser(int id);
原文:https://www.cnblogs.com/liuying23/p/11713209.html