Explorar o código

修改个人商户列表排序

沈静伟 %!s(int64=4) %!d(string=hai) anos
pai
achega
083130ba77

+ 4 - 2
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/个人商户列表查询.sql

@@ -1,13 +1,15 @@
-select t1.tagentsid,
+select
+       t1.tagentsid,
        t1.siteid,
        t1.createdate,
        t2.fname,
        t2.fphonenumber,
        t2.faddress,
        t1.fisused,
+       (case when exists(select fstatus from tagents_msgchangeapp where ftype='商户认证' and fstatus='申请' and tagentsid=t1.tagentsid) then '认证中' else '未认证' end)as fstatus,
        max(t3.flastrequestdate)as flastrequestdate
 from tagents t1
 inner join tenterprise_users t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid and t2.fisadministrator=1
 left join tuserrequestlog t3 on t1.siteid = t3.siteid and t2.tenterprise_userid = t3.tenterprise_userid
-where t1.ftype='个人' and t1.siteid =$siteid$ and $where$
+where t1.ftype='个人'and t1.siteid =$siteid$ and $where$
 group by t1.tagentsid,t1.siteid,t1.createdate,t2.fname,t2.fphonenumber,t2.faddress,t1.fisused

+ 5 - 8
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/tagents.java

@@ -44,16 +44,13 @@ public class tagents extends Controller {
                 where.append(")");
             }
         }
-        SQLFactory singleagentSql = new SQLFactory(this, "个人商户列表查询", pageSize, pageNumber, "t1.tagentsid");
+        /**
+         * 认证中状态排第一
+         */
+        SQLFactory singleagentSql = new SQLFactory(this, "个人商户列表查询", pageSize, pageNumber, "case when exists(select *from tagents_msgchangeapp where ftype='商户认证' and fstatus='申请' and tagentsid=t1.tagentsid) then '认证中' else '未认证' end),t1.tagentsid desc");
         singleagentSql.addParameter("siteid", siteid);
         singleagentSql.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(singleagentSql.getSQL());
-
-        ArrayList<String> tagentsidlist = dbConnect.runSqlQuery("select tagentsid from tagents_msgchangeapp where ftype='商户认证' and fstatus='申请'").toArrayList("tagentsid");
-        for (Row row : rows) {
-            String tagentsid = row.getString("tagentsid");
-            row.put("fstatus", tagentsidlist.contains(tagentsid) ? "认证中" : "未认证");
-        }
         return getSucReturnObject().setDataByPaging(rows).setFinalDo(DataPool.defaultdatalife, 1);
     }
 
@@ -87,7 +84,7 @@ public class tagents extends Controller {
                 }
             }
         }
-        SQLFactory agentsql = new SQLFactory(this, "认证商户列表查询", pageSize, pageNumber, "t1.tagentsid");
+        SQLFactory agentsql = new SQLFactory(this, "认证商户列表查询", pageSize, pageNumber, "t1.tagentsid desc");
         agentsql.addParameter("siteid", siteid);
         agentsql.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(agentsql.getSQL());