public String index() {
    StringBuffer hql = new StringBuffer(" from AddressBookType a where 1 = 1");
    List<Object> args = new ArrayList<Object>();

    if (StringUtils.isNotBlank(getModel().getName())) {
      hql.append(" and a.name like ? ");
      args.add(MatchMode.ANYWHERE.toMatchString(getModel().getName()));
    }

    page = PageUtil.getPage(getPageNo(), getPageSize());
    page = getManager().pageQuery(page, hql.toString(), args.toArray());
    restorePageData(page);

    return INDEX;
  }
 /** 重写父类的index方法,实现分页检索风险评估信息 */
 @Override
 public String index() {
   StringBuffer hql = new StringBuffer();
   hql.append("from ExpertCategory ec where 1=1 ");
   List<Object> args = new ArrayList<Object>();
   if (StringUtils.isNotBlank(getModel().getName())) {
     hql.append(" and ec.name like ?");
     args.add(MatchMode.ANYWHERE.toMatchString(getModel().getName()));
   }
   Page page = PageUtil.getPage(getPageNo(), getPageSize());
   getManager().pageQuery(page, hql.toString(), args.toArray());
   items = page.getData();
   restorePageData(page);
   return INDEX;
 }
Exemple #3
0
  /* 入库单查询 */
  public String indexDraw() {
    page = PageUtil.getPage(getPageNo(), getPageSize());
    StringBuffer sql = new StringBuffer("from InStock i where 1=1");
    List<Object> args = new ArrayList<Object>();

    if (StringUtils.isNotBlank(getModel().getStockNo())) { // 按单号查询
      sql.append(" and i.stockNo = ?");
      args.add(getModel().getStockNo());
    }

    if (getModel().getGoods() != null
        && StringUtils.isNotBlank(getModel().getGoods().getName())) { // 按物品名称查询
      sql.append(" and i.goods.name like ?");
      args.add(MatchMode.ANYWHERE.toMatchString(getModel().getGoods().getName()));
    }

    if (StringUtils.isNotBlank(cDate)) { // 按入库日期查询
      sql.append(" and i.inDate = ?");
      try {
        args.add(DateUtil.firstSecondOfDate(DateUtil.convertStringToDate("yyyy-MM-dd", cDate)));
      } catch (ParseException e) {
      }
    }

    sql.append(" order by i.inDate desc");
    page = getManager().pageQuery(page, sql.toString(), args.toArray());
    restorePageData(page);

    List<InStock> list = page.getData();
    if (list != null && list.size() > 0) {
      // 统计总入库数量
      int totalInCounts = 0;
      // 统计总价钱
      double totalAmount = 0;
      for (InStock i : list) {
        // 入库数
        Integer inCounts = i.getInCounts() == null ? 0 : i.getInCounts();
        // 此单库存价钱
        Double amount = i.getAmount() == null ? 0d : i.getAmount();
        totalInCounts += inCounts;
        totalAmount += amount;
      }
      getRequest().setAttribute("totalAmount", totalAmount);
      getRequest().setAttribute("totalInCounts", totalInCounts);
    }

    return "indexDraw";
  }
Exemple #4
0
  /** 出版社查询列表 */
  @Override
  public String index() {
    Page page = PageUtil.getPage(getPageNo(), getPageSize());
    StringBuffer hql = new StringBuffer("from Press p where 1=1 ");
    List args = new ArrayList();

    // 按出版社名称查询
    if (StringUtils.isNotBlank(getModel().getName())) {
      hql.append(" and p.name like ?");
      args.add(MatchMode.ANYWHERE.toMatchString(getModel().getName()));
    }

    hql.append(" order by p.charName");
    page = getManager().pageQuery(page, hql.toString(), args.toArray());
    restorePageData(page);
    return INDEX;
  }
 /** 准备数据 */
 protected void setUp() throws Exception {
   county =
       deptManager.findObject(
           "from Dept d where d.name like ? ", MatchMode.ANYWHERE.toMatchString("裕华区"));
 }