DomainInfoMapper.xml
1.43 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
<?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.DomainInfoMapper" >
<resultMap id="BaseResultMap" type="com.monitor.model.domain.DomainInfo" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, name, DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime
</sql>
<insert id="insert" parameterType="com.monitor.model.domain.DomainInfo" useGeneratedKeys="true" keyProperty="id">
insert into domain_info
(
name, create_time
)
values
(
#{name,jdbcType=INTEGER}, now()
)
</insert>
<delete id="deleteAll" parameterType="java.lang.Integer" >
delete from domain_info
</delete>
<select id="selectById" resultMap="BaseResultMap">
select
t.id as id, t.name as name, DATE_FORMAT(t.create_time,'%Y-%m-%d %H:%i:%S') AS createTime
from
domain_info t, elb_link_domain t1
where
t1.elb_id = #{id,jdbcType=INTEGER} and t1.domain_id=t.id
</select>
<select id="selectByName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from
domain_info
where
name = #{name,jdbcType=VARCHAR}
</select>
</mapper>