fuliqi
2024-09-30 b5df1cee65f3e9dcf554efcd3f1642a8c79d1e76
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.platform.mapper.DynamicColumnMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.platform.domain.vo.DynamicColumnVO">
        <result column="ref_id" property="refId"/>
        <result column="prop_name" property="propName"/>
        <result column="label_value" property="labelValue"/>
        <result column="field_value" property="fieldValue"/>
    </resultMap>
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT TDC.ref_id,
               TDC.prop_name,
               TDC.label_value,
               TDC.field_value,
               TDC.id
        FROM t_dynamic_column TDC
        WHERE TDC.id = #{id}
          AND TDC.deleted = 0
    </select>
 
    <select id="getHeader" resultType="java.lang.String">
        SELECT TDC.label_value
        FROM t_dynamic_column TDC
        WHERE TDC.table_name =#{tableName}
    </select>
    <select id="getData" resultType="com.ycl.platform.domain.vo.DynamicColumnVO">
        SELECT
        TDCV.ref_id as id,
        TDC.prop_name,
        TDC.label_value,
        TDCV.column_value
        FROM
        t_dynamic_column TDC
        LEFT JOIN t_dynamic_column_value TDCV ON TDC.id =TDCV.dynamic_column_id
        <where>
            TDC.table_name  = 't_yw_point'
<!--            <if test="ids !=null and ids.size > 0">-->
<!--                AND TDCV.ref_id in-->
<!--                <foreach collection="ids" open="(" separator="," close=")" item="id">-->
<!--                    #{id}-->
<!--                </foreach>-->
<!--            </if>-->
        </where>
    </select>
 
    <select id="getPage" resultMap="BaseResultMap">
        SELECT TDC.ref_id,
               TDC.prop_name,
               TDC.label_value,
               TDC.field_value,
               TDC.id
        FROM t_dynamic_column TDC
        WHERE TDC.deleted = 0
    </select>
 
</mapper>