package com.zcloud.basic.info.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.basic.info.domain.gateway.ProblemFeedbackGateway;
import com.zcloud.basic.info.domain.model.ProblemFeedbackE;
import com.zcloud.basic.info.dto.ProblemFeedbackUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author SondonYong
 * @Date 2025-12-06 11:26:35
 */
@Component
@AllArgsConstructor
public class ProblemFeedbackUpdateExe {
    private final ProblemFeedbackGateway problemFeedbackGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(ProblemFeedbackUpdateCmd cmd) {
        ProblemFeedbackE problemFeedbackE = new ProblemFeedbackE();
        BeanUtils.copyProperties(cmd, problemFeedbackE);
        boolean res = problemFeedbackGateway.update(problemFeedbackE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

