feat: 添加Category_attribute实体类和仓库接口
refactor(security): 限制文章更新仅限AUTHOR角色 修改ArticleController的updateArticle方法权限,移除ADMIN角色访问权限 chore: 更新application.properties中的Redis配置 取消注释Redis相关配置,包括缓存和连接池设置
This commit is contained in:
@@ -57,13 +57,13 @@ public class ArticleController {
|
||||
|
||||
/**
|
||||
* 更新现有文章
|
||||
* 仅限AUTHOR或ADMIN角色用户访问
|
||||
* 仅限AUTHOR角色用户访问
|
||||
* @param id 要更新的文章ID
|
||||
* @param articleDto 包含更新后文章数据的DTO对象
|
||||
* @return 返回包含更新后文章信息的ResponseMessage对象
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@PreAuthorize("hasRole('AUTHOR') or hasRole('ADMIN')")
|
||||
@PreAuthorize("hasRole('AUTHOR')")
|
||||
public ResponseMessage<Article> updateArticle(
|
||||
@PathVariable Integer id,
|
||||
@Valid @RequestBody ArticleDto articleDto) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.qf.myafterprojecy.pojo;
|
||||
|
||||
public class category_attribute {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.qf.myafterprojecy.repository;
|
||||
|
||||
public interface Category_attribute {
|
||||
}
|
||||
@@ -31,25 +31,25 @@ spring.jpa.properties.hibernate.order_updates=true
|
||||
# spring.jpa.properties.hibernate.cache.use_second_level_cache=true
|
||||
# spring.jpa.properties.hibernate.cache.use_query_cache=true
|
||||
|
||||
# 缓存配置
|
||||
# spring.cache.type=redis
|
||||
# spring.cache.redis.time-to-live=1800000
|
||||
# spring.cache.redis.key-prefix=CACHE_
|
||||
# spring.cache.redis.use-key-prefix=true
|
||||
# spring.cache.redis.cache-null-values=false
|
||||
缓存配置
|
||||
spring.cache.type=redis
|
||||
spring.cache.redis.time-to-live=1800000
|
||||
spring.cache.redis.key-prefix=CACHE_
|
||||
spring.cache.redis.use-key-prefix=true
|
||||
spring.cache.redis.cache-null-values=false
|
||||
|
||||
# Redis配置
|
||||
# spring.redis.host=localhost
|
||||
# spring.redis.port=6379
|
||||
# spring.redis.password=123456
|
||||
# spring.redis.database=0
|
||||
# spring.redis.timeout=10000ms
|
||||
# Redis连接池优化配置
|
||||
#spring.redis.lettuce.pool.max-active=8
|
||||
#spring.redis.lettuce.pool.max-wait=10000ms
|
||||
#spring.redis.lettuce.pool.max-idle=8
|
||||
#spring.redis.lettuce.pool.min-idle=2
|
||||
#spring.redis.lettuce.shutdown-timeout=100ms
|
||||
Redis配置
|
||||
spring.redis.host=localhost
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=123456
|
||||
spring.redis.database=0
|
||||
spring.redis.timeout=10000ms
|
||||
Redis连接池优化配置
|
||||
spring.redis.lettuce.pool.max-active=8
|
||||
spring.redis.lettuce.pool.max-wait=10000ms
|
||||
spring.redis.lettuce.pool.max-idle=8
|
||||
spring.redis.lettuce.pool.min-idle=2
|
||||
spring.redis.lettuce.shutdown-timeout=100ms
|
||||
|
||||
# 日志配置
|
||||
logging.level.root=INFO
|
||||
|
||||
Reference in New Issue
Block a user