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}