package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.MkmjPassageGateway;
import com.zcloud.primeport.domain.model.MkmjPassageE;
import com.zcloud.primeport.dto.MkmjPassageUpdateCmd;
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:20
 */
@Component
@AllArgsConstructor
public class MkmjPassageUpdateExe {
    private final MkmjPassageGateway mkmjPassageGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(MkmjPassageUpdateCmd mkmjPassageUpdateCmd) {
        MkmjPassageE mkmjPassageE = new MkmjPassageE();
        BeanUtils.copyProperties(mkmjPassageUpdateCmd, mkmjPassageE);
        boolean res = mkmjPassageGateway.update(mkmjPassageE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

