Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
e771a9a5
提交
e771a9a5
authored
3月 10, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加管理员修改用户信息和状态接口
上级
a6d07fed
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
32 行增加
和
16 行删除
+32
-16
AdminsUserController.java
...r/application/controller/admins/AdminsUserController.java
+28
-8
application.yaml
user/user-application/src/main/resources/application.yaml
+4
-2
application.yaml
...r-service-impl/src/main/resources/config/application.yaml
+0
-6
没有找到文件。
user/user-application/src/main/java/cn/iocoder/mall/user/application/controller/admins/AdminsUserController.java
浏览文件 @
e771a9a5
...
...
@@ -6,15 +6,13 @@ import cn.iocoder.mall.user.application.vo.admins.AdminsUserPageVO;
import
cn.iocoder.mall.user.service.api.UserService
;
import
cn.iocoder.mall.user.service.api.bo.UserPageBO
;
import
cn.iocoder.mall.user.service.api.dto.UserPageDTO
;
import
cn.iocoder.mall.user.service.api.dto.UserUpdateDTO
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RequestMapping
(
"/admins/user"
)
...
...
@@ -26,7 +24,7 @@ public class AdminsUserController {
// 分页
@GetMapping
(
"/page"
)
@ApiOperation
(
value
=
"
管理员
分页"
)
@ApiOperation
(
value
=
"
用户
分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"nickname"
,
value
=
"昵称,模糊匹配"
,
example
=
"小王"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"页码,从 0 开始"
,
example
=
"0"
),
...
...
@@ -35,7 +33,6 @@ public class AdminsUserController {
public
CommonResult
<
AdminsUserPageVO
>
page
(
@RequestParam
(
value
=
"nickname"
,
required
=
false
)
String
nickname
,
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
// 创建 UserPageDTO
UserPageDTO
userPageDTO
=
new
UserPageDTO
().
setNickname
(
nickname
).
setPageNo
(
pageNo
).
setPageSize
(
pageSize
);
// 查询分页
CommonResult
<
UserPageBO
>
result
=
userService
.
getUserPage
(
userPageDTO
);
...
...
@@ -43,8 +40,30 @@ public class AdminsUserController {
return
UserConvert
.
INSTANCE
.
convert
(
result
);
}
// 更新用户信息
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新用户基本信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"用户编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"nickname"
,
value
=
"昵称"
,
required
=
true
,
example
=
"小王"
),
@ApiImplicitParam
(
name
=
"avatar"
,
value
=
"头像"
,
required
=
true
,
example
=
"http://www.iocoder.cn/xxx.jpg"
),
})
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"nickname"
)
String
nickname
,
@RequestParam
(
"avatar"
)
String
avatar
)
{
UserUpdateDTO
userUpdateDTO
=
new
UserUpdateDTO
().
setId
(
id
).
setNickname
(
nickname
).
setNickname
(
nickname
).
setAvatar
(
avatar
);
// 更新
return
userService
.
updateUser
(
userUpdateDTO
);
}
// 开启禁用
@PostMapping
(
"/update_status"
)
@ApiOperation
(
value
=
"更新用户状态"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"用户编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态。1 - 开启;2 - 禁用"
,
required
=
true
,
example
=
"1"
),
})
public
CommonResult
<
Boolean
>
updateStatus
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
return
userService
.
updateUserStatus
(
id
,
status
);
}
}
\ No newline at end of file
user/user-application/src/main/resources/application.yaml
浏览文件 @
e771a9a5
...
...
@@ -4,4 +4,6 @@ spring:
# server
server
:
port
:
8082
\ No newline at end of file
port
:
18082
servlet
:
context-path
:
/user-api/
\ No newline at end of file
user/user-service-impl/src/main/resources/config/application.yaml
浏览文件 @
e771a9a5
...
...
@@ -6,12 +6,6 @@ spring:
username
:
root
password
:
${MALL_MYSQL_PASSWORD}
# server
server
:
port
:
18082
servlet
:
context-path
:
/user-api/
# mybatis
mybatis
:
config-location
:
classpath:mybatis-config.xml
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论