package com.ssj.dao.sys.problem.dao.impl;

import com.ssj.dao.sys.problem.dao.IProblemStudentDao;
import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class ProblemStudentDao implements IProblemStudentDao {
    @Autowired
    private PagingHibernateJdbcDao dao;

    public List<Map<String, Object>> findSubjectCountByDerver(String derver){
        String sql = "select subject, count(derver) as count from scon_problem_picture where derver = ? group by subject";
        return dao.findMap(sql, new String[] {derver});
    }

    public List<Map<String, Object>> findFeedbackDetail (String derver, String subject){
        String sql = "select know_how_details_id from scon_know_feedback_detail where derver = ? " +
                "and subject = ? order by create_time desc limit 0,3";
        return dao.findMap(sql, new String[]{derver, subject});
    }
}
