|
|
@ -14,7 +14,9 @@ package com.monkeyk.sos.infrastructure.jdbc;
|
|
|
|
import com.monkeyk.sos.domain.user.Privilege;
|
|
|
|
import com.monkeyk.sos.domain.user.Privilege;
|
|
|
|
import com.monkeyk.sos.domain.user.User;
|
|
|
|
import com.monkeyk.sos.domain.user.User;
|
|
|
|
import com.monkeyk.sos.domain.user.UserRepository;
|
|
|
|
import com.monkeyk.sos.domain.user.UserRepository;
|
|
|
|
import com.monkeyk.sos.infrastructure.CacheConstants;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.monkeyk.sos.infrastructure.CacheConstants.*;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
@ -96,7 +98,7 @@ public class UserRepositoryJdbc implements UserRepository {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@CacheEvict(value = CacheConstants.USER_CACHE, key = "#user.username()")
|
|
|
|
@CacheEvict(value = USER_CACHE, key = "#user.username()")
|
|
|
|
public void updateUser(final User user) {
|
|
|
|
public void updateUser(final User user) {
|
|
|
|
final String sql = " update user_ set username = ?, password = ?, phone = ?,email = ? where guid = ? ";
|
|
|
|
final String sql = " update user_ set username = ?, password = ?, phone = ?,email = ? where guid = ? ";
|
|
|
|
this.jdbcTemplate.update(sql, ps -> {
|
|
|
|
this.jdbcTemplate.update(sql, ps -> {
|
|
|
@ -111,7 +113,7 @@ public class UserRepositoryJdbc implements UserRepository {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Cacheable(value = CacheConstants.USER_CACHE, key = "#username")
|
|
|
|
@Cacheable(value = USER_CACHE, key = "#username")
|
|
|
|
public User findByUsername(String username) {
|
|
|
|
public User findByUsername(String username) {
|
|
|
|
final String sql = " select * from user_ where username = ? and archived = 0 ";
|
|
|
|
final String sql = " select * from user_ where username = ? and archived = 0 ";
|
|
|
|
final List<User> list = this.jdbcTemplate.query(sql, new Object[]{username}, userRowMapper);
|
|
|
|
final List<User> list = this.jdbcTemplate.query(sql, new Object[]{username}, userRowMapper);
|
|
|
|