|
@@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -112,6 +113,22 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
|
|
@Lock(value = "update.userId", prefix = "user_update_")
|
|
@Lock(value = "update.userId", prefix = "user_update_")
|
|
public R update(@RequestBody @Validated UserInfoDto.Update update) {
|
|
public R update(@RequestBody @Validated UserInfoDto.Update update) {
|
|
UserInfo byId = getById(update.getUserId());
|
|
UserInfo byId = getById(update.getUserId());
|
|
|
|
+ if (!StringUtils.isEmpty(update.getTel())) {
|
|
|
|
+ if (!byId.getTel().equals(update.getTel())) {
|
|
|
|
+ long count = count(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getTel, update.getTel()));
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ return R.fail("手机号已存在");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtils.isEmpty(update.getMail())) {
|
|
|
|
+ if (!byId.getMail().equals(update.getMail())) {
|
|
|
|
+ long count = count(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getTel, update.getMail()));
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ return R.fail("邮箱已存在");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//系统累加
|
|
//系统累加
|
|
if (Emptys.check(update.getSysIds())) {
|
|
if (Emptys.check(update.getSysIds())) {
|
|
update.setSysIds(byId.getSysIds().indexOf(update.getSysIds()) == -1 ? new StringJoiner(",").add(byId.getSysIds()).add(update.getSysIds()).toString() : null);
|
|
update.setSysIds(byId.getSysIds().indexOf(update.getSysIds()) == -1 ? new StringJoiner(",").add(byId.getSysIds()).add(update.getSysIds()).toString() : null);
|