Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
c6c838d7
提交
c6c838d7
authored
8月 01, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化 user 认证 starter,支持忽略部分 url
上级
da826a21
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
158 行增加
和
2 行删除
+158
-2
AdminSecurityProperties.java
...r/mall/security/admin/config/AdminSecurityProperties.java
+1
-1
UserSecurityAutoConfiguration.java
...l/security/user/config/UserSecurityAutoConfiguration.java
+13
-1
UserSecurityProperties.java
...der/mall/security/user/config/UserSecurityProperties.java
+41
-0
mall_user_schema.sql
docs/sql/mall_user_schema.sql
+0
-0
mall_product_data.sql
...-service-app/src/main/resources/sql/mall_product_data.sql
+0
-0
mall_product_schema.sql
...ervice-app/src/main/resources/sql/mall_product_schema.sql
+103
-0
没有找到文件。
common/mall-spring-boot-starter-security-admin/src/main/java/cn/iocoder/mall/security/admin/config/AdminSecurityProperties.java
浏览文件 @
c6c838d7
...
@@ -7,7 +7,7 @@ public class AdminSecurityProperties {
...
@@ -7,7 +7,7 @@ public class AdminSecurityProperties {
private
static
final
String
[]
DEFAULT_IGNORE_PATHS
=
new
String
[]{
private
static
final
String
[]
DEFAULT_IGNORE_PATHS
=
new
String
[]{
// Swagger 相关
// Swagger 相关
"/doc.html"
,
"/swagger-resources"
,
"/swagger-resources/**"
,
"/doc.html"
,
"/swagger-resources"
,
"/swagger-resources/**"
,
"/webjars/**"
,
// Actuator 相关
// Actuator 相关
};
};
...
...
common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityAutoConfiguration.java
浏览文件 @
c6c838d7
...
@@ -5,7 +5,9 @@ import cn.iocoder.mall.web.config.CommonWebAutoConfiguration;
...
@@ -5,7 +5,9 @@ import cn.iocoder.mall.web.config.CommonWebAutoConfiguration;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
...
@@ -14,10 +16,17 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
...
@@ -14,10 +16,17 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@Configuration
@AutoConfigureAfter
(
CommonWebAutoConfiguration
.
class
)
// 在 CommonWebAutoConfiguration 之后自动配置,保证过滤器的顺序
@AutoConfigureAfter
(
CommonWebAutoConfiguration
.
class
)
// 在 CommonWebAutoConfiguration 之后自动配置,保证过滤器的顺序
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@EnableConfigurationProperties
(
UserSecurityProperties
.
class
)
public
class
UserSecurityAutoConfiguration
implements
WebMvcConfigurer
{
public
class
UserSecurityAutoConfiguration
implements
WebMvcConfigurer
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Bean
@ConditionalOnMissingBean
public
UserSecurityProperties
userSecurityProperties
()
{
return
new
UserSecurityProperties
();
}
// ========== 拦截器相关 ==========
// ========== 拦截器相关 ==========
@Bean
@Bean
...
@@ -27,8 +36,11 @@ public class UserSecurityAutoConfiguration implements WebMvcConfigurer {
...
@@ -27,8 +36,11 @@ public class UserSecurityAutoConfiguration implements WebMvcConfigurer {
@Override
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
UserSecurityProperties
properties
=
this
.
userSecurityProperties
();
// UserSecurityInterceptor 拦截器
// UserSecurityInterceptor 拦截器
registry
.
addInterceptor
(
this
.
userSecurityInterceptor
());
registry
.
addInterceptor
(
this
.
userSecurityInterceptor
())
.
excludePathPatterns
(
properties
.
getIgnorePaths
())
.
excludePathPatterns
(
properties
.
getDefaultIgnorePaths
());;
logger
.
info
(
"[addInterceptors][加载 UserSecurityInterceptor 拦截器完成]"
);
logger
.
info
(
"[addInterceptors][加载 UserSecurityInterceptor 拦截器完成]"
);
}
}
...
...
common/mall-spring-boot-starter-security-user/src/main/java/cn/iocoder/mall/security/user/config/UserSecurityProperties.java
0 → 100644
浏览文件 @
c6c838d7
package
cn
.
iocoder
.
mall
.
security
.
user
.
config
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
@ConfigurationProperties
(
"mall.security.user"
)
public
class
UserSecurityProperties
{
private
static
final
String
[]
DEFAULT_IGNORE_PATHS
=
new
String
[]{
// Swagger 相关
"/doc.html"
,
"/swagger-resources"
,
"/swagger-resources/**"
,
"/webjars/**"
,
// Actuator 相关
};
/**
* 自定义忽略 Path
*/
private
String
[]
ignorePaths
=
new
String
[
0
];
/**
* 默认忽略 Path
*/
private
String
[]
defaultIgnorePaths
=
DEFAULT_IGNORE_PATHS
;
public
String
[]
getIgnorePaths
()
{
return
ignorePaths
;
}
public
UserSecurityProperties
setIgnorePaths
(
String
[]
ignorePaths
)
{
this
.
ignorePaths
=
ignorePaths
;
return
this
;
}
public
String
[]
getDefaultIgnorePaths
()
{
return
defaultIgnorePaths
;
}
public
UserSecurityProperties
setDefaultIgnorePaths
(
String
[]
defaultIgnorePaths
)
{
this
.
defaultIgnorePaths
=
defaultIgnorePaths
;
return
this
;
}
}
docs/sql/mall_user_schema.sql
deleted
100644 → 0
浏览文件 @
da826a21
product-service-project/product-service-app/src/main/resources/sql/mall_product_data.sql
0 → 100644
浏览文件 @
c6c838d7
差异被折叠。
点击展开。
product-service-project/product-service-app/src/main/resources/sql/mall_product_schema.sql
0 → 100644
浏览文件 @
c6c838d7
SET
NAMES
utf8mb4
;
SET
FOREIGN_KEY_CHECKS
=
0
;
-- ----------------------------
-- Table structure for product_spu
-- ----------------------------
CREATE
TABLE
`product_spu`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'SPU 编号'
,
`name`
varchar
(
50
)
NOT
NULL
DEFAULT
''
COMMENT
'SPU 名字'
,
`sell_point`
varchar
(
50
)
NOT
NULL
DEFAULT
''
COMMENT
'卖点'
,
`description`
text
NOT
NULL
COMMENT
'描述'
,
`cid`
int
(
11
)
NOT
NULL
DEFAULT
'-1'
COMMENT
'分类编号'
,
`pic_urls`
varchar
(
1024
)
NOT
NULL
DEFAULT
''
COMMENT
'商品主图地址
\n
*
\n
* 数组,以逗号分隔
\n
*
\n
* 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张'
,
`visible`
tinyint
(
4
)
NOT
NULL
DEFAULT
'0'
COMMENT
'是否上架商品(是否可见)。
\n
*
\n
* true 为已上架
\n
* false 为已下架'
,
`sort`
int
(
11
)
NOT
NULL
DEFAULT
'0'
COMMENT
'排序字段'
,
`price`
int
(
11
)
NOT
NULL
COMMENT
'价格'
,
`quantity`
int
(
11
)
NOT
NULL
COMMENT
'库存数量'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后更新时间'
,
`deleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
68
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'商品 SPU'
;
-- ----------------------------
-- Table structure for product_sku
-- ----------------------------
CREATE
TABLE
`product_sku`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'sku 编号'
,
`spu_id`
int
(
11
)
NOT
NULL
DEFAULT
'-1'
COMMENT
'商品编号'
,
`status`
int
(
11
)
NOT
NULL
DEFAULT
'-1'
COMMENT
'状态
\n
*
\n
* 1-正常
\n
* 2-禁用'
,
`pic_url`
varchar
(
50
)
DEFAULT
''
COMMENT
'图片地址'
,
`attrs`
varchar
(
50
)
NOT
NULL
DEFAULT
''
COMMENT
'规格值({@link ProductAttrDO})数组
\n
*
\n
* 数组,以逗号分隔'
,
`price`
int
(
11
)
NOT
NULL
DEFAULT
'-1'
COMMENT
'价格,单位:分'
,
`quantity`
int
(
11
)
NOT
NULL
DEFAULT
'-1'
COMMENT
'库存数量'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后更新时间'
,
`deleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
88
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'商品 SKU'
;
-- ----------------------------
-- Table structure for product_attr_key
-- ----------------------------
CREATE
TABLE
`product_attr_key`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'规格键编号'
,
`name`
varchar
(
50
)
NOT
NULL
DEFAULT
''
COMMENT
'规格键名称'
,
`status`
tinyint
(
4
)
NOT
NULL
DEFAULT
'1'
COMMENT
'状态
\n
*
\n
* 1-开启
\n
* 2-禁用'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后更新时间'
,
`deleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
12
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'商品规格键'
;
-- ----------------------------
-- Table structure for product_attr_value
-- ----------------------------
CREATE
TABLE
`product_attr_value`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'规格值编号'
,
`attr_key_id`
int
(
11
)
NOT
NULL
COMMENT
'规格键编号'
,
`name`
varchar
(
50
)
NOT
NULL
DEFAULT
''
COMMENT
'规格值名字'
,
`status`
tinyint
(
4
)
NOT
NULL
DEFAULT
'1'
COMMENT
'状态
\n
*
\n
* 1-开启
\n
* 2-禁用'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后更新时间'
,
`deleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
52
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'商品规格值'
;
-- ----------------------------
-- Table structure for product_category
-- ----------------------------
CREATE
TABLE
`product_category`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'分类编号'
,
`pid`
int
(
11
)
NOT
NULL
COMMENT
'父分类编号'
,
`name`
varchar
(
16
)
NOT
NULL
COMMENT
'分类名称'
,
`description`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'分类描述'
,
`pic_url`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'分类图片'
,
`sort`
int
(
11
)
NOT
NULL
COMMENT
'分类排序'
,
`status`
tinyint
(
4
)
NOT
NULL
COMMENT
'状态'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后更新时间'
,
`deleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
801
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'商品分类表'
;
-- ----------------------------
-- Table structure for product_brand
-- ----------------------------
CREATE
TABLE
`product_brand`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'品牌编号'
,
`name`
varchar
(
50
)
NOT
NULL
COMMENT
'品牌名称'
,
`description`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'品牌描述'
,
`pic_url`
varchar
(
1024
)
DEFAULT
NULL
COMMENT
'品牌名图片'
,
`status`
tinyint
(
4
)
NOT
NULL
COMMENT
'状态 1开启 2禁用'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后更新时间'
,
`deleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'是否删除'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
4
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'商品品牌'
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论