feat: 热力图和咖啡因缓存
This commit is contained in:
@@ -31,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -371,6 +372,23 @@ public class SchisandraAuthUserController {
|
||||
}
|
||||
return Result.ok(JSONObject.parseObject(result));
|
||||
}
|
||||
/**
|
||||
* @description: 获取用户信息
|
||||
* @param: [userId]
|
||||
* @return: com.schisandra.auth.common.entity.Result<com.schisandra.auth.application.dto.SchisandraAuthUserDTO>
|
||||
* @author zlg
|
||||
* @date: 2024/7/11 9:39
|
||||
*/
|
||||
@GetMapping("getUserInfo")
|
||||
public Result<SchisandraAuthUserDTO> getUserInfo(@RequestParam("userId") Long userId) {
|
||||
SchisandraAuthUserDTO schisandraAuthUserDTO = SchisandraAuthUserDTOConverter.INSTANCE.convertBOToDTO(schisandraAuthUserDomainService.queryById(userId));
|
||||
if ( schisandraAuthUserDTO== null) {
|
||||
return Result.fail("该用户不存在");
|
||||
}else {
|
||||
return Result.ok(schisandraAuthUserDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -5,6 +5,9 @@ import com.schisandra.auth.common.entity.Result;
|
||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -61,6 +64,7 @@ public interface SchisandraAuthUserDomainService {
|
||||
* @author schisandra
|
||||
* @date 2024/3/21 23:14
|
||||
*/
|
||||
@CachePut(value = "userInfo", key = "#schisandraAuthUserBO.id")
|
||||
Object update(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
|
||||
/**
|
||||
@@ -70,6 +74,7 @@ public interface SchisandraAuthUserDomainService {
|
||||
* @author: landaiqing
|
||||
* @date: 2024/5/26 17:27
|
||||
*/
|
||||
|
||||
Result insertAuthUserByOauth(AuthUser data, String type);
|
||||
|
||||
/**
|
||||
@@ -79,7 +84,8 @@ public interface SchisandraAuthUserDomainService {
|
||||
* @author: landaiqing
|
||||
* @date: 2024/5/26 17:27
|
||||
*/
|
||||
SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
@Cacheable(value = "userInfo", key = "#userId")
|
||||
SchisandraAuthUserBO queryById(Long userId);
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserBO
|
||||
@@ -95,6 +101,7 @@ public interface SchisandraAuthUserDomainService {
|
||||
* @description 删除用户(物理)
|
||||
* @author msz
|
||||
*/
|
||||
@CacheEvict(value = "userInfo",key = "id")
|
||||
Object deleteById(Long id);
|
||||
|
||||
SchisandraAuthUser queryByPhone(String phone);
|
||||
|
@@ -167,15 +167,15 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
||||
|
||||
|
||||
/**
|
||||
* @param schisandraAuthUserBO
|
||||
* @param Long
|
||||
* @return
|
||||
* @description 查询用户信息
|
||||
* @author msz
|
||||
* @date 2024/4/3 22:10
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryById(schisandraAuthUserBO.getId());
|
||||
public SchisandraAuthUserBO queryById(Long userId) {
|
||||
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryById(userId);
|
||||
SchisandraAuthUserBO schisandraAuthUserBO1 = SchisandraAuthUserBOConverter.INSTANCE.convertEntityToBO(schisandraAuthUser);
|
||||
return schisandraAuthUserBO1;
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package com.schisandra.auth;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@@ -18,6 +19,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@MapperScan("com.schisandra.**.dao")
|
||||
@EnableFeignClients(basePackages = "com.schisandra")
|
||||
@EnableTransactionManagement
|
||||
@EnableCaching
|
||||
public class AuthApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AuthApplication.class);
|
||||
|
@@ -27,6 +27,11 @@ spring:
|
||||
enabled: true
|
||||
config:
|
||||
enabled: true
|
||||
#caffeine缓存
|
||||
cache:
|
||||
type: caffeine
|
||||
caffeine:
|
||||
spec: maximumSize=10000,expireAfterAccess=60s
|
||||
# redis配置
|
||||
redis:
|
||||
# Redis数据库索引(默认为0)
|
||||
@@ -108,3 +113,4 @@ rocketmq:
|
||||
producer:
|
||||
group: schisandra-cloud-storage-auth-group
|
||||
send-message-timeout: 6000
|
||||
|
||||
|
Reference in New Issue
Block a user