Commit 596f3db6 authored by realize1020's avatar realize1020

更新手机号接口

parent dff23c4f
......@@ -379,6 +379,12 @@ public class AuthUserController extends BaseController<AuthUserService,AuthUser
}
return new Result<AuthUserVo>(null, "用户不存在!",Result.FAIL);
}
@PostMapping({"/updatePhone"})
public String updatePhone(@RequestParam("id") String id, @RequestParam("oldPhone") String oldPhone, @RequestParam("newPhone") String newPhone) {
return this.authUserService.updatePhone(id, oldPhone, newPhone);
}
}
\ No newline at end of file
......@@ -187,6 +187,8 @@ public interface AuthUserService extends IService<AuthUserEntity> {
* @param id
* @return
*/
List<AuthUserEntity> getGroupItemUserList(String id);
List<AuthUserEntity> getGroupItemUserList(String id);
String updatePhone(String id, String oldPhone, String newPhone);
}
......@@ -2,6 +2,8 @@ package com.gx.obe.server.management.user.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -249,5 +251,21 @@ public class AuthUserServiceImpl extends ServiceImpl<AuthUserMapper, AuthUserEnt
public List<AuthUserEntity> getGroupItemUserList(String id) {
return authUserMapper.getGroupItemUserList(id);
}
}
@Override
public String updatePhone(String id, String oldPhone, String newPhone) {
String returnFlag = "{\n\"suc\":\"0\"\n}";
if (oldPhone != null && newPhone != null) {
LambdaUpdateWrapper<AuthUserEntity> wrapper =new LambdaUpdateWrapper<>();
wrapper.set(AuthUserEntity::getPhone,newPhone);
wrapper.set(AuthUserEntity::getUserAccount,newPhone);
wrapper.eq(AuthUserEntity::getUserAccount,oldPhone);
this.update(wrapper);
//this.authUserMapper.updatePhone(id, oldPhone, newPhone);
returnFlag = "{\n\"suc\":\"1\"\n}";
}
return returnFlag;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment