FileList.xml
3.33 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?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="cn.fw.rp.dao.FileListDao">
<!-- 查询数量 -->
<select id="selectCount" parameterType="QueryCriterion" resultType="java.lang.Integer">
select count(1) from file_list
<include refid="core.where_condition"/>
</select>
<!-- 查询,根据主键 -->
<select id="selectById" parameterType="Long" resultMap="fileListMap">
select *
from file_list
where id = #{id}
</select>
<select id="selectByFileId" parameterType="String" resultMap="fileListMap">
select *
from file_list
where file_id = #{fileId}
</select>
<!-- 查询列表,根据条件 -->
<select id="selectList" parameterType="QueryCriterion" resultMap="fileListMap">
select * from file_list
<include refid="core.where_condition"/>
<include refid="core.page_condition"/>
</select>
<!-- 更新,根据主键 -->
<update id="updateById" parameterType="FileList">
update file_list
<include refid="update_columns"/>
where id = #{t.id}
</update>
<!-- 更新列表,根据条件 -->
<update id="updateList">
update marketing_comment
<include refid="update_columns"/>
<include refid="core.where_condition_pre_con"/>
</update>
<!-- 新增 -->
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="FileList">
insert into file_list
(file_id,
file_name,
content_type,
upload_time,
upload_user,
file_path,
flag,
file_length)
values (#{fileId},
#{fileName},
#{contentType},
now(),
#{uploadUser},
#{filePath},
#{flag},
#{fileLength})
</insert>
<!-- 删除,根据主键 -->
<delete id="deleteById" parameterType="Long">
delete
from file_list
where id = #{id}
</delete>
<!-- 删除列表,根据条件 -->
<delete id="deleteList" parameterType="QueryCriterion">
delete from file_list
<include refid="core.where_condition"/>
</delete>
<!-- 查询结果集 -->
<resultMap id="fileListMap" type="FileList">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="file_id" jdbcType="INTEGER" property="fileId"/>
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
<result column="content_type" jdbcType="VARCHAR" property="contentType"/>
<result column="upload_time" jdbcType="VARCHAR" property="uploadTime"/>
<result column="upload_user" jdbcType="VARCHAR" property="uploadUser"/>
<result column="file_path" jdbcType="VARCHAR" property="filePath"/>
<result column="flag" jdbcType="INTEGER" property="flag"/>
<result column="file_length" jdbcType="INTEGER" property="fileLength"/>
</resultMap>
<!-- 更新字段列表 -->
<sql id="update_columns">
<set>
<if test="t.problemId != null"><![CDATA[problem_id = #{t.problemId},]]></if>
<if test="t.fileId != null"><![CDATA[file_id = #{t.fileId},]]></if>
</set>
</sql>
</mapper>