UniversityMessageMapper.xml
2.73 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
<?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.sincere.student.mapper.UniversityMessageMapper">
<resultMap id="BaseResultMap" type="com.sincere.student.model.Message">
<result column="id" jdbcType="INTEGER" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="context" jdbcType="VARCHAR" property="context" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer">
select count(0) from university_message
<where>
<if test="search != null and search != ''">
and title like #{search}
</if>
</where>
</select>
<select id="getList" parameterType="com.sincere.student.dto.MessageSearchDto" resultMap="BaseResultMap">
select * from university_message
<where>
<if test="search != null and search != ''">
and title like #{search}
</if>
</where>
</select>
<select id="getDetail" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select * from university_message m
where m.id=#{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from university_message
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.sincere.student.model.Message">
insert into university_message (title, context,
phone, create_time)
values (#{title,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, GETDATE())
</insert>
<insert id="insertSelective" parameterType="com.sincere.student.model.Message">
insert into university_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="title != null">
title,
</if>
<if test="context != null">
context,
</if>
<if test="phone != null">
phone,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="context != null">
#{context,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
</mapper>