Pārlūkot izejas kodu

商户列表查询去重复和已开通直播的商户

吴志根 3 gadi atpakaļ
vecāks
revīzija
d4e13f4ebb

+ 2 - 1
src/dsb/com/cnd3b/restcontroller/enterprise/activity/SQL/活动商户列表查询.sql

@@ -1,5 +1,6 @@
 select t1.tactivity_agentmsgid, t1.tagentsid, t1.tactivityid,t2.fagentname, t1.fbrand, t1.fintroduction,t1.flocationclass, t1.fcontact, t1.fphonenumber,
-       t1.flocation,t1.fstatus
+       t1.flocation,t1.fstatus,t3.channelid
 from tactivity_agentmsg t1
 inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+inner join tlive t3 on  t1.tagentsid=t3.tagentsid
 where t1.siteid=$siteid$ and t1.tactivityid=$tactivityid$ and $where$

+ 1 - 1
src/dsb/com/cnd3b/restcontroller/enterprise/activity/activity.java

@@ -130,7 +130,7 @@ public class activity extends Controller {
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("tactivityid", tactivityid);
         sqlFactory.addParameter_SQL("where", where);
-
+       // String sql = sqlFactory.getSQL();
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         RowsMap brandlogoRowsMap = getAttachmentUrl("tagents", rows.toArrayList("tagentsid"), "brandlogo");
         for (Row row : rows) {

+ 2 - 2
src/dsb/com/cnd3b/restcontroller/enterprise/live/live.java

@@ -47,8 +47,8 @@ public class live extends Controller {
         /**
          *排序条件设置
          */
-        String[] sortfield = {"t1.livestatus,t1.createdate desc"};
-        String sort = getSort(sortfield, "t1.livestatus,t1.createdate desc");
+        String[] sortfield = {"case t1.livestatus when 'waiting' then 0 else '' end,t1.createdate desc"};
+        String sort = getSort(sortfield, "case t1.livestatus when 'waiting' then 0 else '' end,t1.createdate desc");
         /**
          * 过滤条件设置
          */

+ 8 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/SQL/查询重复的商户.sql

@@ -0,0 +1,8 @@
+SELECT tagentsid
+FROM tagents t1
+         INNER JOIN (
+    SELECT fbrand, faddress, fagentname
+    FROM tagents
+    WHERE tagentsid IN (
+        SELECT tagentsid
+        FROM tlive)) t2 ON t1.fbrand = t2.fbrand AND t1.faddress = t2.faddress AND t2.fagentname = t1.fagentname

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

@@ -10,8 +10,8 @@ select t1.tagentsid,
        count(t2.tenterprise_userid) as fteamsize,
        max(t3.flastrequestdate)as flastrequestdate,
        isnull(t1.saleprodclass,'[]')as saleprodclass
-from tagents t1
+from (  select * from tagents A where not exists(select 1 from tagents where fbrand=A.fbrand and faddress=A.faddress and fagentname=A.fagentname and tagentsid<A.tagentsid)) t1
 inner join tenterprise_users t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
 left join tuserrequestlog t3 on t1.siteid = t3.siteid and t2.tenterprise_userid = t3.tenterprise_userid
-where t1.siteid =$siteid$ and $where$ and t1.ftype!='¸öÈË'
+where t1.siteid =$siteid$ and $where$ and t1.ftype!='¸öÈË' and t1.tagentsid not in $tagentsid$
 group by t1.tagentsid,t1.siteid,t1.createdate,t1.fagentname,t1.faddress,t1.fcontact,t1.fphonenumber,t1.fbrand,t1.fisused,t1.saleprodclass

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

@@ -88,11 +88,19 @@ public class tagents extends Controller {
                         "and isnull(tactivityid,0)='' and tagentsid=t1.tagentsid) ");
             }
         }
+        Rows tRows = dbConnect.runSqlQuery(" SELECT DISTINCT tagentsid FROM tlive");
+        SQLFactory sqlFactory2 = new SQLFactory(this, "查询重复的商户");
+        Rows tRows2 = dbConnect.runSqlQuery(sqlFactory2.getSQL());
+        tRows.addAll(tRows2);
         SQLFactory agentsql = new SQLFactory(this, "认证商户列表查询", pageSize, pageNumber, "t1.tagentsid desc");
         agentsql.addParameter("siteid", siteid);
         agentsql.addParameter_SQL("where", where);
+        //排除掉已经创建直播的商户
+        agentsql.addParameter_in("tagentsid",tRows.toArrayList("tagentsid"));
         Rows rows = dbConnect.runSqlQuery(agentsql.getSQL());
 
+        String sql = agentsql.getSQL();
+
         SQLFactory agentchecksql = new SQLFactory(this, "商户认证时间查询");
         agentchecksql.addParameter("siteid", siteid);
         agentchecksql.addParameter_in("tagentsid", rows.toArrayList("tagentsid"));