DudaoMapper.xml
7.47 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?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.subsidy.mapper.DudaoMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, cert_id
</sql>
<select id="vodClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
vod_play_history t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
</select>
<select id="examClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
exercise_done_result t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
</select>
<select id="answerClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
answering_question t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
</select>
<select id="imageClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
image_check_record t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
AND t.result = 1
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
AND t.delete_date IS NULL
</select>
<select id="dailyStudyInfo" resultType="com.subsidy.vo.renshe.DailyStudyInfoVO">
SELECT
t2.class_id as downCode,
t2.member_id,
t4.user_name as studentName,
t4.telephone as phone,
t4.id_card as identity,
t2.learnTime,
t2.playTime,
t5.loginTime
FROM
(
SELECT
t1.class_id,
t1.member_id,
sum( t1.play_length ) AS learnTime,
sum( t1.play_length + t1.suspend_length ) AS playTime
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND
t1.delete_date IS NULL
GROUP BY
t1.class_id,
t1.member_id
) t2
LEFT JOIN class_dict t3 ON t2.class_id = t3.id
LEFT JOIN company_dict t6 ON t3.company_id = t6.id
LEFT JOIN member t4 ON t2.member_id = t4.id
LEFT JOIN (
SELECT
t3.user_id,
login - logout AS loginTime
FROM
(
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS login
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND
t1.delete_date IS NULL
AND opr_type = "登出"
AND result = 1
GROUP BY user_id
) t3
LEFT JOIN (
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS logout
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND
t1.delete_date IS NULL
AND opr_type = "登录"
AND result = 1
GROUP BY user_id
) t2 ON t3.user_id = t2.user_id
) t5 ON t4.id = t5.user_id
<if test="classType != null and classType != ''">
where t3.class_type = #{classType}
</if>
and t6.area_name = '普陀'
</select>
<select id="dailyExamBasic" resultType="long">
SELECT DISTINCT
class_id
FROM
exercise_done_result t1
LEFT JOIN class_dict t2 ON t1.class_id = t2.id
LEFT JOIN company_dict t3 ON t2.company_id = t3.id
WHERE
t1.delete_date IS NULL
AND t2.class_type = #{classType}
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
and t3.area_name = '普陀'
</select>
<select id="dailyAnswer" resultType="com.subsidy.vo.renshe.DailyAnswerVO">
SELECT
t1.id,
t1.ask_id,
t2.id AS downCode,
t3.id_card AS identity,
UNIX_TIMESTAMP( t1.create_date )*1000 AS answer,
UNIX_TIMESTAMP( t1.update_date )*1000 AS question
FROM
answering_question t1
LEFT JOIN class_dict t2 ON t1.class_id = t2.id
LEFT JOIN member t3 ON t1.ask_id = t3.id
LEFT JOIN company_dict t4 ON t2.company_id = t4.id
WHERE
DATE_FORMAT( DATE_ADD( t1.update_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND
t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
and t2.class_type = #{classType}
and t4.area_name = '普陀'
</select>
<select id="newClasses" parameterType="string" resultType="long">
SELECT DISTINCT
t1.id
FROM
class_dict t1
LEFT JOIN company_dict t3 ON t1.company_id = t3.id
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
and t1.class_code is not NULL
<if test="classType != null and classType != ''">
and t1.class_type = #{classType}
</if>
and t3.area_name = '普陀'
</select>
</mapper>