Commit 7ddb9ee7 authored by xiaoguang.xu's avatar xiaoguang.xu

处理空 createAt & updateAt 问题。

parent 80203624
......@@ -9,6 +9,8 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Timestamp;
/**
* Created by Miraculous on 2017/1/3.
*/
......@@ -28,6 +30,13 @@ public class UserExtInfoServiceImpl implements IUserExtInfoService {
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = "userextinfocache", key = "'extinfo' + #info.userId", cacheManager = "cacheManager")
public UserExtInfo save(UserExtInfo info) {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
if (info.getCreatedAt() == null) {
info.setCreatedAt(timestamp);
}
if (info.getUpdateAt() == null) {
info.setUpdateAt(timestamp);
}
return userExtInfoRepository.save(info);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment