package com.zcloud.basic.info.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2026-01-05 14:12:19
 */
@Component
@AllArgsConstructor
public class UserExpandInfoRemoveExe {
    private final UserExpandInfoGateway userExpandInfoGateway;

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

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

