package com.seer.teach.mall.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seer.teach.mall.sys.service.IAdminSenderConfigService;
import com.seer.teach.mall.entity.SenderConfigEntity;
import com.seer.teach.mall.mapper.SenderConfigMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 发件信息配置 服务实现类
 * </p>
 *
 * @author Wang
 * @since 2025-06-17
 */
@Slf4j
@Service
public class AdminSenderConfigServiceImpl  extends ServiceImpl<SenderConfigMapper, SenderConfigEntity> implements IAdminSenderConfigService {

    @Override
    public boolean updateSenderConfig(SenderConfigEntity senderConfig) {

        return update(new LambdaUpdateWrapper<>(SenderConfigEntity.class)
                .set(SenderConfigEntity::getName, senderConfig.getName())
                .set(SenderConfigEntity::getMobile, senderConfig.getMobile())
                .set(SenderConfigEntity::getPhone, senderConfig.getPhone())
                .set(SenderConfigEntity::getCountryCode, senderConfig.getCountryCode())
                .set(SenderConfigEntity::getProv, senderConfig.getProv())
                .set(SenderConfigEntity::getCity, senderConfig.getCity())
                .set(SenderConfigEntity::getArea, senderConfig.getArea())
                .set(SenderConfigEntity::getAddress, senderConfig.getAddress())
                .eq(SenderConfigEntity::getId, senderConfig.getId())
        );
    }
}