package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.VehicleDockLogGateway;
import com.zcloud.primeport.domain.model.VehicleDockLogE;
import com.zcloud.primeport.dto.VehicleDockLogUpdateCmd;
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-14 14:53:30
 */
@Component
@AllArgsConstructor
public class VehicleDockLogUpdateExe {
    private final VehicleDockLogGateway vehicleDockLogGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(VehicleDockLogUpdateCmd vehicleDockLogUpdateCmd) {
        VehicleDockLogE vehicleDockLogE = new VehicleDockLogE();
        BeanUtils.copyProperties(vehicleDockLogUpdateCmd, vehicleDockLogE);
        boolean res = vehicleDockLogGateway.update(vehicleDockLogE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

