linzhijie
2021-03-08 d26f0e81960986cef39db408440bbc3d0c56a853
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?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.ots.project.exam.mapper.TLibraryCodeMapper">
    
    <resultMap type="TLibraryCode" id="TLibraryCodeResult">
        <result property="id"    column="id"    />
        <result property="reportType"    column="report_type"    />
        <result property="libraryCode"    column="library_code"    />
        <result property="englistContent"    column="englist_content"    />
        <result property="chineseContent"    column="chinese_content"    />
        <result property="thaiContent"    column="thai_content"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="dictType"    column="dict_type"    />
        <result property="icon"    column="icon"    />
        <result property="remark"    column="remark"    />
    </resultMap>
 
    <sql id="selectTLibraryCodeVo">
        select id, report_type, library_code, englist_content, chinese_content, thai_content, create_by, create_time, update_by, update_time, dict_type,icon,remark from t_library_code
    </sql>
 
    <select id="selectTLibraryCodeList" parameterType="TLibraryCode" resultMap="TLibraryCodeResult">
        <include refid="selectTLibraryCodeVo"/>
        <where>  
            <if test="reportType != null  and reportType != ''"> and report_type = #{reportType}</if>
            <if test="libraryCode != null  and libraryCode != ''"> and library_code = #{libraryCode}</if>
        </where>
    </select>
    
    <select id="selectTLibraryCodeById" parameterType="Long" resultMap="TLibraryCodeResult">
        <include refid="selectTLibraryCodeVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTLibraryCode" parameterType="TLibraryCode" useGeneratedKeys="true" keyProperty="id">
        insert into t_library_code
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="reportType != null  and reportType != ''">report_type,</if>
            <if test="libraryCode != null  and libraryCode != ''">library_code,</if>
            <if test="englistContent != null  and englistContent != ''">englist_content,</if>
            <if test="chineseContent != null  and chineseContent != ''">chinese_content,</if>
            <if test="thaiContent != null  and thaiContent != ''">thai_content,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="dictType != null ">dict_type,</if>
            <if test="icon != null ">icon,</if>
            <if test="remark != null  and remark != ''">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="reportType != null  and reportType != ''">#{reportType},</if>
            <if test="libraryCode != null  and libraryCode != ''">#{libraryCode},</if>
            <if test="englistContent != null  and englistContent != ''">#{englistContent},</if>
            <if test="chineseContent != null  and chineseContent != ''">#{chineseContent},</if>
            <if test="thaiContent != null  and thaiContent != ''">#{thaiContent},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="dictType != null ">#{dictType},</if>
            <if test="icon != null ">#{icon},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
         </trim>
    </insert>
 
    <update id="updateTLibraryCode" parameterType="TLibraryCode">
        update t_library_code
        <trim prefix="SET" suffixOverrides=",">
            <if test="reportType != null  and reportType != ''">report_type = #{reportType},</if>
            <if test="libraryCode != null  and libraryCode != ''">library_code = #{libraryCode},</if>
            <if test="englistContent != null ">englist_content = #{englistContent},</if>
            <if test="chineseContent != null ">chinese_content = #{chineseContent},</if>
            <if test="thaiContent != null ">thai_content = #{thaiContent},</if>
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="dictType != null ">dict_type = #{dictType},</if>
            <if test="icon != null ">icon = #{icon},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteTLibraryCodeById" parameterType="Long">
        delete from t_library_code where id = #{id}
    </delete>
 
    <delete id="deleteTLibraryCodeByIds" parameterType="String">
        delete from t_library_code where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>