Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
0010701e
提交
0010701e
authored
5月 15, 2019
作者:
sin
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
236f0f33
f05ad4d8
隐藏空白字符变更
内嵌
并排
正在显示
30 个修改的文件
包含
329 行增加
和
129 行删除
+329
-129
README.md
README.md
+12
-1
pom.xml
common/common-framework/pom.xml
+5
-0
DeletableDO.java
...a/cn/iocoder/common/framework/dataobject/DeletableDO.java
+3
-0
功能列表-管理后台.md
docs/guides/功能列表/功能列表-管理后台.md
+1
-2
OrderCommentDO.java
.../cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java
+100
-0
OrderCommentReplayDO.java
...coder/mall/order/biz/dataobject/OrderCommentReplayDO.java
+85
-0
application.yaml
...r-service-impl/src/main/resources/config/application.yaml
+2
-1
pom.xml
pom.xml
+5
-0
application.yaml
...n-service-impl/src/main/resources/config/application.yaml
+1
-1
AdminController.java
.../admin/application/controller/admins/AdminController.java
+16
-23
AdminConvert.java
.../iocoder/mall/admin/application/convert/AdminConvert.java
+3
-4
AdminVO.java
...in/java/cn/iocoder/mall/admin/application/vo/AdminVO.java
+4
-0
application-test.yaml
...stem-application/src/main/resources/application-test.yaml
+0
-4
application.yaml
...em/system-application/src/main/resources/application.yaml
+5
-1
pom.xml
system/system-service-api/pom.xml
+6
-0
AdminService.java
...src/main/java/cn/iocoder/mall/admin/api/AdminService.java
+6
-6
AdminBO.java
...main/java/cn/iocoder/mall/admin/api/bo/admin/AdminBO.java
+13
-19
AdminPageBO.java
.../java/cn/iocoder/mall/admin/api/bo/admin/AdminPageBO.java
+1
-1
AdminAddDTO.java
...java/cn/iocoder/mall/admin/api/dto/admin/AdminAddDTO.java
+9
-13
AdminPageDTO.java
...ava/cn/iocoder/mall/admin/api/dto/admin/AdminPageDTO.java
+1
-1
AdminUpdateDTO.java
...a/cn/iocoder/mall/admin/api/dto/admin/AdminUpdateDTO.java
+9
-1
DatabaseConfiguration.java
...a/cn/iocoder/mall/admin/config/DatabaseConfiguration.java
+8
-0
AdminConvert.java
...main/java/cn/iocoder/mall/admin/convert/AdminConvert.java
+4
-5
AdminMapper.java
.../src/main/java/cn/iocoder/mall/admin/dao/AdminMapper.java
+7
-8
AdminDO.java
...c/main/java/cn/iocoder/mall/admin/dataobject/AdminDO.java
+2
-0
AdminServiceImpl.java
.../java/cn/iocoder/mall/admin/service/AdminServiceImpl.java
+8
-8
application.yaml
...m-service-impl/src/main/resources/config/application.yaml
+2
-0
AdminMapper.xml
...em-service-impl/src/main/resources/mapper/AdminMapper.xml
+0
-18
application.yaml
...r-service-impl/src/main/resources/config/application.yaml
+10
-11
OAuth2RefreshTokenMapper.xml
...pl/src/main/resources/mapper/OAuth2RefreshTokenMapper.xml
+1
-1
没有找到文件。
README.md
浏览文件 @
0010701e
...
...
@@ -16,6 +16,17 @@
> 一起交流,Get 知识。
*
我们迫切希望更多的参与进来,可以加入「交流群」,一起骚聊。
*
[
《Onemall 电商开源项目 —— 应用分层》
](
http://www.iocoder.cn/Onemall/Application-layer/?vip&onemall
)
# 近期计划
近期准备开发如下功能:
1.
微信 H5 网页登陆
2.
订单评价
3.
商品品牌
4.
短信接入
5.
访问日志、错误日志接入
# 演示
...
...
@@ -126,7 +137,7 @@ TODO 此处应有一个架构图的装逼 JPG 图。
|
[
Zookeeper
](
http://zookeeper.apache.org/
)
| 分布式系统协调 | 3.4.9 作为注册中心 |
|
[
XXL-Job
](
http://www.xuxueli.com/xxl-job/
)
| 分布式任务调度平台 | 2.0.1 |
|
[
springfox-swagger2
](
https://github.com/springfox/springfox/tree/master/springfox-swagger2
)
| API 文档 | 2.9.2 |
|
[
swagger-bootstrap-ui
](
https://gitee.com/xiaoym/swagger-bootstrap-ui
)
|
API 文档
| 1.9.3 |
|
[
swagger-bootstrap-ui
](
https://gitee.com/xiaoym/swagger-bootstrap-ui
)
|
Swagger 增强 UI 实现
| 1.9.3 |
未来考虑引入
...
...
common/common-framework/pom.xml
浏览文件 @
0010701e
...
...
@@ -32,6 +32,11 @@
<artifactId>
mybatis
</artifactId>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-annotation
</artifactId>
</dependency>
<!-- RPC 相关 -->
<dependency>
<groupId>
org.apache.dubbo
</groupId>
...
...
common/common-framework/src/main/java/cn/iocoder/common/framework/dataobject/DeletableDO.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
common
.
framework
.
dataobject
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
/**
* extends BaseDO 扩展 delete 操作
*
...
...
@@ -11,6 +13,7 @@ public class DeletableDO extends BaseDO {
/**
* 是否删除
*/
@TableLogic
private
Integer
deleted
;
@Override
...
...
docs/guides/功能列表/功能列表-管理后台.md
浏览文件 @
0010701e
...
...
@@ -37,7 +37,6 @@
-
[
]
短信管理
-
[
]
短信模板
-
[
]
发送日志
-
[
]
用户访问日志
-
[
]
员工访问日志
-
[
]
员工操作日志
-
[
]
访问日志
-
[
]
异常日志
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentDO.java
0 → 100644
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
order
.
biz
.
dataobject
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 订单评论表
*
* @author wtz
* @time 2019-05-14 20:48
*
*/
@Data
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"order_comment"
)
public
class
OrderCommentDO
extends
BaseDO
{
/**
* 评论id
*/
private
Integer
id
;
/**
* 订单id
*/
private
Integer
orderId
;
/**
* 订单编号
*/
private
String
orderNo
;
/**
* 商品SKUid
*/
private
Integer
productSkuId
;
/**
* 商品SKU属性
*/
private
String
productSkuAttrs
;
/**
* 用户id
*/
private
Integer
userId
;
/**
* 用户头像
*/
private
String
userAvatar
;
/**
* 用户的真实姓名
*/
private
String
userNickName
;
/**
* 评价星
*/
private
Integer
star
;
/**
* 商品描述
*/
private
Integer
productDescriptionStar
;
/**
* 物流评价
*/
private
Integer
logisticsStar
;
/**
* 商家评价
*/
private
Integer
merchantStar
;
/**
* 回复条数
*/
private
Integer
replayCount
;
/**
* 点赞数
*/
private
Integer
collectCount
;
/**
* 评论的内容
*/
private
String
commentContent
;
/**
* 评论的图片地址
*/
private
String
commentPics
;
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/OrderCommentReplayDO.java
0 → 100644
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
order
.
biz
.
dataobject
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 商品评价回复表
*
* @author wtz
* @time 2019-05-14 21:00
*
*/
@Data
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"order_comment_replay"
)
public
class
OrderCommentReplayDO
extends
BaseDO
{
/**
* 回复id
*/
private
Integer
id
;
/**
* 评论id
*/
private
Integer
commentId
;
/**
* 回复的类型
*/
private
Integer
replyType
;
/**
* 父id
*/
private
Integer
parentId
;
/**
* 回复目标用户id
*/
private
Integer
parentUserId
;
/**
* 回复目标用户昵称
*/
private
String
parentUserNickName
;
/**
* 回复目标用户头像
*/
private
String
parentUserAvatar
;
/**
* 回复的数量
*/
private
String
replyContent
;
/**
* 回复用户id
*/
private
Integer
replyUserId
;
/**
* 回复用户昵称
*/
private
String
replyUserNickName
;
/**
* 回复用户头像
*/
private
String
replyUserAvatar
;
/**
* 回复用户身份
*/
private
Integer
replyUserType
;
/**
* 回复点赞数
*/
private
Integer
replyCollectCount
;
}
order/order-service-impl/src/main/resources/config/application.yaml
浏览文件 @
0010701e
...
...
@@ -7,7 +7,7 @@ spring:
password
:
${MALL_MYSQL_PASSWORD}
# mybatis
mybatis
:
#
mybatis:
# config-location: classpath:mybatis-config.xml
# mapper-locations: classpath:mapper/*.xml
# type-aliases-package: cn.iocoder.mall.order.biz.dataobject
...
...
@@ -21,6 +21,7 @@ mybatis-plus:
id-type
:
auto
mapper-locations
:
classpath*:mapper/*.xml
type-aliases-package
:
cn.iocoder.mall.order.biz.dataobject
config-location
:
classpath:mybatis-config.xml
# dubbo
dubbo
:
...
...
pom.xml
浏览文件 @
0010701e
...
...
@@ -139,6 +139,11 @@
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
${mybatis-spring-boot-starter.version}
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-annotation
</artifactId>
<version>
${mybatis-plus.version}
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
...
...
promotion/promotion-service-impl/src/main/resources/config/application.yaml
浏览文件 @
0010701e
...
...
@@ -26,7 +26,7 @@ mybatis-plus:
id-type
:
auto
mapper-locations
:
classpath*:mapper/*.xml
type-aliases-package
:
cn.iocoder.mall.promotion.biz.dataobject
config-location
:
classpath:mybatis-config.xml
# dubbo
dubbo
:
application
:
...
...
system/system-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/AdminController.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.constant.MallConstants
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.api.AdminService
;
import
cn.iocoder.mall.admin.api.ResourceService
;
import
cn.iocoder.mall.admin.api.RoleService
;
import
cn.iocoder.mall.admin.api.bo.AdminPageBO
;
import
cn.iocoder.mall.admin.api.bo.ResourceBO
;
import
cn.iocoder.mall.admin.api.bo.RoleBO
;
import
cn.iocoder.mall.admin.api.bo.admin.AdminBO
;
import
cn.iocoder.mall.admin.api.bo.admin.AdminPageBO
;
import
cn.iocoder.mall.admin.api.constant.ResourceConstants
;
import
cn.iocoder.mall.admin.api.dto.AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminUpdateDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminUpdateDTO
;
import
cn.iocoder.mall.admin.application.convert.AdminConvert
;
import
cn.iocoder.mall.admin.application.convert.ResourceConvert
;
import
cn.iocoder.mall.admin.application.vo.AdminMenuTreeNodeVO
;
import
cn.iocoder.mall.admin.application.vo.AdminPageVO
;
import
cn.iocoder.mall.admin.application.vo.AdminRoleVO
;
import
cn.iocoder.mall.admin.application.vo.AdminVO
;
import
cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder
;
import
cn.iocoder.common.framework.constant.MallConstants
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -29,6 +29,8 @@ import org.springframework.web.bind.annotation.*;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
MallConstants
.
ROOT_PATH_ADMIN
+
"/admin"
)
@Api
(
"管理员模块"
)
...
...
@@ -70,7 +72,7 @@ public class AdminController {
.
filter
(
node
->
node
.
getPid
().
equals
(
ResourceConstants
.
PID_ROOT
))
// .sorted(Comparator.comparing(AdminMenuTreeNodeVO::getSort))
.
collect
(
Collectors
.
toList
());
return
CommonResult
.
success
(
rootNodes
);
return
success
(
rootNodes
);
}
@GetMapping
(
"/url_resource_list"
)
...
...
@@ -78,7 +80,7 @@ public class AdminController {
// @ApiModelProperty(value = "data", example = "['/admin/role/add', '/admin/role/update']") 没效果
public
CommonResult
<
Set
<
String
>>
urlResourceList
()
{
List
<
ResourceBO
>
resources
=
resourceService
.
getResourcesByTypeAndRoleIds
(
ResourceConstants
.
TYPE_URL
,
AdminSecurityContextHolder
.
getContext
().
getRoleIds
());
return
CommonResult
.
success
(
resources
.
stream
().
map
(
ResourceBO:
:
getHandler
).
collect
(
Collectors
.
toSet
()));
return
success
(
resources
.
stream
().
map
(
ResourceBO:
:
getHandler
).
collect
(
Collectors
.
toSet
()));
}
// =========== 管理员管理 API ===========
...
...
@@ -90,25 +92,16 @@ public class AdminController {
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"页码,从 1 开始"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页条数"
,
required
=
true
,
example
=
"10"
),
})
public
CommonResult
<
AdminPageVO
>
page
(
@RequestParam
(
value
=
"nickname"
,
required
=
false
)
String
nickname
,
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
CommonResult
<
AdminPageBO
>
result
=
adminService
.
getAdminPage
(
new
AdminPageDTO
().
setNickname
(
nickname
).
setPageNo
(
pageNo
).
setPageSize
(
pageSize
));
public
CommonResult
<
AdminPageVO
>
page
(
AdminPageDTO
adminPageDTO
)
{
// CommonResult<AdminPageBO> result = adminService.getAdminPage(new AdminPageDTO().setNickname(nickname).setPageNo(pageNo).setPageSize(pageSize));
CommonResult
<
AdminPageBO
>
result
=
adminService
.
getAdminPage
(
adminPageDTO
);
return
AdminConvert
.
INSTANCE
.
convert
(
result
);
}
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"创建管理员"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"username"
,
value
=
"账号"
,
required
=
true
,
example
=
"15601691300"
),
@ApiImplicitParam
(
name
=
"nickname"
,
value
=
"昵称"
,
required
=
true
,
example
=
"小王"
),
@ApiImplicitParam
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
,
example
=
"buzhidao"
),
})
public
CommonResult
<
AdminVO
>
add
(
@RequestParam
(
"username"
)
String
username
,
@RequestParam
(
"nickname"
)
String
nickname
,
@RequestParam
(
"password"
)
String
password
)
{
AdminAddDTO
adminAddDTO
=
new
AdminAddDTO
().
setUsername
(
username
).
setNickname
(
nickname
).
setPassword
(
password
);
return
AdminConvert
.
INSTANCE
.
convert2
(
adminService
.
addAdmin
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
adminAddDTO
));
public
CommonResult
<
AdminBO
>
add
(
AdminAddDTO
adminAddDTO
)
{
return
success
(
adminService
.
addAdmin
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
adminAddDTO
));
}
@PostMapping
(
"/update"
)
...
...
@@ -157,7 +150,7 @@ public class AdminController {
List
<
AdminRoleVO
>
result
=
AdminConvert
.
INSTANCE
.
convert
(
allRoleList
);
// 设置每个角色是否赋予给改管理员
result
.
forEach
(
adminRoleVO
->
adminRoleVO
.
setAssigned
(
adminRoleIdSet
.
contains
(
adminRoleVO
.
getId
())));
return
CommonResult
.
success
(
result
);
return
success
(
result
);
}
@PostMapping
(
"/assign_role"
)
...
...
system/system-application/src/main/java/cn/iocoder/mall/admin/application/convert/AdminConvert.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
application
.
convert
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.api.bo.AdminBO
;
import
cn.iocoder.mall.admin.api.bo.AdminPageBO
;
import
cn.iocoder.mall.admin.api.bo.
admin.
AdminBO
;
import
cn.iocoder.mall.admin.api.bo.
admin.
AdminPageBO
;
import
cn.iocoder.mall.admin.api.bo.RoleBO
;
import
cn.iocoder.mall.admin.application.vo.AdminInfoVO
;
import
cn.iocoder.mall.admin.application.vo.AdminPageVO
;
...
...
@@ -35,4 +35,4 @@ public interface AdminConvert {
@Mappings
({})
List
<
AdminRoleVO
>
convert
(
List
<
RoleBO
>
roleList
);
}
\ No newline at end of file
}
system/system-application/src/main/java/cn/iocoder/mall/admin/application/vo/AdminVO.java
浏览文件 @
0010701e
...
...
@@ -14,12 +14,16 @@ public class AdminVO {
@ApiModelProperty
(
value
=
"管理员编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"登陆账号"
,
required
=
true
,
example
=
"15601691300"
)
private
String
username
;
@ApiModelProperty
(
value
=
"昵称"
,
required
=
true
,
example
=
"小王"
)
private
String
nickname
;
@ApiModelProperty
(
value
=
"账号状态"
,
required
=
true
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳格式"
)
private
Date
createTime
;
...
...
system/system-application/src/main/resources/application-test.yaml
浏览文件 @
0010701e
...
...
@@ -16,7 +16,3 @@ management:
swagger
:
enable
:
true
# 暂时不去掉
title
:
管理员子系统
description
:
管理员子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.admin.application.controller
system/system-application/src/main/resources/application.yaml
浏览文件 @
0010701e
...
...
@@ -27,4 +27,8 @@ qiniu:
bucket
:
onemall
swagger
:
enable
:
false
# 暂时不去掉
enable
:
true
# 暂时不去掉
title
:
管理员子系统
description
:
管理员子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.admin.application.controller
system/system-service-api/pom.xml
浏览文件 @
0010701e
...
...
@@ -19,6 +19,12 @@
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>
org.mapstruct
</groupId>
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/AdminService.java
浏览文件 @
0010701e
...
...
@@ -3,11 +3,11 @@ package cn.iocoder.mall.admin.api;
import
cn.iocoder.common.framework.constant.CommonStatusEnum
;
import
cn.iocoder.common.framework.validator.InEnum
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.api.bo.AdminBO
;
import
cn.iocoder.mall.admin.api.bo.AdminPageBO
;
import
cn.iocoder.mall.admin.api.dto.AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminUpdateDTO
;
import
cn.iocoder.mall.admin.api.bo.
admin.
AdminBO
;
import
cn.iocoder.mall.admin.api.bo.
admin.
AdminPageBO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminUpdateDTO
;
import
java.util.Set
;
...
...
@@ -18,7 +18,7 @@ public interface AdminService {
CommonResult
<
AdminPageBO
>
getAdminPage
(
AdminPageDTO
adminPageDTO
);
CommonResult
<
AdminBO
>
addAdmin
(
Integer
adminId
,
AdminAddDTO
adminAddDTO
);
AdminBO
addAdmin
(
Integer
adminId
,
AdminAddDTO
adminAddDTO
);
CommonResult
<
Boolean
>
updateAdmin
(
Integer
adminId
,
AdminUpdateDTO
adminUpdateDTO
);
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/AdminBO.java
→
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/
admin/
AdminBO.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
api
.
bo
;
package
cn
.
iocoder
.
mall
.
admin
.
api
.
bo
.
admin
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 管理员 BO
*/
@ApiModel
(
"管理员 BO"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminBO
implements
Serializable
{
/**
* 管理员编号
*/
@ApiModelProperty
(
value
=
"管理员编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
/**
* 登陆账号
*/
@ApiModelProperty
(
value
=
"登陆账号"
,
required
=
true
,
example
=
"15601691300"
)
private
String
username
;
/**
* 昵称
*/
@ApiModelProperty
(
value
=
"昵称"
,
required
=
true
,
example
=
"小王"
)
private
String
nickname
;
/**
* 账号状态
*/
@ApiModelProperty
(
value
=
"账号状态"
,
required
=
true
,
example
=
"1"
,
dataType
=
"CommonStatusEnum"
)
private
Integer
status
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳格式"
)
private
Date
createTime
;
}
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/AdminPageBO.java
→
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/bo/
admin/
AdminPageBO.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
api
.
bo
;
package
cn
.
iocoder
.
mall
.
admin
.
api
.
bo
.
admin
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/AdminAddDTO.java
→
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/
admin/
AdminAddDTO.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
api
.
dto
;
package
cn
.
iocoder
.
mall
.
admin
.
api
.
dto
.
admin
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
...
...
@@ -8,29 +10,23 @@ import javax.validation.constraints.NotEmpty;
import
javax.validation.constraints.Pattern
;
import
java.io.Serializable
;
/**
* 管理员添加 DTO
*/
@ApiModel
(
"管理员添加 DTO"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminAddDTO
implements
Serializable
{
/**
* 登陆账号
*/
@ApiModelProperty
(
value
=
"登陆账号"
,
required
=
true
,
example
=
"15601691300"
)
@NotEmpty
(
message
=
"登陆账号不能为空"
)
@Length
(
min
=
6
,
max
=
16
,
message
=
"账号长度为 6-16 位"
)
@Pattern
(
regexp
=
"^[A-Za-z0-9]+$"
,
message
=
"账号格式为数字以及字母"
)
private
String
username
;
/**
* 昵称
*/
@ApiModelProperty
(
value
=
"昵称"
,
required
=
true
,
example
=
"小王"
)
@NotEmpty
(
message
=
"昵称不能为空"
)
@Length
(
max
=
10
,
message
=
"昵称长度最大为 10 位"
)
private
String
nickname
;
/**
* 密码
*/
@ApiModelProperty
(
value
=
"密码"
,
required
=
true
,
example
=
"buzhidao"
)
@NotEmpty
(
message
=
"密码不能为空"
)
@Length
(
min
=
6
,
max
=
16
,
message
=
"密码长度为 6-16 位"
)
private
String
password
;
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/AdminPageDTO.java
→
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/
admin/
AdminPageDTO.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
api
.
dto
;
package
cn
.
iocoder
.
mall
.
admin
.
api
.
dto
.
admin
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
...
...
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/AdminUpdateDTO.java
→
system/system-service-api/src/main/java/cn/iocoder/mall/admin/api/dto/
admin/
AdminUpdateDTO.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
api
.
dto
;
package
cn
.
iocoder
.
mall
.
admin
.
api
.
dto
.
admin
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.hibernate.validator.constraints.Length
;
...
...
@@ -14,6 +16,12 @@ import java.io.Serializable;
*/
@Data
@Accessors
(
chain
=
true
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"管理员编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"username"
,
value
=
"账号"
,
required
=
true
,
example
=
"15601691300"
),
@ApiImplicitParam
(
name
=
"nickname"
,
value
=
"昵称"
,
required
=
true
,
example
=
"小王"
),
@ApiImplicitParam
(
name
=
"password"
,
value
=
"密码"
,
example
=
"buzhidao"
),
})
public
class
AdminUpdateDTO
implements
Serializable
{
/**
...
...
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/config/DatabaseConfiguration.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
config
;
import
com.baomidou.mybatisplus.core.injector.DefaultSqlInjector
;
import
com.baomidou.mybatisplus.core.injector.ISqlInjector
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
...
...
@@ -11,4 +14,9 @@ public class DatabaseConfiguration {
// 数据库连接池 Druid
@Bean
public
ISqlInjector
sqlInjector
()
{
return
new
DefaultSqlInjector
();
// MyBatis Plus 逻辑删除
}
}
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/convert/AdminConvert.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
convert
;
import
cn.iocoder.mall.admin.api.bo.AdminBO
;
import
cn.iocoder.mall.admin.api.dto.AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminUpdateDTO
;
import
cn.iocoder.mall.admin.api.bo.
admin.
AdminBO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminUpdateDTO
;
import
cn.iocoder.mall.admin.dataobject.AdminDO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
...
...
@@ -27,4 +27,4 @@ public interface AdminConvert {
@Mappings
({})
List
<
AdminBO
>
convert
(
List
<
AdminDO
>
adminBOs
);
}
\ No newline at end of file
}
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/AdminMapper.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
dao
;
import
cn.iocoder.mall.admin.dataobject.AdminDO
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
AdminMapper
{
public
interface
AdminMapper
extends
BaseMapper
<
AdminDO
>
{
AdminDO
selectById
(
@Param
(
"id"
)
Integer
id
);
AdminDO
selectByUsername
(
@Param
(
"username"
)
String
username
);
default
AdminDO
selectByUsername
(
@Param
(
"username"
)
String
username
)
{
return
selectOne
(
new
QueryWrapper
<
AdminDO
>().
eq
(
"username"
,
username
));
}
List
<
AdminDO
>
selectListByNicknameLike
(
@Param
(
"nickname"
)
String
nickname
,
@Param
(
"offset"
)
Integer
offset
,
...
...
@@ -19,8 +21,6 @@ public interface AdminMapper {
Integer
selectCountByNicknameLike
(
@Param
(
"nickname"
)
String
nickname
);
void
insert
(
AdminDO
admin
);
int
update
(
AdminDO
admin
);
}
\ No newline at end of file
}
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dataobject/AdminDO.java
浏览文件 @
0010701e
package
cn
.
iocoder
.
mall
.
admin
.
dataobject
;
import
cn.iocoder.common.framework.dataobject.DeletableDO
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
/**
* 管理员实体
*/
@TableName
(
value
=
"admin"
)
@Data
@Accessors
(
chain
=
true
)
public
class
AdminDO
extends
DeletableDO
{
...
...
system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/AdminServiceImpl.java
浏览文件 @
0010701e
...
...
@@ -5,13 +5,13 @@ import cn.iocoder.common.framework.constant.DeletedStatusEnum;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.api.AdminService
;
import
cn.iocoder.mall.admin.api.bo.AdminBO
;
import
cn.iocoder.mall.admin.api.bo.AdminPageBO
;
import
cn.iocoder.mall.admin.api.bo.
admin.
AdminBO
;
import
cn.iocoder.mall.admin.api.bo.
admin.
AdminPageBO
;
import
cn.iocoder.mall.admin.api.constant.AdminConstants
;
import
cn.iocoder.mall.admin.api.constant.AdminErrorCodeEnum
;
import
cn.iocoder.mall.admin.api.dto.AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.AdminUpdateDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminAddDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminPageDTO
;
import
cn.iocoder.mall.admin.api.dto.
admin.
AdminUpdateDTO
;
import
cn.iocoder.mall.admin.convert.AdminConvert
;
import
cn.iocoder.mall.admin.dao.AdminMapper
;
import
cn.iocoder.mall.admin.dao.AdminRoleMapper
;
...
...
@@ -79,10 +79,10 @@ public class AdminServiceImpl implements AdminService {
}
@Override
public
CommonResult
<
AdminBO
>
addAdmin
(
Integer
adminId
,
AdminAddDTO
adminAddDTO
)
{
public
AdminBO
addAdmin
(
Integer
adminId
,
AdminAddDTO
adminAddDTO
)
{
// 校验账号唯一
if
(
adminMapper
.
selectByUsername
(
adminAddDTO
.
getUsername
())
!=
null
)
{
return
ServiceExceptionUtil
.
error
(
AdminErrorCodeEnum
.
ADMIN_USERNAME_EXISTS
.
getCode
());
throw
ServiceExceptionUtil
.
exception
(
AdminErrorCodeEnum
.
ADMIN_USERNAME_EXISTS
.
getCode
());
}
// 保存到数据库
AdminDO
admin
=
AdminConvert
.
INSTANCE
.
convert
(
adminAddDTO
)
...
...
@@ -93,7 +93,7 @@ public class AdminServiceImpl implements AdminService {
adminMapper
.
insert
(
admin
);
// TODO 插入操作日志
// 返回成功
return
CommonResult
.
success
(
AdminConvert
.
INSTANCE
.
convert
(
admin
)
);
return
AdminConvert
.
INSTANCE
.
convert
(
admin
);
}
@Override
...
...
system/system-service-impl/src/main/resources/config/application.yaml
浏览文件 @
0010701e
...
...
@@ -19,6 +19,8 @@ mybatis-plus:
global-config
:
db-config
:
id-type
:
auto
logic-delete-value
:
1
# 逻辑已删除值(默认为 1)
logic-not-delete-value
:
0
# 逻辑未删除值(默认为 0)
mapper-locations
:
classpath*:mapper/*.xml
type-aliases-package
:
cn.iocoder.mall.admin.dataobject
...
...
system/system-service-impl/src/main/resources/mapper/AdminMapper.xml
浏览文件 @
0010701e
...
...
@@ -7,14 +7,6 @@
create_time
</sql>
<select
id=
"selectByUsername"
parameterType=
"String"
resultType=
"AdminDO"
>
SELECT
<include
refid=
"FIELDS"
/>
FROM admin
WHERE username = #{username}
AND deleted = 0
</select>
<select
id=
"selectListByNicknameLike"
resultType=
"AdminDO"
>
SELECT
<include
refid=
"FIELDS"
/>
...
...
@@ -40,16 +32,6 @@
</where>
</select>
<insert
id=
"insert"
parameterType=
"AdminDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
>
INSERT INTO admin (
username, nickname, password, status,
create_time, deleted
) VALUES (
#{username}, #{nickname}, #{password}, #{status},
#{createTime}, #{deleted}
)
</insert>
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"AdminDO"
>
SELECT
<include
refid=
"FIELDS"
/>
...
...
user/user-service-impl/src/main/resources/config/application.yaml
浏览文件 @
0010701e
...
...
@@ -7,19 +7,18 @@ spring:
password
:
${MALL_MYSQL_PASSWORD}
# mybatis
mybatis
:
config-location
:
classpath:mybatis-config.xml
mapper-locations
:
classpath:mapper/*.xml
type-aliases-package
:
cn.iocoder.mall.user.biz.dataobject
#
mybatis:
#
config-location: classpath:mybatis-config.xml
#
mapper-locations: classpath:mapper/*.xml
#
type-aliases-package: cn.iocoder.mall.user.biz.dataobject
# mybatis-plus
#mybatis-plus:
# configuration:
# mapUnderscoreToCamelCase: true # 虽然默认为 true ,但是还是显示去指定下。
# mapperLocations: classpath*:mapper/*.xml
# typeAliasesPackage: cn.iocoder.mall.user.biz.dataobject
# mapper-locations: classpath*:mapper/*.xml
# type-aliases-package: cn.iocoder.mall.user.biz.dataobject
mybatis-plus
:
configuration
:
mapUnderscoreToCamelCase
:
true
# 虽然默认为 true ,但是还是显示去指定下。
mapperLocations
:
classpath*:mapper/*.xml
typeAliasesPackage
:
cn.iocoder.mall.user.biz.dataobject
config-location
:
classpath:mybatis-config.xml
# dubbo
dubbo
:
...
...
user/user-service-impl/src/main/resources/mapper/OAuth2RefreshTokenMapper.xml
浏览文件 @
0010701e
...
...
@@ -17,7 +17,7 @@
AND valid = 1
</update>
<select
id=
"selectById"
parameterType=
"
String"
resultType=
"
OAuth2RefreshTokenDO"
>
<select
id=
"selectById"
parameterType=
"
string"
resultType=
"cn.iocoder.mall.user.biz.dataobject.
OAuth2RefreshTokenDO"
>
SELECT
id, user_id, valid, expires_time, create_time
FROM oauth2_refresh_token
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论