package com.ifish.daoImpl;

import java.math.BigDecimal;

import org.springframework.stereotype.Repository;

import com.ifish.dao.GoldGetRecordDao;
import com.ifish.entity.GoldGetRecord;
import com.ifish.enums.GoldGetTypeEnum;
import com.ifish.hibernate.HibernateBaseDao;

/**
 * 金币获取记录
 * @author Administrator
 *
 */
@Repository
public class GoldGetRecordDaoImpl extends HibernateBaseDao<GoldGetRecord, Integer> implements GoldGetRecordDao {

	@Override
	protected Class<GoldGetRecord> getEntityClass() {
		return GoldGetRecord.class;
	}

	@Override
	public BigDecimal getQuestionPayTourGoldValue(Integer userId) {
		String sql = "select sum(get_value) from tbl_gold_get_record where get_type=? and user_id=?";
		return (BigDecimal) getSession().createSQLQuery(sql).setString(0, GoldGetTypeEnum.liveRoomPayTour.getKey()).setInteger(1, userId).uniqueResult();
	}

}
