From 0363bcabef62041a10acee1963476db1b4e89701 Mon Sep 17 00:00:00 2001 From: heminjian502 Date: Wed, 17 Aug 2022 21:32:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=BE=AE=E4=BF=A1=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/system/mapper/TWechatUserMapper.java | 2 ++ .../com/ruoyi/system/service/impl/WechatServiceImpl.java | 4 ++++ .../src/main/resources/mapper/system/TWechatUserMapper.xml | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TWechatUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TWechatUserMapper.java index 7778d30..ad1c989 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TWechatUserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TWechatUserMapper.java @@ -14,6 +14,8 @@ public interface TWechatUserMapper extends Mapper { TWechatUser selectWechatUserByUnionid(String unionid); + TWechatUser selectWechatUserByUserId(Long userId); + int updateByPrimaryKeySelective(TWechatUser record); int updateByPrimaryKey(TWechatUser record); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java index e9282dd..aa9836a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java @@ -152,6 +152,10 @@ public class WechatServiceImpl implements IWechatService { BeanUtils.copyProperties(req, currentDoctor); currentDoctor.setDelFlag("0"); tDoctorMapper.updateTDoctor(currentDoctor); + TWechatUser queryUser = tWechatUserMapper.selectWechatUserByUserId(currentDoctor.getId()); + if (Objects.nonNull(queryUser)) { + throw new ServiceException("该手机号已绑定其他微信账号!"); + } wechatUser.setUserId(currentDoctor.getId()); tDoctor.setId(currentDoctor.getId()); } else { diff --git a/ruoyi-system/src/main/resources/mapper/system/TWechatUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TWechatUserMapper.xml index 82fea85..e47b4a3 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TWechatUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TWechatUserMapper.xml @@ -185,6 +185,13 @@ where unionid = #{unionid,jdbcType=VARCHAR} + + update t_wechat_user set user_id = #{userId,jdbcType=BIGINT}