package com.zcloud.primeport.command;

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


/**
 * web-app
 *
 * @Author makejava
 * @Date 2026-03-05 11:33:27
 */
@Component
@AllArgsConstructor
public class VehicleBlackUpdateExe {
    private final VehicleBlackGateway vehicleBlackGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(VehicleBlackUpdateCmd vehicleBlackUpdateCmd) {
        VehicleBlackE vehicleBlackE = new VehicleBlackE();
        BeanUtils.copyProperties(vehicleBlackUpdateCmd, vehicleBlackE);
        boolean res = vehicleBlackGateway.update(vehicleBlackE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

