ProblemList.xml
6.18 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?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.ProblemListDao">
<!-- 查询数量 -->
<select id="selectCount" parameterType="QueryCriterion" resultType="java.lang.Integer">
select count(1) from problem_list
<include refid="core.where_condition"/>
</select>
<!-- 查询,根据主键 -->
<select id="selectById" parameterType="Integer" resultMap="problemListMap">
select *
from problem_list
where id = #{id}
</select>
<select id="getFiles" resultMap="fileListMap">
SELECT
b.*
FROM
problem_file a
JOIN file_list b ON a.file_id = b.file_id
WHERE
1 = 1
<if test="flag !=null">
AND b.flag = #{flag}
</if>
<if test="problemId !=null">
AND a.problem_id = #{problemId}
</if>
order by b.upload_time desc
</select>
<select id="fileCount" parameterType="Integer" resultType="java.util.Map">
select flag,
count(b.file_id) as count
from problem_file a
join file_list b on a.file_id = b.file_id
where problem_id = #{problemId}
GROUP BY flag
</select>
<!-- 查询列表,根据条件 -->
<select id="selectList" parameterType="QueryCriterion" resultMap="problemListMap">
select * from problem_list
<include refid="core.where_condition"/>
<include refid="core.page_condition"/>
</select>
<!-- 更新,根据主键 -->
<update id="updateById" parameterType="ProblemList">
update problem_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="ProblemList">
insert into problem_list
(system_ref,
module_ref,
title,
content,
purpose,
question,
scenarios,
logic,
status,
create_time,
update_time,
create_user,
update_user)
values (#{systemRef},
#{moduleRef},
#{title},
#{content},
#{purpose},
#{question},
#{scenarios},
#{logic},
#{status},
now(),
#{updateTime},
#{createUser},
#{updateUser})
</insert>
<!-- 删除,根据主键 -->
<delete id="deleteById" parameterType="Long">
delete
from problem_list
where id = #{id}
</delete>
<!-- 删除列表,根据条件 -->
<delete id="deleteList" parameterType="QueryCriterion">
delete from problem_list
<include refid="core.where_condition"/>
</delete>
<!-- 查询结果集 -->
<resultMap id="problemListMap" type="ProblemList">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="system_ref" jdbcType="VARCHAR" property="systemRef"/>
<result column="module_ref" jdbcType="VARCHAR" property="moduleRef"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
<result column="purpose" jdbcType="VARCHAR" property="purpose"/>
<result column="question" jdbcType="VARCHAR" property="question"/>
<result column="scenarios" jdbcType="VARCHAR" property="scenarios"/>
<result column="logic" jdbcType="VARCHAR" property="logic"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_user" jdbcType="VARCHAR" property="createUser"/>
<result column="update_user" jdbcType="VARCHAR" property="updateUser"/>
</resultMap>
<!-- 查询结果集 -->
<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.systemRef != null"><![CDATA[system_ref = #{t.systemRef},]]></if>
<if test="t.moduleRef != null"><![CDATA[module_ref = #{t.moduleRef},]]></if>
<if test="t.title != null"><![CDATA[title=#{t.title},]]></if>
<if test="t.content != null"><![CDATA[content = #{t.content},]]></if>
<if test="t.purpose != null"><![CDATA[purpose = #{t.purpose},]]></if>
<if test="t.question != null"><![CDATA[question = #{t.question},]]></if>
<if test="t.scenarios != null"><![CDATA[scenarios = #{t.scenarios},]]></if>
<if test="t.logic != null"><![CDATA[logic = #{t.logic},]]></if>
<if test="t.status != null"><![CDATA[status = #{t.status},]]></if>
<if test="t.createTime != null"><![CDATA[create_time = #{t.createTime},]]></if>
<if test="t.updateTime != null"><![CDATA[update_time = #{t.updateTime},]]></if>
<if test="t.createUser != null"><![CDATA[create_user = #{t.createUser},]]></if>
<if test="t.updateUser != null"><![CDATA[update_user = #{t.updateUser},]]></if>
</set>
</sql>
</mapper>