package com.red.circle.wallet.infra.database.rds.service.impl;

import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl;
import com.red.circle.wallet.infra.database.rds.dao.WalletGoldCountDAO;
import com.red.circle.wallet.infra.database.rds.entity.WalletGoldCount;
import com.red.circle.wallet.infra.database.rds.service.WalletGoldCountService;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 * 金币统计 服务实现.
 *
 * @author pengliang on 2023/8/24
 */
@Service
public class WalletGoldCountServiceImpl extends
    BaseServiceImpl<WalletGoldCountDAO, WalletGoldCount> implements WalletGoldCountService {

  @Override
  public List<WalletGoldCount> list(String sysOrigin, Integer groupNum) {
    return query()
        .eq(WalletGoldCount::getSysOrigin, sysOrigin)
        .eq(WalletGoldCount::getGroupNum, groupNum)
        .list();
  }

  @Override
  public List<WalletGoldCount> listRange(String sysOrigin, Integer startGroupNum,
      Integer endGroupNum) {
    return query()
        .eq(WalletGoldCount::getSysOrigin, sysOrigin)
        .ge(WalletGoldCount::getGroupNum, startGroupNum)
        .le(WalletGoldCount::getGroupNum, endGroupNum)
        .orderByDesc(WalletGoldCount::getAmount)
        .list();
  }

}
