package com.zcloud.basic.info.command;

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


/**
 * web-app
 *
 * @Author SondonYong
 * @Date 2025-12-02 14:08:57
 */
@Component
@AllArgsConstructor
public class UserJobHandoverRemoveExe {
    private final UserJobHandoverGateway userJobHandoverGateway;

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

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

