1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| @CacheNamespace(blocking = true)
public interface IUserDao {
@Select(value = "select * from user") @Results(id = "userMap", value = { @Result(id = true, property = "userId", column = "uid"), @Result(property = "userName", column = "username"), @Result(property = "userSex", column = "sex"), @Result(property = "userAddress", column = "address"), @Result(property = "userBirthday", column = "birthday"), @Result(property = "accounts", column = "uid", many = @Many(select = "com.itheima.dao.IAccountDao.findAccountByUid", fetchType = FetchType.LAZY)) }) List<User> findAll();
@Select("select * from user where uid = #{uid}") @ResultMap(value = {"userMap"}) User findById(Integer uid);
@Select("select * from user where username like #{username}")
@ResultMap(value = {"userMap"}) List<User> findUserByName(String name);
}
|