package com.zcloud.fire.check.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.fire.check.domain.gateway.FireCheckListItemGateway;
import com.zcloud.fire.check.domain.model.FireCheckListItemE;
import com.zcloud.fire.check.dto.FireCheckListItemUpdateCmd;
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-28 10:32:29
 */
@Component
@AllArgsConstructor
public class FireCheckListItemUpdateExe {
    private final FireCheckListItemGateway fireCheckListItemGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(FireCheckListItemUpdateCmd fireCheckListItemUpdateCmd) {
        FireCheckListItemE fireCheckListItemE = new FireCheckListItemE();
        BeanUtils.copyProperties(fireCheckListItemUpdateCmd, fireCheckListItemE);
        boolean res = fireCheckListItemGateway.update(fireCheckListItemE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

