package com.zcloud.primeport.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.primeport.domain.gateway.ClosedAreaGateway;
import com.zcloud.primeport.domain.model.ClosedAreaE;
import com.zcloud.primeport.dto.ClosedAreaUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;




/**
* web-app
* @Author dearLin
* @Date 2026-03-19 10:27:51
*/
@Component
@AllArgsConstructor
public class ClosedAreaUpdateExe {
    private final ClosedAreaGateway closedAreaGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(ClosedAreaUpdateCmd closedAreaUpdateCmd) {
        ClosedAreaE closedAreaE = new ClosedAreaE();
        BeanUtils.copyProperties(closedAreaUpdateCmd, closedAreaE);
        boolean res = closedAreaGateway.update(closedAreaE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

