Blame view

src/main/resources/mapper/UniversityMessageMapper.xml 2.73 KB
b9411514   陈杰   first
1
2
3
<?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">
123dbb81   徐泉   研学代码提交
4
5
6
7
8
9
10
  <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>
b9411514   陈杰   first
11

123dbb81   徐泉   研学代码提交
12
13
14
15
16
17
18
19
  <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>
b9411514   陈杰   first
20

123dbb81   徐泉   研学代码提交
21
22
23
24
25
26
27
28
  <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>
b9411514   陈杰   first
29

123dbb81   徐泉   研学代码提交
30
31
32
33
  <select id="getDetail" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select * from university_message m
    where m.id=#{id}
  </select>
b9411514   陈杰   first
34

123dbb81   徐泉   研学代码提交
35
36
37
38
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from university_message
    where id = #{id,jdbcType=INTEGER}
  </delete>
b9411514   陈杰   first
39

123dbb81   徐泉   研学代码提交
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
  <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>
b9411514   陈杰   first
83
</mapper>