package com.zcloud.zcGbsServicer.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.zcGbsServicer.domain.gateway.ControlRoomGateway;
import com.zcloud.zcGbsServicer.domain.model.ControlRoomE;
import com.zcloud.zcGbsServicer.dto.ControlRoomUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;




/**
* web-app
* @Author makejava
* @Date 2026-01-21 17:21:51
*/
@Component
@AllArgsConstructor
public class ControlRoomUpdateExe {
    private final ControlRoomGateway controlRoomGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(ControlRoomUpdateCmd controlRoomUpdateCmd) {
        ControlRoomE controlRoomE = new ControlRoomE();
        BeanUtils.copyProperties(controlRoomUpdateCmd, controlRoomE);
        boolean res = controlRoomGateway.update(controlRoomE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

