main
黄海 2 years ago
parent 16f4b43099
commit 8301503c5e

@ -89,6 +89,46 @@ public class ExamController extends Controller {
renderJson(kv);
}
/**
* ,
* reply null
*/
@Before({GET.class})
public void getPersonAllInfo() {
String person_id = getCookie("person_id");
List<Record> list = em.getPersonAllInfo(person_id);
renderJson(list);
}
/**
* ()
*
* @param order_id
*/
@Before({GET.class})
public void getQuestionAfterJiaoJuan(int order_id) {
String person_id = getCookie("person_id");
Record record = em.getQuestionAfterJiaoJuan(person_id, order_id);
renderJson(record);
}
/**
* ,()
answer = reply
answer reply
reply is null || reply == ''
*/
@Before({GET.class})
public void getPersonAllInfoAfterJiaoJuan() {
String person_id = getCookie("person_id");
List<Record> list = em.getPersonAllInfoAfterJiaoJuan(person_id);
renderJson(list);
}
/********************************上面为答题人员的接口************************************/
/********************************下面为管理人员的接口************************************/
/**
*
*

@ -137,4 +137,32 @@ public class ExamModel {
Page<Record> pageRecord = Db.paginate(page, limit, sqlPara);
return pageRecord;
}
/**
* ,
*/
public List<Record> getPersonAllInfo(String person_id) {
String sql = "select * from t_exam_record where person_id=?";
return Db.find(sql, person_id);
}
/**
* ()+
*
* @param order_id
*/
public Record getQuestionAfterJiaoJuan(String person_id, int order_id) {
String sql = "select question_id from t_exam_record where person_id=? and order_id=?";
int question_id = Db.findFirst(sql, person_id, order_id).getInt("question_id");
return Db.findById("t_exam_question", "question_id", question_id);
}
/**
* ,()
*/
public List<Record> getPersonAllInfoAfterJiaoJuan(String person_id) {
Kv kv = Kv.by("person_id", person_id);
SqlPara sqlPara = Db.getSqlPara("Exam.getPersonAllInfoAfterJiaoJuan", kv);
return Db.find(sqlPara);
}
}

@ -5,4 +5,10 @@
where t1.reply=t1.answer
group by t1.person_id,t2.person_name order by sum(t1.score) desc,timediff(t2.end_time,t2.start_time) asc
#end
#sql("getPersonAllInfoAfterJiaoJuan")
select t1.*,t2.answer from t_exam_record as t1
inner join t_exam_question as t2 on t1.question_id=t2.question_id
where t1.person_id=#para(person_id) order by t1.order_id
#end
#end
Loading…
Cancel
Save