コード例 #1
0
ファイル: BenefitAnalysisAction.java プロジェクト: zhuyl/expr
  private BenefitResult getBenefitAnalysisResult() {

    Long experimentid = getLong("experiment.id");
    EntityQuery query = new EntityQuery(BenefitResult.class, "result");
    query.add(new Condition("result.experiment.id=:experimentId", experimentid));
    // query.add(new Condition("result.student.code=:stdCode", getLoginName()));
    Student std = getLoginStudent();
    addStdCondition(query, "result", std);
    List results = entityService.search(query);

    BenefitResult result = null;
    if (results.isEmpty()) {
      result = new BenefitResult();
      result.setExperiment((Experiment) entityService.load(Experiment.class, experimentid));
      //			List studentList = (List)entityService.load(Student.class,"code",getLoginName());
      //			if (null != studentList && studentList.size()!=0){
      //				result.setStudent((Student)studentList.get(0));
      //			}
      if (std == null) {
        std = (Student) entityService.load(Student.class, getLong("std.id"));
      }
      result.setStudent(std);
    } else {
      result = (BenefitResult) results.get(0);
    }
    return result;
  }
コード例 #2
0
ファイル: BenefitAnalysisAction.java プロジェクト: zhuyl/expr
 protected String saveAndForward(Entity entity) {
   BenefitItemResult itemResult = (BenefitItemResult) entity;
   if (itemResult.isVO()) {
     Long experimentid = getLong("experiment.id");
     EntityQuery query = new EntityQuery(BenefitResult.class, "result");
     query.add(new Condition("result.experiment.id=:experimentId", experimentid));
     query.add(new Condition("result.student.code=:stdCode", getLoginName()));
     List results = entityService.search(query);
     BenefitResult result = null;
     if (results.isEmpty()) {
       result = new BenefitResult();
       result.setExperiment((Experiment) entityService.load(Experiment.class, experimentid));
       List studentList = (List) entityService.load(Student.class, "code", getLoginName());
       if (null != studentList && studentList.size() != 0) {
         result.setStudent((Student) studentList.get(0));
       }
       // result.setForm(new Aim());
     } else {
       result = (BenefitResult) results.get(0);
     }
     itemResult.setResult(result);
     // result.getForm().getItmes().add(itemResult);
     result.getItems().add(itemResult);
     entityService.saveOrUpdate(result);
   } else {
     entityService.saveOrUpdate(itemResult);
   }
   return redirect("search", "info.save.success");
 }
コード例 #3
0
ファイル: BenefitAnalysisAction.java プロジェクト: zhuyl/expr
 public String saveRemark() {
   Long experimentId = getLong("experiment.id");
   String remark = get("remark");
   BenefitResult result = getBenefitAnalysisResult();
   result.setRemark(remark);
   entityService.saveOrUpdate(result);
   return redirect("search", "info.save.success", "&experiment.id=" + experimentId);
 }