package com.pcloud.book.riddle.dao.impl;

import com.pcloud.book.riddle.dao.RiddleDao;
import com.pcloud.book.riddle.entity.Riddle;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;


/**
 * @描述：
 * @作者：zhuyajie
 * @创建时间：16:47 2019/7/24
 * @版本：1.0
 */
@Component("riddleDao")
public class RiddleDaoImpl extends BaseDaoImpl<Riddle> implements RiddleDao {


    @Override
    public Riddle getRiddleByGradeAndSeq(Integer grade, Integer seq) {
        Map<String,Object> map = new HashMap<>();
        map.put("grade",grade);
        map.put("seq",seq);
        return getSessionTemplate().selectOne(getStatement("getRiddleByGradeAndSeq"),map);
    }

    @Override
    public Integer getCount() {
        return getSessionTemplate().selectOne(getStatement("getCount"));
    }
}
