地质所 沉降监测网建设项目
zmk
2024-05-22 28e168f05d3eb48223e69064188c6fce786442d4
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
<?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.spider.mapper.SpiderFiledRuleMapper">
    
    <resultMap type="SpiderFiledRule" id="SpiderFiledRuleResult">
        <result property="id"    column="id"    />
        <result property="fieldId"    column="field_id"    />
        <result property="processType"    column="process_type"    />
        <result property="replacereg"    column="replaceReg"    />
        <result property="replacement"    column="replacement"    />
        <result property="substrTarget"    column="substr_target"    />
        <result property="sort"    column="sort"    />
    </resultMap>
 
    <sql id="selectSpiderFiledRuleVo">
        select id, field_id, process_type, replaceReg, replacement, substr_target, sort from spider_filed_rule
    </sql>
 
    <select id="selectSpiderFiledRuleList" parameterType="SpiderFiledRule" resultMap="SpiderFiledRuleResult">
        <include refid="selectSpiderFiledRuleVo"/>
        <where>
            <if test="fieldId != null and fieldId != '' "> and field_id = #{fieldId}</if>
        </where>
    </select>
    
    <select id="selectSpiderFiledRuleById" parameterType="Long" resultMap="SpiderFiledRuleResult">
        <include refid="selectSpiderFiledRuleVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSpiderFiledRule" parameterType="SpiderFiledRule" useGeneratedKeys="true" keyProperty="id">
        insert into spider_filed_rule
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fieldId != null  and fieldId != ''">field_id,</if>
            <if test="processType != null  and processType != ''">process_type,</if>
            <if test="replacereg != null  and replacereg != ''">replaceReg,</if>
            <if test="replacement != null  and replacement != ''">replacement,</if>
            <if test="substrTarget != null  and substrTarget != ''">substr_target,</if>
            <if test="sort != null ">sort,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fieldId != null  and fieldId != ''">#{fieldId},</if>
            <if test="processType != null  and processType != ''">#{processType},</if>
            <if test="replacereg != null  and replacereg != ''">#{replacereg},</if>
            <if test="replacement != null  and replacement != ''">#{replacement},</if>
            <if test="substrTarget != null  and substrTarget != ''">#{substrTarget},</if>
            <if test="sort != null ">#{sort},</if>
         </trim>
    </insert>
 
    <update id="updateSpiderFiledRule" parameterType="SpiderFiledRule">
        update spider_filed_rule
        <trim prefix="SET" suffixOverrides=",">
            <if test="fieldId != null  and fieldId != ''">field_id = #{fieldId},</if>
            <if test="processType != null  and processType != ''">process_type = #{processType},</if>
            <if test="replacereg != null  and replacereg != ''">replaceReg = #{replacereg},</if>
            replacement = #{replacement},
            <if test="substrTarget != null  and substrTarget != ''">substr_target = #{substrTarget},</if>
            <if test="sort != null ">sort = #{sort},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteSpiderFiledRuleById" parameterType="Long">
        delete from spider_filed_rule where id = #{id}
    </delete>
 
    <delete id="deleteSpiderFiledRuleByIds" parameterType="String">
        delete from spider_filed_rule where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>