package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.MkmjApprovalUserGateway;
import com.zcloud.primeport.domain.model.MkmjApprovalUserE;
import com.zcloud.primeport.dto.MkmjApprovalUserUpdateCmd;
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:17
 */
@Component
@AllArgsConstructor
public class MkmjApprovalUserUpdateExe {
    private final MkmjApprovalUserGateway mkmjApprovalUserGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(MkmjApprovalUserUpdateCmd mkmjApprovalUserUpdateCmd) {
        MkmjApprovalUserE mkmjApprovalUserE = new MkmjApprovalUserE();
        BeanUtils.copyProperties(mkmjApprovalUserUpdateCmd, mkmjApprovalUserE);
        boolean res = mkmjApprovalUserGateway.update(mkmjApprovalUserE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

