Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
master-4.0
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
master-4.0
Commits
218c73a2
提交
218c73a2
authored
1月 07, 2019
作者:
chenxinchang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
9107d1d1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
5 行增加
和
17 行删除
+5
-17
MemberController.java
...om/zrqx/member/bg/member/controller/MemberController.java
+5
-17
没有找到文件。
com.zrqx.member/src/main/java/com/zrqx/member/bg/member/controller/MemberController.java
浏览文件 @
218c73a2
...
...
@@ -36,6 +36,7 @@ import com.zrqx.member.bg.member.service.PayInfoService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
tk.mybatis.mapper.entity.Example.Criteria
;
/**
...
...
@@ -61,7 +62,7 @@ public class MemberController {
//@ApiOperation(value = "新增会员", notes = "新增一个会员,返回id-普通用户和专家用户 共用此接口")
//@PostMapping(value = MemberRequestPath.SAVE)
public
CallBack
<
Integer
>
insert
(
@Validated
@RequestBody
Member
entity
)
{
if
(
isExist
(
null
,
entity
.
getAccount
())
!=
null
)
{
if
(
service
.
isExistByAccount
(
null
,
entity
.
getAccount
())
)
{
throw
new
BusinessValidateException
(
"用户已存在!"
);
}
entity
.
setCreateTime
(
new
Date
());
...
...
@@ -84,7 +85,7 @@ public class MemberController {
//@ApiOperation(value = "修改会员", notes = "修改一个会员-普通用户和专家用户 共用此接口")
//@PostMapping(value = MemberRequestPath.UPDATE)
public
CallBack
<
Boolean
>
update
(
@RequestBody
Member
entity
)
{
if
(
isExist
(
entity
.
getId
(),
entity
.
getAccount
())
!=
null
)
{
if
(
service
.
isExistByAccount
(
entity
.
getId
(),
entity
.
getAccount
())
)
{
throw
new
BusinessValidateException
(
"用户已存在!"
);
}
Member
member
=
service
.
selectByPrimaryKey
(
entity
.
getId
());
...
...
@@ -134,7 +135,8 @@ public class MemberController {
}
@ApiOperation
(
value
=
"批量设置会员状态"
,
notes
=
"批量设置会员状态-普通用户和专家用户 共用此接口"
)
@PostMapping
(
value
=
MemberRequestPath
.
BATCH_UPDATE
+
MemberRequestPath
.
STATUS
+
MemberRequestPath
.
VALUE
)
public
CallBack
<
Boolean
>
updateStatus
(
@PathVariable
(
"value"
)
Integer
value
,
@RequestBody
List
<
Integer
>
ids
)
{
public
CallBack
<
Boolean
>
updateStatus
(
@ApiParam
(
value
=
"用户状态 0 禁用 1启用"
)
@PathVariable
(
"value"
)
Integer
value
,
@ApiParam
(
value
=
"用户id集合"
)
@RequestBody
List
<
Integer
>
ids
)
{
if
(!
StatusEnum
.
isExist
(
value
))
{
throw
new
ParameterValidateException
(
"会员状态参数不正确!"
);
}
...
...
@@ -146,18 +148,4 @@ public class MemberController {
}
return
CallBack
.
success
();
}
/**
* 判断 账号是否已存在
* @param id
* @param account
* @return
*/
public
Member
isExist
(
Integer
id
,
String
account
)
{
Criteria
cr
=
service
.
createCriteria
();
cr
.
andEqualTo
(
"account"
,
account
);
if
(
id
!=
null
)
{
cr
.
andNotEqualTo
(
"id"
,
id
);
}
return
service
.
selectOneByCriteria
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论