Esempio n. 1
0
  public String save() throws Exception {
    //        System.out.println("********************** carid = " + carid);

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    Date d = new Date();
    String day = sdf.format(d);
    entity.setCheckdate(day);
    entity.setChecker(userSessionService.getCurrentSysUser());
    entity.setStatus(true);
    service.save(entity);
    return RELOAD;
  }
  public String griddata() throws Exception {
    if (!Nulls.isNull(limit) && limit > 0) {
      page = new Page<Instrument>(limit, true);
    } else {
      page = new Page<Instrument>(10, true);
    }

    if (!Nulls.isNull(start) && !Nulls.isNull(limit)) {
      int pageNo = start / limit + 1;
      page.setPageNo(pageNo);
    }
    SysUser user = userSessionService.getCurrentSysUser();
    if (user == null) {
      throw new RuntimeException("注意:请先登录系统!");
    }

    //        String s = "Select t from Student t left join t.books b where   \n" +
    //                "exists ( select b.new from b where b.student = t )    \n" +
    //                "and true=all( select b.new from b where b.student = t )";

    String hql = "from Instrument";
    //        if (bulletinstatus)
    //            hql += " where endtime < to_char(sysdate)";
    //        else
    hql += " where status is true ";
    if (!StringHelp.isEmpty(conditions)) {
      QueryTranslate queryTranslate = new QueryTranslate(hql, conditions);
      page = service.findPageByQuery(page, queryTranslate.toString() + " order by updatedate desc");
    } else {
      page = service.findPageByQuery(page, hql + " order by updatedate desc");
    }
    List<Instrument> list = page.getResult();

    rows = Grid.gridValue2Rows(list, columns);
    return GRIDDATA;
  }