InternalDomainMapper.xml
2.61 KB
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
<?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.monitor.mysql.mapper.InternalDomainMapper" >
<resultMap id="BaseResultMap" type="com.model.InternalDomain" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="domain" property="domain" jdbcType="VARCHAR" />
<result column="environment" property="environment" jdbcType="VARCHAR" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="value" property="value" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="VARCHAR" />
<result column="tag" property="tag" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, domain, environment, name, value, type,tag
</sql>
<insert id="insert" parameterType="com.model.InternalDomain" >
insert into internal_domain
(domain, environment, name, value, type,tag)
values
(#{domain,jdbcType=VARCHAR},#{environment,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},#{tag,jdbcType=VARCHAR})
</insert>
<update id="update" parameterType="com.model.InternalDomain" >
update internal_domain
set
name = #{name,jdbcType=VARCHAR},
value = #{value,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR},
tag = #{tag,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from internal_domain
where
domain = #{domain,jdbcType=VARCHAR}
and environment = #{environment,jdbcType=VARCHAR}
<if test="tag != null && tag != 'ALL'" >
and instr(tag, #{tag,jdbcType=VARCHAR}) > 0
</if>
ORDER by name
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from internal_domain
where
id = #{id}
</select>
<select id="selectByCondition" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from internal_domain
where
domain = #{domain}
and environment = #{environment}
and name = #{name}
<if test="type != null and type != '' " >
and type = #{type}
</if>
</select>
<delete id="deleteById" parameterType="java.lang.Integer" >
delete from internal_domain
where id = #{id}
</delete>
<select id="selectByValue" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from internal_domain
where
value = #{value}
</select>
</mapper>