package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.EVehicleArrivalDepartureInfoGateway;
import com.zcloud.primeport.domain.model.EVehicleArrivalDepartureInfoE;
import com.zcloud.primeport.dto.EVehicleArrivalDepartureInfoUpdateCmd;
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-05-27 17:45:45
 */
@Component
@AllArgsConstructor
public class EVehicleArrivalDepartureInfoUpdateExe {
    private final EVehicleArrivalDepartureInfoGateway eVehicleArrivalDepartureInfoGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(EVehicleArrivalDepartureInfoUpdateCmd eVehicleArrivalDepartureInfoUpdateCmd) {
        EVehicleArrivalDepartureInfoE eVehicleArrivalDepartureInfoE = new EVehicleArrivalDepartureInfoE();
        BeanUtils.copyProperties(eVehicleArrivalDepartureInfoUpdateCmd, eVehicleArrivalDepartureInfoE);
        boolean res = eVehicleArrivalDepartureInfoGateway.update(eVehicleArrivalDepartureInfoE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

