package com.yolo.keyboard.dal.mysql.tenantbalancetransaction;

import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
import com.yolo.keyboard.framework.common.pojo.PageParam;
import com.yolo.keyboard.framework.common.pojo.PageResult;
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 租户积分记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TenantBalanceTransactionMapper extends BaseMapperX<TenantBalanceTransactionDO> {

    default PageResult<TenantBalanceTransactionDO> selectPage(PageParam reqVO, Long tenantId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TenantBalanceTransactionDO>()
                .eq(TenantBalanceTransactionDO::getTenantId, tenantId)
                .orderByDesc(TenantBalanceTransactionDO::getId));
    }

    default int deleteByTenantId(Long tenantId) {
        return delete(TenantBalanceTransactionDO::getTenantId, tenantId);
    }

    default int deleteByTenantIds(List<Long> tenantIds) {
        return deleteBatch(TenantBalanceTransactionDO::getTenantId, tenantIds);
    }
}
