package com.zcloud.domain.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.domain.domain.gateway.ProjectTaskInfoGateway;
import com.zcloud.domain.domain.model.ProjectTaskInfoE;
import com.zcloud.domain.dto.ProjectTaskInfoUpdateCmd;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2026-01-27 11:30:30
 */
@Component
@AllArgsConstructor
public class ProjectTaskInfoUpdateExe {
    private final ProjectTaskInfoGateway projectTaskInfoGateway;

    @Transactional(rollbackFor = Exception.class)
    public void execute(ProjectTaskInfoUpdateCmd projectTaskInfoUpdateCmd) {
        ProjectTaskInfoE projectTaskInfoE = new ProjectTaskInfoE();
        BeanUtils.copyProperties(projectTaskInfoUpdateCmd, projectTaskInfoE);
        boolean res = projectTaskInfoGateway.update(projectTaskInfoE);
        if (!res) {
            throw new BizException("修改失败");
        }
    }
}

