package com.zcloud.fire.check.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.fire.check.domain.gateway.FireCheckStandardGateway;
import com.zcloud.fire.check.domain.model.FireCheckStandardE;
import com.zcloud.fire.check.dto.FireCheckStandardUpdateCmd;
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-11-26 10:12:15
 */
@Component
@AllArgsConstructor
public class FireCheckStandardUpdateExe {
    private final FireCheckStandardGateway fireCheckStandardGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(FireCheckStandardUpdateCmd fireCheckStandardUpdateCmd) {
        FireCheckStandardE fireCheckStandardE = new FireCheckStandardE();
        BeanUtils.copyProperties(fireCheckStandardUpdateCmd, fireCheckStandardE);
        boolean res = fireCheckStandardGateway.update(fireCheckStandardE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

