@Test public void selectByUsername() throws IOException { User user = userService.selectByUsername("sunriseydy"); Assert.assertNotNull(user); log.info(user.toString()); String json = objectMapper.writeValueAsString(user); log.warn(json); user = objectMapper.readValue(json, User.class); log.warn(user.toString()); }
@Override public User selectByUsername(String username) { Assert.hasText(username, "用户名字段不能为空"); User user = new User(); user.setUsername(username); user = super.selectOne(user); return user; }
UserServiceImpl extends BaseServiceImpl<User> implements UserService { @Override public User selectByUsername(String username) { Assert.hasText(username, "用户名字段不能为空"); User user = new User(); user.setUsername(username); user = super.selectOne(user); return user; } }
UserServiceImpl extends BaseServiceImpl<User> implements UserService { @Override public User selectByUsername(String username) { Assert.hasText(username, "用户名字段不能为空"); User user = new User(); user.setUsername(username); user = super.selectOne(user); return user; }  }
UserServiceImpl extends BaseServiceImpl<User> implements UserService { @Override public User selectByUsername(String username) { Assert.hasText(username, "用户名字段不能为空"); User user = new User(); user.setUsername(username); user = super.selectOne(user); return user; }  @Override Boolean existsWithUsername(String username); @Override User selectByUsername(String username); @Override User selectByEmail(String email); @Override Boolean existsWithEmail(String email); @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) User registerUser(User newUser); @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @CacheEvict(cacheNames = "UserDetails", key = "'CustomUserDetailsServiceImpl:loadUserByUsername:(' + #user.getUsername() + ')'", cacheManager = "JDKCacheManager", condition = "#user != null && #user.getUsername() != null ") int updateLogin(User user); @Override @CacheEvict(cacheNames = "UserDetails", key = "'CustomUserDetailsServiceImpl:loadUserByUsername:(' + #username + ')'", condition = "#username != null", cacheManager = "JDKCacheManager") void userLogout(String username); }
UserServiceImpl extends BaseServiceImpl<User> implements UserService { @Override public User selectByUsername(String username) { Assert.hasText(username, "用户名字段不能为空"); User user = new User(); user.setUsername(username); user = super.selectOne(user); return user; }  @Override Boolean existsWithUsername(String username); @Override User selectByUsername(String username); @Override User selectByEmail(String email); @Override Boolean existsWithEmail(String email); @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) User registerUser(User newUser); @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @CacheEvict(cacheNames = "UserDetails", key = "'CustomUserDetailsServiceImpl:loadUserByUsername:(' + #user.getUsername() + ')'", cacheManager = "JDKCacheManager", condition = "#user != null && #user.getUsername() != null ") int updateLogin(User user); @Override @CacheEvict(cacheNames = "UserDetails", key = "'CustomUserDetailsServiceImpl:loadUserByUsername:(' + #username + ')'", condition = "#username != null", cacheManager = "JDKCacheManager") void userLogout(String username);  }