地质所 沉降监测网建设项目
chenhuan
2024-05-16 0fdd42e318f51f9e3c6581473416af1cca69877f
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
<?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.platform.mapper.ValidcodeMapper">
    
    <resultMap type="Validcode" id="ValidcodeResult">
        <result property="id"    column="id"    />
        <result property="phone"    column="phone"    />
        <result property="sendTime"    column="send_time"    />
        <result property="untilTime"    column="until_time"    />
        <result property="code"    column="code"    />
        <result property="type"    column="type"    />
    </resultMap>
 
    <sql id="selectValidcodeVo">
        select id, phone, send_time, until_time, code, type from js_validcode
    </sql>
 
    <select id="selectValidcodeList" parameterType="Validcode" resultMap="ValidcodeResult">
        <include refid="selectValidcodeVo"/>
        <where>  
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="sendTime != null "> and send_time &gt; #{sendTime}</if>
            <if test="untilTime != null "> and until_time &gt; #{untilTime}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
        </where>
        order by send_time desc
    </select>
    
    <select id="selectValidcodeById" parameterType="String" resultMap="ValidcodeResult">
        <include refid="selectValidcodeVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertValidcode" parameterType="Validcode">
        insert into js_validcode
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="phone != null  and phone != ''">phone,</if>
            <if test="sendTime != null ">send_time,</if>
            <if test="untilTime != null ">until_time,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="type != null  and type != ''">type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="phone != null  and phone != ''">#{phone},</if>
            <if test="sendTime != null ">#{sendTime},</if>
            <if test="untilTime != null ">#{untilTime},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="type != null  and type != ''">#{type},</if>
         </trim>
    </insert>
 
    <update id="updateValidcode" parameterType="Validcode">
        update js_validcode
        <trim prefix="SET" suffixOverrides=",">
            <if test="phone != null  and phone != ''">phone = #{phone},</if>
            <if test="sendTime != null ">send_time &gt; #{sendTime},</if>
            <if test="untilTime != null ">until_time &gt; #{untilTime},</if>
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="type != null  and type != ''">type = #{type},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteValidcodeById" parameterType="String">
        delete from js_validcode where id = #{id}
    </delete>
 
    <delete id="deleteValidcodeByIds" parameterType="String">
        delete from js_validcode where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>