Blame view

src/main/resources/mapper/UniversityMapper.xml 3.29 KB
b9411514   陈杰   first
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?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.UniversityMapper">

    <resultMap id="UniversityMap" type="com.sincere.student.model.University">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="code" property="code"/>
        <result column="university_type" property="universityType"/>
        <result column="department" property="department"/>
        <result column="province" property="province"/>
        <result column="city" property="city"/>
        <result column="level" property="level"/>
        <result column="create_time" property="createTime"/>
        <result column="phone" property="phone"/>
b246a387   陈杰   bug 修复
16
        <result column="logo_url" property="logoUrl"/>
b9411514   陈杰   first
17
18
    </resultMap>

123dbb81   徐泉   研学代码提交
19
20
    <select id="getListCount" parameterType="com.sincere.student.dto.UniversitySearchDto" resultType="java.lang.Integer">
        select count(0) from university_info
b9411514   陈杰   first
21
22
        <where>
            <if test="search != null and search != ''">
3c7f8a2c   陈杰   bug 修复
23
                and name like #{search}
b9411514   陈杰   first
24
25
26
27
28
29
30
31
            </if>
        </where>
    </select>

    <select id="getList" parameterType="com.sincere.student.dto.UniversitySearchDto" resultMap="UniversityMap">
        select * from university_info
        <where>
            <if test="search != null and search != ''">
3c7f8a2c   陈杰   bug 修复
32
                and name like #{search}
b9411514   陈杰   first
33
34
35
36
37
            </if>
        </where>
    </select>


fafdccdc   陈杰   bug 修复
38
39
40
41
42
    <select id="getById" parameterType="java.lang.Integer" resultMap="UniversityMap">
        select * from university_info where id = #{id}
    </select>

    <insert id="create" parameterType="com.sincere.student.model.University" >
123dbb81   徐泉   研学代码提交
43
44
45
46
47
        insert into university_info (name,code,university_type,department,province,city,level,create_time,phone,logo_url)
        values (#{name},#{code},#{universityType},#{department},#{province},#{city},#{level},GETDATE(),#{phone},#{logoUrl})
    </insert>

    <delete id="delete" parameterType="java.lang.Integer">
b9411514   陈杰   first
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
        delete university_info where id = #{id}
    </delete>

    <update id="update" parameterType="com.sincere.student.model.University">
        update university_info
        <trim prefix="set" suffixOverrides=",">
            <if test="name!=null">
                name=#{name},
            </if>
            <if test="code!=null">
                code=#{code},
            </if>
            <if test="universityType!=null">
                university_type=#{universityType},
            </if>
            <if test="department!=null">
                department=#{department},
            </if>
            <if test="province!=null">
                province=#{province},
            </if>
            <if test="city!=null">
                city=#{city},
            </if>
            <if test="level!=null">
                level=#{level},
            </if>
            <if test="phone!=null">
                phone=#{phone},
            </if>
            <if test="logoUrl!=null">
                logo_url=#{logoUrl},
            </if>
b246a387   陈杰   bug 修复
81
82
83
        </trim>
        where id = #{id}
    </update>
b9411514   陈杰   first
84
85
86
87
88
89

    <select id="selectByName" parameterType="java.lang.String" resultType="java.lang.Integer">
        select id from university_info where name = #{name}
    </select>

</mapper>
fafdccdc   陈杰   bug 修复

b9411514   陈杰   first