提交 218c73a2 authored 作者: chenxinchang's avatar chenxinchang

--no commit message

上级 9107d1d1
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论