日期:2014-05-17 浏览次数:20786 次
//查询商品库存 public static void dg1DataBind(DataGridAction dla){ try{ String commodityCode = dla.getParam("commodityCode"); //String sex = dla.getParam("sex"); String commodityName = dla.getParam("commodityName"); String sql = "select s_commodityStockpile.c_id,s_commodityStockpile.commodityCode,s_commodityStockpile.commodityName,s_commodityStockpile.oldAmount,s_commodityStockpile.alterationAmount,s_commodityStockpile.remark, s_commodity.color,s_commodity. model " + "from s_commodityStockpile " + "left join s_commodity on s_commodity.c_id=s_commodityStockpile.c_id "+ "where s_commodityStockpile.c_id = s_commodity.c_id"; if(StringUtil.isNotEmpty(commodityCode)){ sql += " and commodityCode='"+commodityCode+"'"; } if(StringUtil.isNotEmpty(commodityName)){ sql += " and s_commodityStockpile.commodityName='"+commodityName+"'"; } dla.setTotal(new QueryBuilder(sql)); DataTable dt = new QueryBuilder(sql).executePagedDataTable(dla.getPageSize(),dla.getPageIndex()); dla.bindData(dt); } catch(Exception e){ dla.bindData(new DataTable()); e.printStackTrace(); } } }