package com.zcloud.fire.check.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.fire.check.domain.gateway.FireCheckListUserGateway;
import com.zcloud.fire.check.domain.model.FireCheckListUserE;
import com.zcloud.fire.check.dto.FireCheckListUserUpdateCmd;
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-11 15:32:50
 */
@Component
@AllArgsConstructor
public class FireCheckListUserUpdateExe {
    private final FireCheckListUserGateway fireCheckListUserGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(FireCheckListUserUpdateCmd fireCheckListUserUpdateCmd) {
        FireCheckListUserE fireCheckListUserE = new FireCheckListUserE();
        BeanUtils.copyProperties(fireCheckListUserUpdateCmd, fireCheckListUserE);
        boolean res = fireCheckListUserGateway.update(fireCheckListUserE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

