地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
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
<?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.javaweb.geo.mapper.DataSourceMapper">
    
    <resultMap type="DataSource" id="DataSourceResult">
        <result property="ids"    column="ids"    />
        <result property="dataSource"    column="data_source"    />
        <result property="secretKey"    column="secret_key"    />
        <result property="companyId"    column="company_id"    />
    </resultMap>
 
    <sql id="selectDataSourceVo">
        select ids, data_source, secret_key , company_id from js_data_source
    </sql>
 
    <select id="selectDataSourceList" parameterType="DataSource" resultMap="DataSourceResult">
        <include refid="selectDataSourceVo"/>
        <where>  
            <if test="dataSource != null  and dataSource != ''"> and data_source = #{dataSource}</if>
            <if test="secretKey != null  and secretKey != ''"> and secret_key = #{secretKey}</if>
            <if test="companyId != null  and companyId != ''"> and company_id = #{companyId}</if>
        </where>
    </select>
    
    <select id="selectDataSourceById" parameterType="String" resultMap="DataSourceResult">
        <include refid="selectDataSourceVo"/>
        where ids = #{ids}
    </select>
 
    <select id="selectDataSourceBySecretKey" resultType="java.lang.String" parameterType="String">
        select data_source from js_data_source where secret_key = #{secretKey}
    </select>
 
    <select id="selectCompanyIdBySecretKey" resultType="java.lang.String" parameterType="String">
        select company_id from js_data_source where secret_key = #{secretKey}
    </select>
 
    <insert id="insertDataSource" parameterType="DataSource">
        insert into js_data_source
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">ids,</if>
            <if test="dataSource != null  and dataSource != ''">data_source,</if>
            <if test="secretKey != null  and secretKey != ''">secret_key,</if>
            <if test="companyId != null  and companyId != ''">company_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">#{ids},</if>
            <if test="dataSource != null  and dataSource != ''">#{dataSource},</if>
            <if test="secretKey != null  and secretKey != ''">#{secretKey},</if>
            <if test="companyId != null  and companyId != ''">#{companyId},</if>
         </trim>
    </insert>
 
    <update id="updateDataSource" parameterType="DataSource">
        update js_data_source
        <trim prefix="SET" suffixOverrides=",">
            <if test="dataSource != null  and dataSource != ''">data_source = #{dataSource},</if>
            <if test="secretKey != null  and secretKey != ''">secret_key = #{secretKey},</if>
            <if test="companyId != null  and companyId != ''">company_id = #{companyId},</if>
        </trim>
        where ids = #{ids}
    </update>
 
    <update id="updateDataSourceBySecretKey">
        update js_data_source
        <trim prefix="SET" suffixOverrides=",">
            <if test="companyId != null  and companyId != ''">company_id = #{companyId},</if>
        </trim>
        where secret_key = #{secretKey}
    </update>
 
    <delete id="deleteDataSourceById" parameterType="String">
        delete from js_data_source where ids = #{ids}
    </delete>
 
    <delete id="deleteDataSourceByIds" parameterType="String">
        delete from js_data_source where ids in 
        <foreach item="ids" collection="array" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    
</mapper>