package com.zcloud.domain.command;

import com.alibaba.cola.exception.BizException;
import com.zcloud.domain.domain.gateway.ProjectTaskGroupUserGateway;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2026-01-29 11:28:09
 */
@Component
@AllArgsConstructor
public class ProjectTaskGroupUserRemoveExe {
    private final ProjectTaskGroupUserGateway projectTaskGroupUserGateway;

    @Transactional(rollbackFor = Exception.class)
    public boolean execute(Long id) {
        boolean res = projectTaskGroupUserGateway.deletedProjectTaskGroupUserById(id);
        if (!res) {
            throw new BizException("删除失败");
        }
        return true;
    }

    @Transactional(rollbackFor = Exception.class)
    public boolean execute(Long[] ids) {
        boolean res = projectTaskGroupUserGateway.deletedProjectTaskGroupUserByIds(ids);
        if (!res) {
            throw new BizException("删除失败");
        }
        return true;
    }
}

