package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.VideoGateway;
import com.zcloud.primeport.domain.model.VideoE;
import com.zcloud.primeport.dto.VideoUpdateCmd;
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:31
 */
@Component
@AllArgsConstructor
public class VideoUpdateExe {
    private final VideoGateway videoGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(VideoUpdateCmd videoUpdateCmd) {
        VideoE videoE = new VideoE();
        BeanUtils.copyProperties(videoUpdateCmd, videoE);
        boolean res = videoGateway.update(videoE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

