瀏覽代碼

供需列表查询排序调整

吴志根 3 年之前
父節點
當前提交
00ff11a29a

+ 2 - 0
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/SQL/供需列表查询.sql

@@ -16,4 +16,6 @@ t1.tagentsid,
 (select count(0) from timdialog where siteid=t1.siteid and ownertable='tsupplyanddemand' and ownerid=t1.tsupplyanddemandid) as fcommunicationtimes
 from tsupplyanddemand t1
 inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+left join (SELECT t5.timdialogid,t5.createdate FROM timdialogmessage as t5
+           WHERE t5.timdialogmessageid in (select MAX(timdialogmessageid)timdialogmessageid from timdialogmessage where siteid=$siteid$ and timdialogid=t5.timdialogid group by timdialogid)) t4 on   t1.TIMDIALOGID_TALKING=t4.timdialogid
 where t1.siteid=$siteid$ and t1.fstatus not in ('н¨') and $where$

+ 2 - 0
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/SQL/供需列表查询_对接中.sql

@@ -17,4 +17,6 @@ select
 from tsupplyanddemand t1
          inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
          inner join timdialogusers t3 on t3.TENTERPRISE_USERID= $userid$ and t1.TIMDIALOGID_TALKING=t3.timdialogid
+         left join (SELECT t5.timdialogid,t5.createdate FROM timdialogmessage as t5
+                    WHERE t5.timdialogmessageid in (select MAX(timdialogmessageid)timdialogmessageid from timdialogmessage where siteid=$siteid$ and timdialogid=t5.timdialogid group by timdialogid)) t4 on   t1.TIMDIALOGID_TALKING=t4.timdialogid
 where t1.siteid=$siteid$ and t1.fstatus not in ('н¨') and $where$

+ 2 - 2
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/supplyanddemand.java

@@ -32,7 +32,7 @@ public class supplyanddemand extends Controller {
          *排序条件设置
          */
         String[] sortfield = {"case when t1.fstatus in('已解决','已过期') then 0 when t1.fstatus='对接中'then 1 else 2 end desc, t1.tsupplyanddemandid desc"};
-        String sort = getSort(sortfield, "case when t1.fstatus in('已解决','已过期') then 0 when t1.fstatus='对接中'then 1 else 2 end desc, t1.tsupplyanddemandid desc");
+        String sort = getSort(sortfield, "case when t1.fstatus in('已解决','已过期') then 0 when t1.fstatus='对接中'then 1 else 2 end desc, t4.createdate desc,t1.tsupplyanddemandid desc");
         /**
          * 过滤条件设置
          */
@@ -70,7 +70,7 @@ public class supplyanddemand extends Controller {
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("userid", userid);
         sqlFactory.addParameter_SQL("where", where);
-
+        String sql = sqlFactory.getSQL();
 //        System.err.println(sqlFactory.getSQL());
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         RowsMap attinfoRowsMap = getAttachmentUrl("tsupplyanddemand", rows.toArrayList("tsupplyanddemandid"));