InformationSharingMapper.xml
3.96 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
<?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.trash.information_sharing.mapper.InformationSharingMapper">
<resultMap type="InformationSharing" id="InformationSharingResult">
<result property="id" column="id" />
<result property="dataHeader" column="data_header" />
<result property="retrieveDepartment" column="retrieve_department" />
<result property="retrieveTime" column="retrieve_time" />
<result property="retrieveContent" column="retrieve_content" />
<result property="attachmentLink" column="attachment_link" />
<result property="informationLink" column="information_link" />
</resultMap>
<sql id="selectInformationSharingVo">
select id, data_header, retrieve_department, retrieve_time, retrieve_content, attachment_link, information_link from information_sharing
</sql>
<select id="selectInformationSharingList" parameterType="InformationSharing" resultMap="InformationSharingResult">
<include refid="selectInformationSharingVo"/>
<where>
<if test="dataHeader != null and dataHeader != ''"> and data_header like concat('%', #{dataHeader}, '%')</if>
<if test="retrieveDepartment != null and retrieveDepartment != ''"> and retrieve_department like concat('%', #{retrieveDepartment}, '%')</if>
</where>
</select>
<select id="selectInformationSharingById" parameterType="Long" resultMap="InformationSharingResult">
<include refid="selectInformationSharingVo"/>
where id = #{id}
</select>
<insert id="insertInformationSharing" parameterType="InformationSharing" useGeneratedKeys="true" keyProperty="id">
insert into information_sharing
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dataHeader != null">data_header,</if>
<if test="retrieveDepartment != null">retrieve_department,</if>
<if test="retrieveTime != null">retrieve_time,</if>
<if test="retrieveContent != null">retrieve_content,</if>
<if test="attachmentLink != null">attachment_link,</if>
<if test="informationLink != null">information_link,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataHeader != null">#{dataHeader},</if>
<if test="retrieveDepartment != null">#{retrieveDepartment},</if>
<if test="retrieveTime != null">#{retrieveTime},</if>
<if test="retrieveContent != null">#{retrieveContent},</if>
<if test="attachmentLink != null">#{attachmentLink},</if>
<if test="informationLink != null">#{informationLink},</if>
</trim>
</insert>
<update id="updateInformationSharing" parameterType="InformationSharing">
update information_sharing
<trim prefix="SET" suffixOverrides=",">
<if test="dataHeader != null">data_header = #{dataHeader},</if>
<if test="retrieveDepartment != null">retrieve_department = #{retrieveDepartment},</if>
<if test="retrieveTime != null">retrieve_time = #{retrieveTime},</if>
<if test="retrieveContent != null">retrieve_content = #{retrieveContent},</if>
<if test="attachmentLink != null">attachment_link = #{attachmentLink},</if>
<if test="informationLink != null">information_link = #{informationLink},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInformationSharingById" parameterType="Long">
delete from information_sharing where id = #{id}
</delete>
<delete id="deleteInformationSharingByIds" parameterType="String">
delete from information_sharing where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>