package com.zcloud.fire.check.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.fire.check.domain.gateway.FireCheckRecordGateway;
import com.zcloud.fire.check.domain.model.FireCheckRecordE;
import com.zcloud.fire.check.dto.FireCheckRecordUpdateCmd;
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-12-12 11:10:59
 */
@Component
@AllArgsConstructor
public class FireCheckRecordUpdateExe {
    private final FireCheckRecordGateway fireCheckRecordGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(FireCheckRecordUpdateCmd fireCheckRecordUpdateCmd) {
        FireCheckRecordE fireCheckRecordE = new FireCheckRecordE();
        BeanUtils.copyProperties(fireCheckRecordUpdateCmd, fireCheckRecordE);
        boolean res = fireCheckRecordGateway.update(fireCheckRecordE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

