package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.MkmjGateGateway;
import com.zcloud.primeport.domain.model.MkmjGateE;
import com.zcloud.primeport.dto.MkmjGateUpdateCmd;
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:18
 */
@Component
@AllArgsConstructor
public class MkmjGateUpdateExe {
    private final MkmjGateGateway mkmjGateGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(MkmjGateUpdateCmd mkmjGateUpdateCmd) {
        MkmjGateE mkmjGateE = new MkmjGateE();
        BeanUtils.copyProperties(mkmjGateUpdateCmd, mkmjGateE);
        boolean res = mkmjGateGateway.update(mkmjGateE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

