package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.EVehicleBasicInfoGateway;
import com.zcloud.primeport.domain.model.EVehicleBasicInfoE;
import com.zcloud.primeport.dto.EVehicleBasicInfoUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author dearLin
 * @Date 2026-04-23 10:04:33
 */
@Component
@AllArgsConstructor
public class EVehicleBasicInfoUpdateExe {
    private final EVehicleBasicInfoGateway eVehicleBasicInfoGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(EVehicleBasicInfoUpdateCmd eVehicleBasicInfoUpdateCmd) {
        EVehicleBasicInfoE eVehicleBasicInfoE = new EVehicleBasicInfoE();
        BeanUtils.copyProperties(eVehicleBasicInfoUpdateCmd, eVehicleBasicInfoE);
        boolean res = eVehicleBasicInfoGateway.update(eVehicleBasicInfoE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

