郭齐峰 hai 1 ano
pai
achega
555e1e7c2f

+ 11 - 13
src/custom/restcontroller/webmanage/sale/reporttype/ReportType.java

@@ -29,19 +29,17 @@ public class ReportType extends Controller {
 
     @API(title = "授权报表中心应用的报表查询", apiversion = R.ID20240407094904.v1.class)
     public String queryReport() throws YosException {
-        SQLFactory sqlFactory = new SQLFactory(this, "授权报表中心应用的报表查询");
-        sqlFactory.addParameter("siteid", siteid);
-//        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_report", "sys_reportid");
-//        querySQL.setTableAlias("t1");
-//        querySQL.addJoinTable(JOINTYPE.left, "jimu_report", "t2", "t1.jimu_report_id = t2.id");
-//        querySQL.addJoinTable(JOINTYPE.left, "sys_reporttype", "t3", "t1.sys_reportid = t3.sys_reportid and t3.siteid='" + siteid + "'");
-//        querySQL.setWhere("t1.systemappid=" + 163 + " and (ifnull(t1.siteid,'')='' or t1.siteid = '" + siteid + "')");
-//        querySQL.addQueryFields("name", "if(t1.reporttype = '积木报表', t2.name, t1.name)");
-//        querySQL.addQueryFields("type", "group_concat(t3.type separator ',')");
-//        querySQL.addGroupBy("t1.sys_reportid", "t1.name", "t2.name");
-//        querySQL.setPage(pageSize, pageNumber);
-//        Rows query = querySQL.query();
-        Rows query = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_report", "sys_reportid");
+        querySQL.setTableAlias("t1");
+        querySQL.addJoinTable(JOINTYPE.left, "jimu_report", "t2", "t1.jimu_report_id = t2.id");
+        querySQL.addJoinTable(JOINTYPE.left, "sys_reporttype", "t3", "t1.sys_reportid = t3.sys_reportid and t3.siteid='" + siteid + "'");
+        querySQL.setWhere("t1.systemappid=" + 163 + " and (ifnull(t1.siteid,'')='' or t1.siteid = '" + siteid + "')");
+        querySQL.addQueryFields("name", "if(t1.reporttype = '积木报表', t2.name, t1.name)");
+        querySQL.addQueryFields("type", "group_concat(t3.type separator ',')");
+        querySQL.addGroupBy("t1.sys_reportid", "t1.name", "t2.name");
+        querySQL.setWhere("((t1.reporttype = '积木报表' and t2.id is not null) or (t1.reporttype != '积木报表'))");
+        querySQL.setPage(pageSize, pageNumber);
+        Rows query = querySQL.query();
         return getSucReturnObject().setData(query).toString();
 
     }

+ 1 - 2
src/custom/restcontroller/webmanage/sale/reporttype/SQL/授权报表中心应用的报表查询.sql

@@ -6,6 +6,5 @@ from sys_report t1
          left join sys_reporttype t3 on t1.sys_reportid = t3.sys_reportid and t3.siteid = $siteid$
 where t1.systemappid = 163
   and (ifnull(t1.siteid, '') = '' or t1.siteid = $siteid$)
-  and ((t1.reporttype = '积木报表' and t2.id is not null)
-    or (t1.reporttype != '积木报表'))
+  and ((t1.reporttype = '积木报表' and t2.id is not null) or (t1.reporttype != '积木报表'))
 group by t1.sys_reportid, t1.name, t2.name