|
|
@@ -91,18 +91,50 @@ public class creditbill extends Controller {
|
|
|
"or t2.erpagentnum like '%" + whereObject.getString("condition") + "%')";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ long sa_creditbillid = content.getLongValue("sa_creditbillid");
|
|
|
// SQLFactory sqlFactory = new SQLFactory(this, "合作企业档案列表查询", pageSize, pageNumber, pageSorting);
|
|
|
// sqlFactory.addParameter_SQL("where", where);
|
|
|
// Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_enterprise", "sys_enterpriseid", "enterprisename","abbreviation",
|
|
|
- "province","city","county","address","contact","phonenumber","taxno");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_enterprise", "sys_enterpriseid", "enterprisename", "abbreviation",
|
|
|
+ "province", "city", "county", "address", "contact", "phonenumber", "taxno");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sys_dataextend", "t2", "t1.sys_enterpriseid = t2.ownerid and t2.ownertable = 'sys_enterprise' and t1.siteid = t2.siteid","erpagentnum");
|
|
|
- querySQL.addJoinTable(JOINTYPE.inner, "sa_agents", "t3", "t1.sys_enterpriseid=t3.sys_enterpriseid and t1.siteid=t3.siteid","agentnum");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sys_dataextend", "t2", "t1.sys_enterpriseid = t2.ownerid and t2.ownertable = 'sys_enterprise' and t1.siteid = t2.siteid", "erpagentnum");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sa_agents", "t3", "t1.sys_enterpriseid=t3.sys_enterpriseid and t1.siteid=t3.siteid", "agentnum");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
querySQL.setWhere(where);
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ ArrayList<Long> sys_enterpriseids = rows.toArrayList("sys_enterpriseid", new ArrayList<>());
|
|
|
+ sys_enterpriseids.add(0l);
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "营销账户类别列表查询2");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter_in("sys_enterpriseid", sys_enterpriseids);
|
|
|
+ sqlFactory.addParameter("sa_creditbillid", sa_creditbillid);
|
|
|
+ RowsMap accountRowsMap = dbConnect.runSqlQuery(sqlFactory).toRowsMap("sys_enterpriseid");
|
|
|
+
|
|
|
+ for (Row row : rows) {
|
|
|
+ Long sys_enterpriseid = row.getLong("sys_enterpriseid");
|
|
|
+ if (accountRowsMap.containsKey(String.valueOf(sys_enterpriseid))) {
|
|
|
+ Rows accountRows = accountRowsMap.get(row.getString("sys_enterpriseid"));
|
|
|
+ row.put("accountname", accountRows.get(0).getString("accountname"));
|
|
|
+ row.put("accountno", accountRows.get(0).getString("accountno"));
|
|
|
+ row.put("creditquota", accountRows.get(0).getBigDecimal("creditquota"));
|
|
|
+ row.put("oldcreditquota", accountRows.get(0).getBigDecimal("creditquota"));
|
|
|
+ row.put("isorder", accountRows.get(0).getString("isorder"));
|
|
|
+ row.put("sa_accountclassid", accountRows.get(0).getString("sa_accountclassid"));
|
|
|
+ }
|
|
|
+ row.putIfAbsent("creditquota", 0);
|
|
|
+ row.putIfAbsent("oldcreditquota", 0);
|
|
|
+ row.putIfAbsent("accountname", "");
|
|
|
+ row.putIfAbsent("accountno", "");
|
|
|
+ row.putIfAbsent("isorder", "");
|
|
|
+ row.putIfAbsent("sa_accountclassid", "");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
@@ -146,9 +178,9 @@ public class creditbill extends Controller {
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
// Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
querySQL.setTableAlias("t0");
|
|
|
- querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "t0.siteid='111'","*");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "t0.siteid='111'", "*");
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
Rows rows = querySQL.query();
|
|
|
return getSucReturnObject().setData(rows).toString();
|