| | |
| | | @Override |
| | | public List<ExamInfo> list(String keyword,String classId,String subjectId,Short status, Integer pageSize,Integer pageNum) { |
| | | StringBuffer hql = new StringBuffer(500); |
| | | hql.append("from ExamInfo e where e.examName like ? and e.createId=? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%',ClientUtils.getUserId()); |
| | | |
| | | String teacherId = ClientUtils.isAdmin() ? null : ClientUtils.getUserId(); |
| | | hql.append("from ExamInfo e where e.examName like ? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%'); |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.append(" and e.createId=?"); |
| | | params.add(teacherId); |
| | | } |
| | | if(status!=null){ |
| | | hql.append(" and e.examStatus = ? "); |
| | | params.add(status); |
| | |
| | | @Override |
| | | public int listCount(String keyword,String classId,String subjectId,Short status) { |
| | | StringBuffer hql = new StringBuffer(500); |
| | | hql.append("from ExamInfo e where e.examName like ? and e.createId=? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%',ClientUtils.getUserId()); |
| | | |
| | | String teacherId = ClientUtils.isAdmin() ? null : ClientUtils.getUserId(); |
| | | hql.append("from ExamInfo e where e.examName like ? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%'); |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.append(" and e.createId=?"); |
| | | params.add(teacherId); |
| | | } |
| | | if(status!=null){ |
| | | hql.append(" and e.examStatus = ? "); |
| | | params.add(status); |
| | |
| | | |
| | | // 如果已提交就查询用户答案信息 |
| | | //TODO 暂时不可以查看考试答案,已提交就不可以进入 |
| | | if (Integer.valueOf(record.getStatus())> 0) { |
| | | resultData.put("studentScore", record.getScore()); |
| | | resultData.put("objStudentScore", record.getObjScore()==null?BigDecimal.ZERO:record.getObjScore()); |
| | | return new Result(false,"考试已提交"); |
| | | } |
| | | // if (Integer.valueOf(record.getStatus())> 0) { |
| | | // resultData.put("studentScore", record.getScore()); |
| | | // resultData.put("objStudentScore", record.getObjScore()==null?BigDecimal.ZERO:record.getObjScore()); |
| | | // return new Result(false,"考试已提交"); |
| | | // } |
| | | //获取考试 |
| | | String ql="select i from ExamInfo i , ExamBatchClassRe r where i.deleteFlag is false and r.examBatchId=? and r.examId=i.examId"; |
| | | ExamInfo exam = this.findUnique(ql, CollectionUtils.newList(examBatchId), ExamInfo.class); |