Просмотр исходного кода

打款凭证列表支持QuerySQL

eganwu 2 лет назад
Родитель
Сommit
cee6240a1f
1 измененных файлов с 28 добавлено и 6 удалено
  1. 28 6
      src/custom/restcontroller/webmanage/sale/paybill/Paybill.java

+ 28 - 6
src/custom/restcontroller/webmanage/sale/paybill/Paybill.java

@@ -13,6 +13,8 @@ import common.YosException;
 import common.annotation.API;
 import common.annotation.API;
 import common.annotation.CACHEING;
 import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.annotation.CACHEING_CLEAN;
+import common.annotation.QUERYBYROWINDEX;
+import common.data.QuerySQL;
 import common.data.Row;
 import common.data.Row;
 import common.data.Rows;
 import common.data.Rows;
 import common.data.SQLFactory;
 import common.data.SQLFactory;
@@ -62,14 +64,33 @@ public class Paybill extends Controller {
         } else {
         } else {
             where.append(" and t1.status!='新建'");
             where.append(" and t1.status!='新建'");
         }
         }
-        SQLFactory sqlFactory = new SQLFactory(this, "打款凭证列表", pageSize, pageNumber, pageSorting);
-        sqlFactory.addParameter("siteid", siteid);
-        sqlFactory.addParameter_SQL("where", where);
-        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+//        SQLFactory sqlFactory = new SQLFactory(this, "打款凭证列表", pageSize, pageNumber, pageSorting);
+//        sqlFactory.addParameter("siteid", siteid);
+//        sqlFactory.addParameter_SQL("where", where);
+//        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        if (pageSorting.equals("''")) {
+            pageSorting = "t1.status desc, t1.createdate desc";
+        }
+        QuerySQL querySQL = query(where.toString());
+        querySQL.setPage(pageSize, pageNumber);
+        querySQL.setOrderBy(pageSorting);
+        Rows rows = querySQL.query();
         return getSucReturnObject().setData(rows).toString();
         return getSucReturnObject().setData(rows).toString();
     }
     }
 
 
-    @API(title = "新增或更新", apiversion = R.ID20221226153004.v1.class,intervaltime = 200)
+    public QuerySQL query(String where) throws YosException {
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_paybill");
+        querySQL.setTableAlias("t1");
+        querySQL.addJoinTable(JOINTYPE.inner, "sa_agents", "t2", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid"
+                , "agentnum");
+        querySQL.addJoinTable(JOINTYPE.inner, "sys_enterprise", "t3", "t1.siteid = t2.siteid and t1.sys_enterpriseid = t3.sys_enterpriseid"
+                , "enterprisename", "abbreviation");
+        querySQL.setWhere(where);
+        querySQL.setWhere("t1.siteid", siteid);
+        return querySQL;
+    }
+
+    @API(title = "新增或更新", apiversion = R.ID20221226153004.v1.class, intervaltime = 200)
     @CACHEING_CLEAN(apiversions = {R.ID20221226152904.v1.class, R.ID20230202100104.v1.class})
     @CACHEING_CLEAN(apiversions = {R.ID20221226152904.v1.class, R.ID20230202100104.v1.class})
     public String insertOrUpdate() throws YosException {
     public String insertOrUpdate() throws YosException {
         ArrayList<String> sqlList = new ArrayList<>();
         ArrayList<String> sqlList = new ArrayList<>();
@@ -198,7 +219,7 @@ public class Paybill extends Controller {
         String remarks = rows.get(0).getString("remarks");
         String remarks = rows.get(0).getString("remarks");
         for (Row row : accountclassRows) {
         for (Row row : accountclassRows) {
             BigDecimal amount = row.getBigDecimal("amount");
             BigDecimal amount = row.getBigDecimal("amount");
-            CashbillEntity cashbillEntity = new CashbillEntity(amount, remarks, "打款凭证", billno, "sa_paybill", sa_paybillid,"货款","");
+            CashbillEntity cashbillEntity = new CashbillEntity(amount, remarks, "打款凭证", billno, "sa_paybill", sa_paybillid, "货款", "");
             sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), cashbillEntity, false));
             sqlList.addAll(Accountbalance.createCashbillIncome(this, sys_enterpriseid, row.getLong("sa_accountclassid"), cashbillEntity, false));
         }
         }
         dbConnect.runSqlUpdate(sqlList);
         dbConnect.runSqlUpdate(sqlList);
@@ -219,6 +240,7 @@ public class Paybill extends Controller {
 //    }
 //    }
 
 
     @API(title = "详情", apiversion = R.ID20221226153404.v1.class)
     @API(title = "详情", apiversion = R.ID20221226153404.v1.class)
+    @QUERYBYROWINDEX(uniquecolumnname = "sa_paybillid", listapiversion = {R.ID20221226152904.v1.class})
     public String queryById() throws YosException {
     public String queryById() throws YosException {
         Long sa_paybillid = content.getLong("sa_paybillid");
         Long sa_paybillid = content.getLong("sa_paybillid");
         SQLFactory sqlFactory = new SQLFactory(this, "打款凭证详情");
         SQLFactory sqlFactory = new SQLFactory(this, "打款凭证详情");