mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 22:57:17 +08:00 
			
		
		
		
	refactor: 优化更新手机号、邮箱语句
This commit is contained in:
		| @@ -108,24 +108,4 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | ||||
|      * @return 用户数量 | ||||
|      */ | ||||
|     Long selectCountByPhone(@FieldEncrypt @Param("phone") String phone, @Param("id") Long id); | ||||
|  | ||||
|     /** | ||||
|      * 修改手机号 | ||||
|      * | ||||
|      * @param phone 手机号 | ||||
|      * @param id    ID | ||||
|      * @return 影响行数 | ||||
|      */ | ||||
|     @Select("UPDATE sys_user SET phone = #{phone} WHERE id = #{id}") | ||||
|     Integer updatePhone(@FieldEncrypt @Param("phone") String phone, @Param("id") Long id); | ||||
|  | ||||
|     /** | ||||
|      * 修改邮箱 | ||||
|      * | ||||
|      * @param email 邮箱 | ||||
|      * @param id    ID | ||||
|      * @return 影响行数 | ||||
|      */ | ||||
|     @Select("UPDATE sys_user SET email = #{email} WHERE id = #{id}") | ||||
|     Integer updateEmail(@FieldEncrypt @Param("email") String email, @Param("id") Long id); | ||||
| } | ||||
|   | ||||
| @@ -415,7 +415,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|         CheckUtils.throwIf(this.isPhoneExists(newPhone, id), "手机号已绑定其他账号,请更换其他手机号"); | ||||
|         CheckUtils.throwIfEqual(newPhone, user.getPhone(), "新手机号不能与当前手机号相同"); | ||||
|         // 更新手机号 | ||||
|         baseMapper.updatePhone(newPhone, id); | ||||
|         baseMapper.lambdaUpdate().set(UserDO::getPhone, newPhone).eq(UserDO::getId, id).update(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -425,7 +425,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|         CheckUtils.throwIf(this.isEmailExists(newEmail, id), "邮箱已绑定其他账号,请更换其他邮箱"); | ||||
|         CheckUtils.throwIfEqual(newEmail, user.getEmail(), "新邮箱不能与当前邮箱相同"); | ||||
|         // 更新邮箱 | ||||
|         baseMapper.updateEmail(newEmail, id); | ||||
|         baseMapper.lambdaUpdate().set(UserDO::getEmail, newEmail).eq(UserDO::getId, id).update(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
		Reference in New Issue
	
	Block a user