Commit 596f3db6 authored by realize1020's avatar realize1020

更新手机号接口

parent dff23c4f
...@@ -381,4 +381,10 @@ public class AuthUserController extends BaseController<AuthUserService,AuthUser ...@@ -381,4 +381,10 @@ public class AuthUserController extends BaseController<AuthUserService,AuthUser
} }
@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
...@@ -188,5 +188,7 @@ public interface AuthUserService extends IService<AuthUserEntity> { ...@@ -188,5 +188,7 @@ public interface AuthUserService extends IService<AuthUserEntity> {
* @return * @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; ...@@ -2,6 +2,8 @@ package com.gx.obe.server.management.user.service.impl;
import java.util.List; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -250,4 +252,20 @@ public class AuthUserServiceImpl extends ServiceImpl<AuthUserMapper, AuthUserEnt ...@@ -250,4 +252,20 @@ public class AuthUserServiceImpl extends ServiceImpl<AuthUserMapper, AuthUserEnt
return authUserMapper.getGroupItemUserList(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