package com.zcloud.basic.info.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.basic.info.domain.gateway.CorpFormGateway;
import com.zcloud.basic.info.domain.model.CorpFormE;
import com.zcloud.basic.info.dto.CorpFormUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-10-29 16:02:28
 */
@Component
@AllArgsConstructor
public class CorpFormUpdateExe {
    private final CorpFormGateway corpFormGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(CorpFormUpdateCmd corpFormUpdateCmd) {
        CorpFormE corpFormE = new CorpFormE();
        BeanUtils.copyProperties(corpFormUpdateCmd, corpFormE);
        boolean res = corpFormGateway.update(corpFormE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

