package cn.com.qmth.stmms.admin.exam.parameter;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
import cn.com.qmth.stmms.biz.exam.service.query.ExamSubjectSearchQuery;

@Controller("examSubjectController")
@RequestMapping("/admin/exam-param/subject")
public class ExamSubjectController extends BaseParameterController {

    protected static Logger log = LoggerFactory.getLogger(ExamSubjectController.class);

    @Autowired
    private ExamSubjectService subjectService;

    @RequestMapping("/list")
    @ResponseBody
    public Object listByLevel(HttpServletRequest request, ExamSubjectSearchQuery query) {
        int examId = getSessionExamId(request);
        if (examId > 0) {
            query.setExamId(examId);
            query = subjectService.findByQuery(query);
            return query.getResult();
        }
        return null;
    }

}
