diff --git a/src/main/java/com/dsideal/FengHuang/Exam/Model/ExamModel.java b/src/main/java/com/dsideal/FengHuang/Exam/Model/ExamModel.java index 4261b2d..da83898 100644 --- a/src/main/java/com/dsideal/FengHuang/Exam/Model/ExamModel.java +++ b/src/main/java/com/dsideal/FengHuang/Exam/Model/ExamModel.java @@ -124,8 +124,10 @@ public class ExamModel { * @param order_id */ public Record getQuestion(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"); + String sql = "select question_id,answer from t_exam_record where person_id=? and order_id=?"; + Record r = Db.findFirst(sql, person_id, order_id); + int question_id = r.getInt("question_id"); + String answer = r.getStr("answer"); sql = "select t1.question_id,t1.type_id,t1.content,t1.A,t1.B,t1.C,t1.D,t1.E,t1.F,t1.G,t1.score,t2.type_name from t_exam_question as t1 inner join t_exam_question_type as t2 on t1.type_id=t2.type_id where t1.question_id=?"; Record record = Db.findFirst(sql, question_id); @@ -136,6 +138,9 @@ public class ExamModel { JSONObject jo = new JSONObject(); jo.put("key", String.valueOf(x)); jo.put("value", record.getStr(String.valueOf(x))); + if (answer.indexOf(x) >= 0) + jo.put("checked", true); + else jo.put("checked", false); array.add(jo); } } @@ -148,7 +153,7 @@ public class ExamModel { record.remove("G"); record.set("xuanxiang", array); - record.set("order_id",order_id); + record.set("order_id", order_id); return record; }