Bladeren bron

获取报表添加分配了哪些用户组

zhoupeng 2 jaren geleden
bovenliggende
commit
d1cae87187

+ 23 - 1
chaunyi_opc/opc_da/src/main/resources/mapper/ReportTableDao.xml

@@ -287,7 +287,29 @@
         ))) a
     </select>
 
-    <select id="getAllOkReportTable" resultType="com.example.opc_common.entity.ReportTable">
+    <resultMap type="com.example.opc_common.entity.ReportTable" id="allReportTable">
+        <id property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="reportTableName" column="report_table_name"/>
+        <result property="reportValueFormat" column="report_value_format"/>
+        <result property="isAutoReport" column="is_auto_report"/>
+        <result property="cronId" column="cron_id"/>
+        <result property="cron" column="cron"/>
+        <result property="createTime" column="create_time"/>
+        <collection column="id" property="userGroupList"
+                    ofType="com.example.opc_common.entity.UserGroup" select="getUserGroupById">
+            <id column="id" property="id"/>
+        </collection>
+    </resultMap>
+
+    <select id="getUserGroupById" parameterType="INTEGER" resultType="com.example.opc_common.entity.UserGroup">
+        SELECT user_group_id as id
+        FROM t_table_user_group
+        where table_id = #{id}
+    </select>
+
+    <select id="getAllOkReportTable" resultMap="allReportTable">
         select
         trt.id,
         trt.user_id,

+ 1 - 2
chaunyi_opc/opc_ua/src/main/java/com/example/opc_ua/controller/DataSourceController.java

@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.example.opc_common.entity.DataSource;
 import com.example.opc_common.util.Blank;
 import com.example.opc_common.util.ConstantStr;
-import com.example.opc_common.util.JavaTypeUtil;
 import com.example.opc_common.util.Result;
 import com.example.opc_ua.service.DataSourceService;
 import com.example.opc_ua.task.OpcAsyncTask;
@@ -57,7 +56,7 @@ public class DataSourceController {
             Result result = OpcUaUtil.opcUaGetTree(dataSource);
             List<JSONObject> dataList = JSON.parseObject(String.valueOf(result.getData()), List.class);
             redisUtil.set(ConstantStr.DATA_SOURCE_TREE + dataSource.getId(), String.valueOf(dataList));
-            return OpcUaUtil.opcUaGetTree(dataSource);
+            return result;
         }
     }