燕山石化项目数据提取服务
xing
2023-02-24 08c8552eb977f27304a4785e5a671905463d83c1
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?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.terra.bigdata.mapper.Yssh3dreliMapper">
    <resultMap id="Yssh3dreliResult" type="com.terra.bigdata.domain.Yssh3dreli">
        <id column="id" property="id" javaType="java.lang.Integer"/>
        <id column="name" property="name" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="lon" property="lon" javaType="java.lang.Float" jdbcType="DOUBLE"/>
        <id column="lat" property="lat" javaType="java.lang.Float" jdbcType="DOUBLE"/>
        <id column="height0" property="height0" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height10" property="height10" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height20" property="height20" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height30" property="height30" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height40" property="height40" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height50" property="height50" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height60" property="height60" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height70" property="height70" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height80" property="height80" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="height90" property="height90" javaType="java.lang.String" jdbcType="VARCHAR"/>
    </resultMap>
 
    <select id="query" resultType="com.terra.bigdata.domain.Yssh3dreli">
        select * from yssh_3dreli where 1=1
        <if test="name != null and name != ''">
            and name = #{name}
        </if>
    </select>
 
    <select id="getAll" resultType="com.terra.bigdata.domain.Yssh3dreli">
        select *
        from yssh_3dreli
        where 1 = 1
    </select>
 
 
    <!--创建3d表的 SQL 语句-->
    <update id="create3dreliTable" parameterType="java.lang.String">
        CREATE TABLE IF NOT EXISTS `${tableName}` (
            `id` int (20) NOT NULL AUTO_INCREMENT,
            `name` varchar (100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '点位名称',
            `lon` double NULL DEFAULT NULL COMMENT '经度',
            `lat` double NULL DEFAULT NULL COMMENT '纬度',
            `height0` varchar (120) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度0m数据',
            `height10` varchar (120) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度10m数据',
            `height20` varchar (120) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度20m数据',
            `height30` varchar (120) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度30m数据',
            `height40` varchar (200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度40m数据',
            `height50` varchar (200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度50m数据',
            `height60` varchar (200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度60m数据',
            `height70` varchar (200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度70m数据',
            `height80` varchar (200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度80m数据',
            `height90` varchar (200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '热力图高度90m数据',
            `time` varchar (255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '时间',
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB AUTO_INCREMENT = 8715 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    </update>
 
    <!--创建2d表的 SQL 语句-->
    <update id="create2dreliTable" parameterType="java.lang.String">
        CREATE TABLE IF NOT EXISTS `${tableName}` (
            `id` int(20) NOT NULL AUTO_INCREMENT,
            `lon` double NULL DEFAULT NULL COMMENT '经度',
            `lat` double NULL DEFAULT NULL COMMENT '纬度',
            `value` double NOT NULL,
            `time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
            PRIMARY KEY (`id`) USING BTREE
            ) ENGINE = InnoDB AUTO_INCREMENT = 135712 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    </update>
 
    <!-- 新增表3d数据 -->
    <insert id="insert3dreliData" parameterType="com.terra.bigdata.domain.Yssh3dreli" useGeneratedKeys="true" keyProperty="id">
        insert into ${tableName}
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">name,</if>
            <if test="lon != null">lon,</if>
            <if test="lat != null">lat,</if>
            <if test="height0 != null">height0,</if>
            <if test="height10 != null">height10,</if>
            <if test="height20 != null">height20,</if>
            <if test="height30 != null">height30,</if>
            <if test="height40 != null">height40,</if>
            <if test="height50 != null">height50,</if>
            <if test="height60 != null">height60,</if>
            <if test="height70 != null">height70,</if>
            <if test="height80 != null">height80,</if>
            <if test="height90 != null">height90,</if>
            <if test="time != null">time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="name != null">#{name},</if>
            <if test="lon != null">#{lon},</if>
            <if test="lat != null">#{lat},</if>
            <if test="height0 != null">#{height0},</if>
            <if test="height10 != null">#{height10},</if>
            <if test="height20 != null">#{height20},</if>
            <if test="height30 != null">#{height30},</if>
            <if test="height40 != null">#{height40},</if>
            <if test="height50 != null">#{height50},</if>
            <if test="height60 != null">#{height60},</if>
            <if test="height70 != null">#{height70},</if>
            <if test="height80 != null">#{height80},</if>
            <if test="height90 != null">#{height90},</if>
            <if test="time != null">#{time},</if>
        </trim>
    </insert>
 
    <!--  批量新增3D数据 <foreach item="item" index="index" collection="list" separator=","> -->
    <insert id="batchInsert3dreliData" parameterType="java.util.List">
        insert into ${tableName}
        (name, lon, lat, height0, height10, height20, height30, height40, height50, height60, height70, height80, height90, time)
        values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.name},#{item.lon}, #{item.lat},#{item.height0},#{item.height10},#{item.height20},#{item.height30},#{item.height40},#{item.height50},#{item.height60},#{item.height70},#{item.height80},#{item.height90},#{item.time})
        </foreach>
    </insert>
 
    <!--  批量新增2D数据 <foreach item="item" index="index" collection="list" separator=","> -->
    <insert id="batchInsert2dreliData" parameterType="java.util.List">
        insert into ${tableName}
        ( lon, lat, value, time)
        values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.lon}, #{item.lat},#{item.value},#{item.time})
        </foreach>
    </insert>
 
 
    <!--删除的 SQL 语句 DROP TABLE ${tableName}-->
    <update id="drop3dreliTable" parameterType="java.lang.String">
        DROP TABLE IF EXISTS ${tableName}
    </update>
 
 
</mapper>