package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.MkmjGateway;
import com.zcloud.primeport.domain.model.MkmjE;
import com.zcloud.primeport.dto.MkmjUpdateCmd;
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:16
 */
@Component
@AllArgsConstructor
public class MkmjUpdateExe {
    private final MkmjGateway mkmjGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(MkmjUpdateCmd mkmjUpdateCmd) {
        MkmjE mkmjE = new MkmjE();
        BeanUtils.copyProperties(mkmjUpdateCmd, mkmjE);
        boolean res = mkmjGateway.update(mkmjE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

