package com.bizzan.bitrade.dao;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.bizzan.bitrade.dao.base.BaseDao;
import com.bizzan.bitrade.entity.WalletTransRecord;
import com.bizzan.bitrade.vo.IWalletTransStat;
import com.bizzan.bitrade.vo.WalletTransStat;

public interface WalletTransRecordDao extends BaseDao<WalletTransRecord> {

	@Query(value = "select member_id, sum(if (source=0 and target=4, amount, null)) inAmount, sum(if (source=4 and target=0, amount, null)) outAmount, (select username from member where id=wallet_trans_record.member_id) username from wallet_trans_record where member_id in (:ids) group by member_id",nativeQuery =true)
	public List<IWalletTransStat> statWalletTrans(@Param("ids") List<Long> ids);
}
