|
@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.service.examwork.service;
|
|
|
|
|
|
import cn.com.qmth.examcloud.service.examwork.criteria.ExamCourseCriteria;
|
|
import cn.com.qmth.examcloud.service.examwork.criteria.ExamCourseCriteria;
|
|
import cn.com.qmth.examcloud.service.examwork.dto.ExamCourseDTO;
|
|
import cn.com.qmth.examcloud.service.examwork.dto.ExamCourseDTO;
|
|
|
|
+import cn.com.qmth.examcloud.service.examwork.entity.Exam;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
@@ -50,9 +51,7 @@ public class ExamCourseService {
|
|
|
|
|
|
private long countAll(ExamCourseCriteria examCourseCriteria){
|
|
private long countAll(ExamCourseCriteria examCourseCriteria){
|
|
StringBuffer sql = new StringBuffer();
|
|
StringBuffer sql = new StringBuffer();
|
|
- sql.append(buildCountSql());
|
|
|
|
- sql.append(buildCriteriaSql(examCourseCriteria));
|
|
|
|
- sql.append(buildGroupSql());
|
|
|
|
|
|
+ sql.append(buildCountSql(examCourseCriteria));
|
|
return this.jdbcTemplate.queryForObject(sql.toString(),Long.class);
|
|
return this.jdbcTemplate.queryForObject(sql.toString(),Long.class);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -100,9 +99,13 @@ public class ExamCourseService {
|
|
return baseSql.toString();
|
|
return baseSql.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- private String buildCountSql(){
|
|
|
|
|
|
+ private String buildCountSql(ExamCourseCriteria examCourseCriteria){
|
|
StringBuilder countSql = new StringBuilder();
|
|
StringBuilder countSql = new StringBuilder();
|
|
- countSql.append("select count(*) from ecs_exam_student ts,ecs_exam te where ts.exam_id = te.id");
|
|
|
|
|
|
+ countSql.append("select count(*) from (");
|
|
|
|
+ countSql.append(buildBaseSql());
|
|
|
|
+ countSql.append(buildCriteriaSql(examCourseCriteria));
|
|
|
|
+ countSql.append(buildGroupSql());
|
|
|
|
+ countSql.append(")");
|
|
return countSql.toString();
|
|
return countSql.toString();
|
|
}
|
|
}
|
|
|
|
|