|
@@ -1338,16 +1338,89 @@ public class Titem extends Controller {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public String query_itemvalueclass() {
|
|
public String query_itemvalueclass() {
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "商品档案选项查询");
|
|
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
|
|
|
|
+ DBConnect connect = new DBConnect();
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 过滤条件设置
|
|
|
|
|
+ */
|
|
|
|
|
+ String where = " 1=1 ";
|
|
|
|
|
+ if (content.containsKey("where")) {
|
|
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
|
|
+ if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
|
|
+ where = where + " and(t1.fitemname like'%" + whereObject.getString("condition") + "%' or t1.fitemno='" + whereObject.getString("condition") + "' or t1.fspec like '%" + whereObject.getString("condition") + "%' or t1.fmodel like'%" + whereObject.getString("condition") + "%')";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fitemno") && !"".equals(whereObject.getString("fitemno"))) {
|
|
|
|
|
+ where = where + " and t1.fitemno ='" + whereObject.getString("fitemno") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fspec") && !"".equals(whereObject.getString("fspec"))) {
|
|
|
|
|
+ where = where + " and t1.fspec ='" + whereObject.getString("fspec") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fsaleclsnum") && !"".equals(whereObject.getString("fsaleclsnum"))) {
|
|
|
|
|
+ SQLFactory flongsaleslsFactory = new SQLFactory(this, "营销类别全路径查询");
|
|
|
|
|
+ flongsaleslsFactory.addParameter("fsaleclsnum", whereObject.getString("fsaleclsnum"));
|
|
|
|
|
+ flongsaleslsFactory.addParameter("siteid", siteid);
|
|
|
|
|
+ Rows flongsaleslsRows = connect.runSqlQuery(flongsaleslsFactory.getSQL());
|
|
|
|
|
+ if (flongsaleslsRows.isEmpty()) {
|
|
|
|
|
+ where = where + " and 1=2";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //where = where + " and t1.flongsaleclsnum like'" + flongsaleslsRows.get(0).getString("flongsaleslsnum") + "%'";
|
|
|
|
|
+ where = where + " and exists(select *from titem_saleclsnum where titem_saleclsnum.siteid=t1.siteid and titem_saleclsnum.fitemno=t1.fitemno and titem_saleclsnum.flongsaleclsnum like'" + flongsaleslsRows.get(0).getString("flongsaleslsnum") + "%') ";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fiscollection") && !"".equals(whereObject.getString("fiscollection"))) {
|
|
|
|
|
+ where = where + " and isnull(t4.fiscollection,0) ='" + whereObject.getString("fiscollection") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fiscustomized") && !"".equals(whereObject.getString("fiscustomized"))) {
|
|
|
|
|
+ where = where + " and t1.fiscustomized ='" + whereObject.getString("fiscustomized") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fiswuliao") && !"".equals(whereObject.getString("fiswuliao"))) {
|
|
|
|
|
+ where = where + " and t1.fiswuliao ='" + whereObject.getString("fiswuliao") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fieldname") && !"".equals(whereObject.getString("fieldname"))) {
|
|
|
|
|
+ where = where + " and t1.fieldname ='" + whereObject.getString("fieldname") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fbrand") && !"".equals(whereObject.getString("fbrand"))) {
|
|
|
|
|
+ where = where + " and t1.fbrand ='" + whereObject.getString("fbrand") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fistool") && !"".equals(whereObject.getString("fistool"))) {
|
|
|
|
|
+ where = where + " and t1.fistool ='" + whereObject.getString("fistool") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- DBConnect dbConnect = new DBConnect();
|
|
|
|
|
- RowsMap rowsMap = dbConnect.runSqlQuery(sqlFactory.getSQL()).toRowsMap("field");
|
|
|
|
|
|
|
+ if (whereObject.containsKey("fvalue8") && whereObject.getBoolean("fvalue8")) {
|
|
|
|
|
+ //如果是中线碟阀
|
|
|
|
|
+ where = where + " and t1.fvalue8=1";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fvalue7") && !"".equals(whereObject.getString("fvalue7"))) {
|
|
|
|
|
+ where = where + " and t1.fvalue7 ='" + whereObject.getString("fvalue7") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fvalue6") && !"".equals(whereObject.getString("fvalue6"))) {
|
|
|
|
|
+ where = where + " and t1.fvalue6 ='" + whereObject.getString("fvalue6") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fvalue5") && !"".equals(whereObject.getString("fvalue5"))) {
|
|
|
|
|
+ where = where + " and t1.fvalue5 ='" + whereObject.getString("fvalue5") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fvalue4") && !"".equals(whereObject.getString("fvalue4"))) {
|
|
|
|
|
+ where = where + " and t1.fvalue4 ='" + whereObject.getString("fvalue4") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fvalue3") && !"".equals(whereObject.getString("fvalue3"))) {
|
|
|
|
|
+ where = where + " and t1.fvalue3 ='" + whereObject.getString("fvalue3") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fvalue2") && !"".equals(whereObject.getString("fvalue2"))) {
|
|
|
|
|
+ where = where + " and t1.fvalue2 ='" + whereObject.getString("fvalue2") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (whereObject.containsKey("fvalue1") && !"".equals(whereObject.getString("fvalue1"))) {
|
|
|
|
|
+ where = where + " and t1.fvalue1 ='" + whereObject.getString("fvalue1") + "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- JSONObject object = new JSONObject();
|
|
|
|
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "商品档案选项查询");
|
|
|
|
|
+ sqlFactory.addParameter("fagentnum", fagentnum);
|
|
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
|
|
+ sqlFactory.addParameter_SQL("where", where);
|
|
|
|
|
+ RowsMap rowsMap = connect.runSqlQuery(sqlFactory.getSQL()).toRowsMap("field");
|
|
|
|
|
+ JSONObject fieldobject = new JSONObject();
|
|
|
for (String field : rowsMap.keySet()) {
|
|
for (String field : rowsMap.keySet()) {
|
|
|
- object.put(field, rowsMap.get(field).toJsonArray("value"));
|
|
|
|
|
|
|
+ fieldobject.put(field, rowsMap.get(field).toJsonArray("value"));
|
|
|
}
|
|
}
|
|
|
- return getReturnObject_suc(object, true).toString();
|
|
|
|
|
|
|
+ return getReturnObject_suc(fieldobject, true).toString();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|