From c5220156021c5d90b6b7d33ec9154259936c3060 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 27 九月 2024 17:53:48 +0800
Subject: [PATCH] 自定义列迁移

---
 ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml |   46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
index 7a35194..d31c6a7 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
@@ -22,11 +22,38 @@
         <result column="dept_tag" property="deptTag"/>
     </resultMap>
 
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="pageMap" type="com.ycl.platform.domain.vo.YwPointVO">
+        <result column="id" property="id"/>
+        <result column="point_name" property="pointName"/>
+        <result column="start_time" property="startTime"/>
+        <result column="end_time" property="endTime"/>
+        <result column="unit_id" property="unitId"/>
+        <result column="unit_name" property="unitName"/>
+        <result column="status" property="status"/>
+        <result column="dept_id" property="deptId"/>
+        <result column="dept_name" property="deptName"/>
+        <result column="remark" property="remark"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="province_tag" property="provinceTag"/>
+        <result column="important_tag" property="importantTag"/>
+        <result column="important_command_image_tag" property="importantCommandImageTag"/>
+        <result column="dept_tag" property="deptTag"/>
+        <collection property="dynamicColumnList" select="getDyColumns" column="{id=id,tableName=tableName,pointName=pointName}" ofType="com.ycl.platform.domain.vo.DynamicColumnVO"/>
+    </resultMap>
+
+    <resultMap id="dynamicColumnMap" type="com.ycl.platform.domain.vo.DynamicColumnVO">
+        <result column="prop_name" property="propName"/>
+        <result column="label_value" property="labelValue"/>
+        <result column="column_value" property="columnValue"/>
+    </resultMap>
+
     <select id="selectData" resultType="com.ycl.platform.base.BaseSelect">
 
     </select>
 
-    <select id="page" resultMap="BaseResultMap">
+    <select id="page" resultMap="pageMap">
         SELECT
         typ.id,
         typ.point_name,
@@ -43,7 +70,9 @@
         typ.important_tag,
         typ.province_tag,
         typ.important_command_image_tag,
-        typ.dept_tag
+        typ.dept_tag,
+        't_yw_point' as tableName,
+        #{query.pointName} as pointName
         FROM
         t_yw_point typ
         LEFT JOIN t_yw_unit tyu ON typ.unit_id = tyu.id AND tyu.deleted = 0
@@ -55,6 +84,19 @@
         </where>
     </select>
 
+    <select id="getDyColumns" resultMap="dynamicColumnMap">
+        SELECT
+        *
+        FROM
+        t_dynamic_column_value dcv
+        LEFT JOIN t_dynamic_column dc ON dc.id = dcv.dynamic_column_id AND dc.table_name = #{tableName}
+        WHERE
+        dcv.ref_id = #{id}
+        <if test="pointName != null and pointName != ''">
+            and dcv.column_value like concat('%', #{keyword}, '%')
+        </if>
+    </select>
+
     <select id="dataCenterPage" resultType="com.ycl.platform.domain.vo.PointDetailVO">
         SELECT
                m.*

--
Gitblit v1.8.0