1
13693261870
2022-09-16 fee60c3e25fac0982f3b8cb8feea7225c4ed22f8
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
<?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.proxy.mapper.ProxyServletMapper">
    <resultMap id="ServletBean" type="com.terra.proxy.bean.ServletBean">
        <id column="ID" property="id" jdbcType="INTEGER"/>
        <result column="ENABLE" property="enable" jdbcType="INTEGER"/>
        <result column="URL" property="url" jdbcType="VARCHAR"/>
        <result column="REMARK" property="remark" jdbcType="VARCHAR"/>
        <result column="TIME" property="time" jdbcType="VARCHAR"/>
        <result column="ISPUBLIC" property="ispublic" jdbcType="INTEGER"/>
    </resultMap>
 
 
    <select id="queryServer" parameterType="map"
            resultType="map">
        select
        "ID",
        "URL",
        "ENABLE",
        "ISPUBLIC",
        "TIME",
        "REMARK"
        from "PROXYSERVLET" t where 1=1
        <if test="id!=null and id !='' ">and t."ID"=#{id}</if>
        <if test="url!=null and url!=''">and t."URL"=#{url}</if>
        <if test="remark != null and remark!='' ">and t."REMARK"=#{remark}</if>
        <if test="enable != null and enable != '' ">and t."ENABLE"=#{enable}</if>
        <if test="ispublic != null and ispublic != '' ">and t."ISPUBLIC"=#{ispublic}</if>
        <if test="starttime!=null and  starttime!='' and endtime!=null and endtime!='' ">and t."TIME" BETWEEN
            #{starttime} AND #{endtime}
        </if>
        limit #{limit} offset #{offSet};
    </select>
 
    <select id="queryTotalServer" parameterType="map"
            resultType="integer">
        select
        count(*)
        from "PROXYSERVLET" t where 1=1
        <if test="id!=null and id !='' ">and t."ID"=#{id}</if>
        <if test="url!=null and url!=''">and t."URL"=#{url}</if>
        <if test="remark != null and remark!='' ">and t."REMARK"=#{remark}</if>
        <if test="ispublic != null and ispublic != '' ">and t."ISPUBLIC"=#{ispublic}</if>
        <if test="enable != null and enable != '' ">and t."ENABLE"=#{enable}</if>
        <if test="starttime!=null and  starttime!='' and endtime!=null and endtime!='' ">and t."TIME" BETWEEN
            #{starttime} AND #{endtime}
        </if>
    </select>
 
 
    <insert id="addServlet" parameterType="com.terra.proxy.bean.ServletBean" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO "PROXYSERVLET"(
        "URL",
        "ENABLE",
        "ISPUBLIC",
        "TIME",
        "REMARK"
        )
        values
        (
        #{url,jdbcType=VARCHAR},
        #{enable,jdbcType=INTEGER},
        #{ispublic,jdbcType=INTEGER},
        #{time},
        #{remark,jdbcType=VARCHAR}
        )
    </insert>
 
 
    <update id="updateServer" parameterType="com.terra.proxy.bean.ServletBean">
        update "PROXYSERVLET"
        <set>
            <trim suffixOverrides=",">
                <if test="url!=null and url!=''">"URL"=#{url} ,</if>
                <if test="remark != null and remark!='' ">"REMARK"=#{remark},</if>
                <if test="ispublic != null and ispublic != '' ">"ISPUBLIC"=#{ispublic},</if>
                "ENABLE"=#{enable},
                "TIME"= CURRENT_TIMESTAMP ,
            </trim>
        </set>
        where "ID"= #{id,jdbcType=INTEGER}
    </update>
 
    <delete id="delServer" parameterType="java.lang.Integer">
       delete from "PROXYSERVLET" WHERE "ID"=#{id,jdbcType=INTEGER}
    </delete>
 
 
</mapper>