public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { initQueryItem(data.getRequest()); fixedQuery.setSearchValue(data.getRequest()); String SQL = fixedQuery.getWhereQuery(); // 得到WHERE子句 if (SQL.length() > 0) SQL = " AND " + SQL; SQL = SQL + " AND (storeid='" + storeid + "' or storeid is null) "; if (!personid.equals("")) SQL = SQL + " AND personid='" + personid + "'"; if (!khlx.equals("")) SQL = SQL + " AND khlx='" + khlx + "'"; if (!dwtxid.equals("")) SQL = SQL + " AND dwtxid='" + dwtxid + "'"; if (!jsfsid.equals("")) SQL = SQL + " AND jsfsid='" + jsfsid + "'"; EngineDataSet tmp = new EngineDataSet(); SQL = combineSQL( HTHW_SQL, "?", new String[] {user.getHandleDeptWhereValue("deptid", "czyid"), fgsid, SQL}); setDataSetProperty(tmp, SQL); tmp.open(); StringBuffer buf = null; ArrayList contain = new ArrayList(); tmp.first(); for (int i = 0; i < tmp.getRowCount(); i++) { String htid = tmp.getValue("htid"); if (!contain.contains(htid)) { contain.add(htid); if (buf == null) buf = new StringBuffer("AND htid IN(").append(htid); else buf.append(",").append(htid); } tmp.next(); } if (buf == null) buf = new StringBuffer(); else buf.append(")"); SQL = buf.toString(); if (SQL.equals("")) SQL = " and 1<>1 "; SQL = combineSQL(MASTER_SQL, "?", new String[] {SQL}); if (!dsMasterTable.getQueryString().equals(SQL)) { dsMasterTable.setQueryString(SQL); dsMasterTable.setRowMax(null); // 以便dbNavigator刷新数据集 } openDetailTable(true); }
public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { retuUrl = data.getParameter("src"); retuUrl = retuUrl != null ? retuUrl.trim() : retuUrl; HttpServletRequest request = data.getRequest(); storeid = request.getParameter("storeid"); // 必选 sendmodeid = request.getParameter("sendmodeid"); // djlx = request.getParameter("djlx"); // khlx = request.getParameter("khlx"); // 非必选 dwtxid = request.getParameter("dwtxid"); // 非必选 personid = request.getParameter("personid"); // 非必选 jsfsid = request.getParameter("jsfsid"); // 非必选 yfdj = request.getParameter("yfdj"); // if (storeid.equals("")) return; String SQL = " AND (storeid='" + storeid + "' or storeid is null) "; if (!khlx.equals("")) SQL = SQL + " AND khlx='" + khlx + "' "; if (!dwtxid.equals("")) SQL = SQL + " AND dwtxid='" + dwtxid + "' "; if (!personid.equals("")) SQL = SQL + " AND personid='" + personid + "' "; if (!jsfsid.equals("")) SQL = SQL + " AND jsfsid='" + jsfsid + "' "; if (!sendmodeid.equals("")) SQL = SQL + " AND sendmodeid='" + sendmodeid + "' "; if (!yfdj.equals("")) SQL = SQL + " AND yfdj='" + yfdj + "' "; srcFrm = request.getParameter("srcFrm"); multiIdInput = request.getParameter("srcVar"); // if(storeid.equals("")||djlx.equals("")||dwtxid.equals("")||personid.equals("")||khlx.equals("")) // return; masterProducer.init(request, loginId); detailProducer.init(request, loginId); // 初始化查询项目和内容 RowMap row = fixedQuery.getSearchRow(); row.clear(); String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); String startDay = new SimpleDateFormat("yyyy-MM-01").format(new Date()); row.put("htrq$a", startDay); row.put("htrq$b", today); row.put("zt", "0"); isMasterAdd = true; EngineDataSet tmp = new EngineDataSet(); SQL = combineSQL( HTHW_SQL, "?", new String[] {user.getHandleDeptWhereValue("deptid", "czyid"), fgsid, SQL}); setDataSetProperty(tmp, SQL); tmp.open(); StringBuffer buf = null; ArrayList contain = new ArrayList(); tmp.first(); for (int i = 0; i < tmp.getRowCount(); i++) { String htid = tmp.getValue("htid"); if (!contain.contains(htid)) { contain.add(htid); if (buf == null) buf = new StringBuffer("AND htid IN(").append(htid); else buf.append(",").append(htid); } tmp.next(); } if (buf == null) buf = new StringBuffer(); else buf.append(")"); SQL = buf.toString(); if (SQL.equals("")) SQL = " and 1<>1 "; // String SQL = " AND jsfsid='"+jsfsid+"' AND personid='"+personid+"' AND khlx ='"+khlx+"' // AND dwtxid ='"+dwtxid+"' AND (storeid='"+storeid+"' or storeid is null) "; SQL = combineSQL(MASTER_SQL, "?", new String[] {SQL}); dsMasterTable.setQueryString(SQL); dsMasterTable.setRowMax(null); if (dsDetailTable.isOpen() && dsDetailTable.getRowCount() > 0) dsDetailTable.empty(); }