package com.zcloud.fire.check.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.fire.check.domain.gateway.FireCheckRecordPointGateway;
import com.zcloud.fire.check.domain.model.FireCheckRecordPointE;
import com.zcloud.fire.check.dto.FireCheckRecordPointUpdateCmd;
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:20
 */
@Component
@AllArgsConstructor
public class FireCheckRecordPointUpdateExe {
    private final FireCheckRecordPointGateway fireCheckRecordPointGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(FireCheckRecordPointUpdateCmd fireCheckRecordPointUpdateCmd) {
        FireCheckRecordPointE fireCheckRecordPointE = new FireCheckRecordPointE();
        BeanUtils.copyProperties(fireCheckRecordPointUpdateCmd, fireCheckRecordPointE);
        boolean res = fireCheckRecordPointGateway.update(fireCheckRecordPointE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

