package com.zcloud.basic.info.command;

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


/**
 * web-app
 *
 * @Author zhangyue
 * @Date 2025-11-06 19:15:37
 */
@Component
@AllArgsConstructor
public class UserEmploymentLogRemoveExe {
    private final UserEmploymentLogGateway userEmploymentLogGateway;

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

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

