package com.zcloud.basic.info.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.basic.info.domain.gateway.CorpQualificationInfoGateway;
import com.zcloud.basic.info.domain.model.CorpQualificationInfoE;
import com.zcloud.basic.info.dto.CorpQualificationInfoUpdateCmd;
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:47
 */
@Component
@AllArgsConstructor
public class CorpQualificationInfoUpdateExe {
    private final CorpQualificationInfoGateway corpQualificationInfoGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(CorpQualificationInfoUpdateCmd corpQualificationInfoUpdateCmd) {
        CorpQualificationInfoE corpQualificationInfoE = new CorpQualificationInfoE();
        BeanUtils.copyProperties(corpQualificationInfoUpdateCmd, corpQualificationInfoE);
        boolean res = corpQualificationInfoGateway.update(corpQualificationInfoE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

