Commit 123dbb81af2931448d5de25d4925c4e5401a049a
1 parent
b7a828a7
Exists in
master
研学代码提交
Showing
87 changed files
with
1810 additions
and
1507 deletions
Show diff stats
src/main/java/com/sincere/student/Swagger2.java
... | ... | @@ -21,7 +21,7 @@ import java.util.List; |
21 | 21 | public class Swagger2 { |
22 | 22 | |
23 | 23 | @Bean |
24 | - public Docket createRestApi() { | |
24 | + public Docket createRestApi() { | |
25 | 25 | ParameterBuilder ticketPar = new ParameterBuilder(); |
26 | 26 | List<Parameter> pars = new ArrayList<Parameter>(); |
27 | 27 | ticketPar.name("X-Authorization").description("user token") |
... | ... | @@ -40,12 +40,13 @@ public class Swagger2 { |
40 | 40 | .build().globalOperationParameters(pars); |
41 | 41 | |
42 | 42 | } |
43 | - private ApiInfo apiInfo() { | |
43 | + | |
44 | + private ApiInfo apiInfo() { | |
44 | 45 | return new ApiInfoBuilder() |
45 | - .title("Spring Boot中使用Swagger2构建RESTful APIs") | |
46 | - .description("接口文档") | |
47 | - .termsOfServiceUrl("") | |
46 | + .title("Spring Boot中使用Swagger2构建RESTful APIs") | |
47 | + .description("接口文档") | |
48 | + .termsOfServiceUrl("") | |
48 | 49 | .version("1.0") |
49 | - .build(); | |
50 | - } | |
50 | + .build(); | |
51 | + } | |
51 | 52 | } | ... | ... |
src/main/java/com/sincere/student/access/MemberAccess.java
src/main/java/com/sincere/student/access/MemberInterceptor.java
... | ... | @@ -21,13 +21,13 @@ public class MemberInterceptor extends HandlerInterceptorAdapter { |
21 | 21 | if (handler instanceof HandlerMethod) { |
22 | 22 | |
23 | 23 | HandlerMethod myHandlerMethod = (HandlerMethod) handler; |
24 | - Method method= myHandlerMethod.getMethod(); | |
25 | - Annotation methodAnnotation=method.getAnnotation(MemberAccess.class);//方法上有该标记 | |
26 | - if(methodAnnotation != null){ | |
27 | - boolean isLogin = isLogin(request) ; | |
28 | - if(isLogin){ | |
24 | + Method method = myHandlerMethod.getMethod(); | |
25 | + Annotation methodAnnotation = method.getAnnotation(MemberAccess.class);//方法上有该标记 | |
26 | + if (methodAnnotation != null) { | |
27 | + boolean isLogin = isLogin(request); | |
28 | + if (isLogin) { | |
29 | 29 | return true; |
30 | - }else{//未登录 | |
30 | + } else {//未登录 | |
31 | 31 | //Ajax请求返回JSON |
32 | 32 | BaseDto repVo = new BaseDto(); |
33 | 33 | repVo.setSuccess(false); |
... | ... | @@ -43,18 +43,18 @@ public class MemberInterceptor extends HandlerInterceptorAdapter { |
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | |
46 | - private boolean isLogin(HttpServletRequest request) throws Exception{ | |
46 | + private boolean isLogin(HttpServletRequest request) throws Exception { | |
47 | 47 | try { |
48 | 48 | String token = request.getHeader("X-Authorization"); |
49 | - if( token != null){ | |
50 | - try{ | |
49 | + if (token != null) { | |
50 | + try { | |
51 | 51 | TokenUtils.validToken(token); |
52 | 52 | return true; |
53 | - }catch (ResultException e){ | |
53 | + } catch (ResultException e) { | |
54 | 54 | |
55 | 55 | } |
56 | 56 | } |
57 | - }catch (Exception e){ | |
57 | + } catch (Exception e) { | |
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | return false; | ... | ... |
src/main/java/com/sincere/student/controller/AdminController.java
... | ... | @@ -28,34 +28,34 @@ import java.util.List; |
28 | 28 | public class AdminController { |
29 | 29 | |
30 | 30 | @Autowired |
31 | - ColumnService columnService ; | |
31 | + ColumnService columnService; | |
32 | 32 | |
33 | 33 | @Autowired |
34 | - AdvertService advertService ; | |
34 | + AdvertService advertService; | |
35 | 35 | |
36 | 36 | @Autowired |
37 | - ArticleService articleService ; | |
37 | + ArticleService articleService; | |
38 | 38 | |
39 | 39 | @Autowired |
40 | - MajorService majorService ; | |
40 | + MajorService majorService; | |
41 | 41 | |
42 | 42 | @Autowired |
43 | - UniversityService universityService ; | |
43 | + UniversityService universityService; | |
44 | 44 | |
45 | 45 | @Autowired |
46 | 46 | ParameterService parameterService; |
47 | 47 | |
48 | 48 | @Autowired |
49 | - VideoService videoService ; | |
49 | + VideoService videoService; | |
50 | 50 | |
51 | 51 | @Autowired |
52 | - ConsultService consultService ; | |
52 | + ConsultService consultService; | |
53 | 53 | |
54 | 54 | @Autowired |
55 | - UserService userService ; | |
55 | + UserService userService; | |
56 | 56 | |
57 | 57 | @Autowired |
58 | - MessageService messageService ; | |
58 | + MessageService messageService; | |
59 | 59 | |
60 | 60 | @Autowired |
61 | 61 | SubmitService submitService; |
... | ... | @@ -65,68 +65,68 @@ public class AdminController { |
65 | 65 | */ |
66 | 66 | @MemberAccess |
67 | 67 | @ApiOperation("投档线列表接口") |
68 | - @RequestMapping(value = "/submit/getList" , method = RequestMethod.POST) | |
69 | - public BaseDto<Page<SubmitFile>> getFileList(@RequestBody MessageSearchDto messageSearchDto){ | |
68 | + @RequestMapping(value = "/submit/getList", method = RequestMethod.POST) | |
69 | + public BaseDto<Page<SubmitFile>> getFileList(@RequestBody MessageSearchDto messageSearchDto) { | |
70 | 70 | BaseDto<Page<SubmitFile>> result = new BaseDto<>(); |
71 | 71 | result.setData(submitService.getAdminList(messageSearchDto)); |
72 | - return result ; | |
72 | + return result; | |
73 | 73 | } |
74 | 74 | |
75 | 75 | @MemberAccess |
76 | 76 | @ApiOperation("投档线删除接口") |
77 | - @RequestMapping(value = "/submit/delete" , method = RequestMethod.POST) | |
78 | - public BaseDto deleteFile(@RequestBody IdDto idDto){ | |
77 | + @RequestMapping(value = "/submit/delete", method = RequestMethod.POST) | |
78 | + public BaseDto deleteFile(@RequestBody IdDto idDto) { | |
79 | 79 | BaseDto result = new BaseDto<>(); |
80 | 80 | submitService.delete(idDto.getId()); |
81 | - return result ; | |
81 | + return result; | |
82 | 82 | } |
83 | 83 | |
84 | 84 | @MemberAccess |
85 | 85 | @ApiOperation("投档线更新接口 ,如果文件没更新,fileUrl不用传") |
86 | - @RequestMapping(value = "/submit/update" , method = RequestMethod.POST) | |
87 | - public BaseDto updateFile(@RequestBody SubmitFile submitFile){ | |
86 | + @RequestMapping(value = "/submit/update", method = RequestMethod.POST) | |
87 | + public BaseDto updateFile(@RequestBody SubmitFile submitFile) { | |
88 | 88 | BaseDto result = new BaseDto<>(); |
89 | - if(!submitFile.getFileUrl().contains("xls")){ | |
90 | - result.setSuccess(false) ; | |
91 | - result.setMessage("请上传excel") ; | |
92 | - return result ; | |
89 | + if (!submitFile.getFileUrl().contains("xls")) { | |
90 | + result.setSuccess(false); | |
91 | + result.setMessage("请上传excel"); | |
92 | + return result; | |
93 | 93 | } |
94 | - try{ | |
94 | + try { | |
95 | 95 | SubmitFile beforeFile = submitService.getById(submitFile.getId()); |
96 | - if(beforeFile.getFileUrl().equals(submitFile.getFileUrl())){ | |
96 | + if (beforeFile.getFileUrl().equals(submitFile.getFileUrl())) { | |
97 | 97 | submitFile.setFileUrl(null); |
98 | - }else { | |
98 | + } else { | |
99 | 99 | List<Point> list = ExcelUtils.analysisExcel(submitFile.getFileUrl()); |
100 | 100 | submitFile.setList(list); |
101 | 101 | } |
102 | 102 | submitService.update(submitFile); |
103 | - }catch (ResultException e){ | |
103 | + } catch (ResultException e) { | |
104 | 104 | result.setSuccess(false); |
105 | 105 | result.setMessage(e.getMessage()); |
106 | 106 | } |
107 | - return result ; | |
107 | + return result; | |
108 | 108 | } |
109 | 109 | |
110 | 110 | @MemberAccess |
111 | 111 | @ApiOperation("投档线创建接口") |
112 | - @RequestMapping(value = "/submit/createFile" , method = RequestMethod.POST) | |
113 | - public BaseDto createFile(@RequestBody SubmitFile submitFile){ | |
112 | + @RequestMapping(value = "/submit/createFile", method = RequestMethod.POST) | |
113 | + public BaseDto createFile(@RequestBody SubmitFile submitFile) { | |
114 | 114 | BaseDto result = new BaseDto(); |
115 | - if(!submitFile.getFileUrl().contains("xls")){ | |
115 | + if (!submitFile.getFileUrl().contains("xls")) { | |
116 | 116 | result.setSuccess(false); |
117 | 117 | result.setMessage("请上传excel"); |
118 | - return result ; | |
118 | + return result; | |
119 | 119 | } |
120 | - try{ | |
120 | + try { | |
121 | 121 | List<Point> list = ExcelUtils.analysisExcel(submitFile.getFileUrl()); |
122 | 122 | submitFile.setList(list); |
123 | 123 | submitService.create(submitFile); |
124 | - }catch (ResultException e){ | |
124 | + } catch (ResultException e) { | |
125 | 125 | e.printStackTrace(); |
126 | 126 | result.setSuccess(false); |
127 | 127 | result.setMessage(e.getMessage()); |
128 | 128 | } |
129 | - return result ; | |
129 | + return result; | |
130 | 130 | } |
131 | 131 | |
132 | 132 | |
... | ... | @@ -135,73 +135,73 @@ public class AdminController { |
135 | 135 | */ |
136 | 136 | @MemberAccess |
137 | 137 | @ApiOperation("留言板列表接口") |
138 | - @RequestMapping(value = "/message/getList" , method = RequestMethod.POST) | |
139 | - public BaseDto<Page<Message>> getMessageList(@RequestBody MessageSearchDto messageSearchDto){ | |
138 | + @RequestMapping(value = "/message/getList", method = RequestMethod.POST) | |
139 | + public BaseDto<Page<Message>> getMessageList(@RequestBody MessageSearchDto messageSearchDto) { | |
140 | 140 | BaseDto<Page<Message>> result = new BaseDto<>(); |
141 | 141 | result.setData(messageService.getList(messageSearchDto)); |
142 | - return result ; | |
142 | + return result; | |
143 | 143 | } |
144 | 144 | |
145 | 145 | @MemberAccess |
146 | 146 | @ApiOperation("留言板详情,管理回复 接口") |
147 | - @RequestMapping(value = "/message/getDetail" , method = RequestMethod.POST) | |
148 | - public BaseDto<Message> getMessageDetail(@RequestBody IdDto idDto){ | |
147 | + @RequestMapping(value = "/message/getDetail", method = RequestMethod.POST) | |
148 | + public BaseDto<Message> getMessageDetail(@RequestBody IdDto idDto) { | |
149 | 149 | BaseDto<Message> result = new BaseDto<>(); |
150 | 150 | result.setData(messageService.getDetail(idDto.getId())); |
151 | - return result ; | |
151 | + return result; | |
152 | 152 | } |
153 | 153 | |
154 | 154 | @MemberAccess |
155 | 155 | @ApiOperation("回复接口") |
156 | - @RequestMapping(value = "/message/reply" , method = RequestMethod.POST) | |
157 | - public BaseDto getMessageDetail(@RequestBody Reply reply){ | |
156 | + @RequestMapping(value = "/message/reply", method = RequestMethod.POST) | |
157 | + public BaseDto getMessageDetail(@RequestBody Reply reply) { | |
158 | 158 | messageService.reply(reply); |
159 | - return new BaseDto() ; | |
159 | + return new BaseDto(); | |
160 | 160 | } |
161 | 161 | |
162 | 162 | @MemberAccess |
163 | 163 | @ApiOperation("删除某个回复 接口") |
164 | - @RequestMapping(value = "/message/deleteReply" , method = RequestMethod.POST) | |
165 | - public BaseDto<Message> deleteReply(@RequestBody IdDto idDto){ | |
164 | + @RequestMapping(value = "/message/deleteReply", method = RequestMethod.POST) | |
165 | + public BaseDto<Message> deleteReply(@RequestBody IdDto idDto) { | |
166 | 166 | messageService.deleteReply(idDto.getId()); |
167 | - return new BaseDto<>() ; | |
167 | + return new BaseDto<>(); | |
168 | 168 | } |
169 | 169 | |
170 | 170 | @MemberAccess |
171 | 171 | @ApiOperation("删除留言 接口") |
172 | - @RequestMapping(value = "/message/deleteMessage" , method = RequestMethod.POST) | |
173 | - public BaseDto<Message> deleteMessage(@RequestBody IdDto idDto){ | |
172 | + @RequestMapping(value = "/message/deleteMessage", method = RequestMethod.POST) | |
173 | + public BaseDto<Message> deleteMessage(@RequestBody IdDto idDto) { | |
174 | 174 | messageService.deleteMessage(idDto.getId()); |
175 | - return new BaseDto<>() ; | |
175 | + return new BaseDto<>(); | |
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
179 | 179 | * 登录 修改密码 |
180 | 180 | */ |
181 | 181 | @ApiOperation("登录") |
182 | - @RequestMapping(value = "/login" , method = RequestMethod.POST) | |
183 | - public BaseDto<String> login(@RequestBody SysUser sysUser){ | |
184 | - BaseDto<String> result = new BaseDto<>() ; | |
185 | - SysUser user = userService.getByUser(); | |
186 | - if(user.getUserName().equals(sysUser.getUserName()) && user.getPassword().equals(sysUser.getPassword())){ | |
187 | - String token = TokenUtils.buildToken(user.getUserName()); | |
188 | - result.setData(token); | |
189 | - }else { | |
190 | - result.setSuccess(false); | |
191 | - result.setMessage("账号密码错误"); | |
192 | - } | |
193 | - return result ; | |
182 | + @RequestMapping(value = "/login", method = RequestMethod.POST) | |
183 | + public BaseDto<String> login(@RequestBody SysUser sysUser) { | |
184 | + BaseDto<String> result = new BaseDto<>(); | |
185 | + SysUser user = userService.getByUser(); | |
186 | + if (user.getUserName().equals(sysUser.getUserName()) && user.getPassword().equals(sysUser.getPassword())) { | |
187 | + String token = TokenUtils.buildToken(user.getUserName()); | |
188 | + result.setData(token); | |
189 | + } else { | |
190 | + result.setSuccess(false); | |
191 | + result.setMessage("账号密码错误"); | |
192 | + } | |
193 | + return result; | |
194 | 194 | } |
195 | 195 | |
196 | 196 | @MemberAccess |
197 | 197 | @ApiOperation("修改密码") |
198 | - @RequestMapping(value = "/updatePassword" , method = RequestMethod.POST) | |
199 | - public BaseDto updatePassword(@RequestBody SysUser sysUser){ | |
200 | - BaseDto result = new BaseDto() ; | |
198 | + @RequestMapping(value = "/updatePassword", method = RequestMethod.POST) | |
199 | + public BaseDto updatePassword(@RequestBody SysUser sysUser) { | |
200 | + BaseDto result = new BaseDto(); | |
201 | 201 | SysUser user = userService.getByUser(); |
202 | 202 | user.setPassword(sysUser.getPassword()); |
203 | 203 | userService.update(sysUser); |
204 | - return result ; | |
204 | + return result; | |
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
... | ... | @@ -209,65 +209,65 @@ public class AdminController { |
209 | 209 | */ |
210 | 210 | @MemberAccess |
211 | 211 | @ApiOperation("获取招生咨询会相关接口") |
212 | - @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) | |
213 | - public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ | |
214 | - BaseDto<Page<Consult>> result = new BaseDto<>() ; | |
212 | + @RequestMapping(value = "/consult/getList", method = RequestMethod.POST) | |
213 | + public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto) { | |
214 | + BaseDto<Page<Consult>> result = new BaseDto<>(); | |
215 | 215 | consultSearchDto.setStatus(0); |
216 | 216 | consultSearchDto.setColumnType(-1); |
217 | 217 | Page<Consult> page = consultService.getList(consultSearchDto); |
218 | 218 | result.setData(page); |
219 | - return result ; | |
219 | + return result; | |
220 | 220 | } |
221 | 221 | |
222 | 222 | @MemberAccess |
223 | 223 | @ApiOperation("获取招生咨询会详情相关接口") |
224 | - @RequestMapping(value = "/consult/getDetail" , method = RequestMethod.POST) | |
225 | - public BaseDto<Consult> getConsultDetail(@RequestBody IdDto idDto){ | |
226 | - BaseDto<Consult> result = new BaseDto<>() ; | |
224 | + @RequestMapping(value = "/consult/getDetail", method = RequestMethod.POST) | |
225 | + public BaseDto<Consult> getConsultDetail(@RequestBody IdDto idDto) { | |
226 | + BaseDto<Consult> result = new BaseDto<>(); | |
227 | 227 | result.setData(consultService.getDetail(idDto.getId())); |
228 | - return result ; | |
228 | + return result; | |
229 | 229 | } |
230 | 230 | |
231 | 231 | @MemberAccess |
232 | 232 | @ApiOperation("新建招生咨询会相关接口") |
233 | - @RequestMapping(value = "/consult/createConsult" , method = RequestMethod.POST) | |
234 | - public BaseDto<ReturnDto> createConsult(@RequestBody UniversityConsult universityConsult){ | |
235 | - BaseDto<ReturnDto> result = new BaseDto() ; | |
233 | + @RequestMapping(value = "/consult/createConsult", method = RequestMethod.POST) | |
234 | + public BaseDto<ReturnDto> createConsult(@RequestBody UniversityConsult universityConsult) { | |
235 | + BaseDto<ReturnDto> result = new BaseDto(); | |
236 | 236 | ReturnDto dto = new ReturnDto(); |
237 | - List<Consult> list = consultService.selectByUniversityIdAndColumnType(universityConsult.getUniversityId(),universityConsult.getColumnType()); | |
238 | - if(list != null && list.size() > 0){ | |
237 | + List<Consult> list = consultService.selectByUniversityIdAndColumnType(universityConsult.getUniversityId(), universityConsult.getColumnType()); | |
238 | + if (list != null && list.size() > 0) { | |
239 | 239 | result.setSuccess(false); |
240 | 240 | result.setMessage("同一栏目下,已有该学校招生咨询"); |
241 | - }else { | |
241 | + } else { | |
242 | 242 | int id = consultService.create(universityConsult); |
243 | - try{ | |
243 | + try { | |
244 | 244 | String name = universityService.getById(universityConsult.getUniversityId()).getName(); |
245 | 245 | dto.setName(name); |
246 | - }catch (Exception e){ | |
246 | + } catch (Exception e) { | |
247 | 247 | |
248 | 248 | } |
249 | 249 | dto.setId(id); |
250 | 250 | result.setData(dto); |
251 | 251 | } |
252 | - return result ; | |
252 | + return result; | |
253 | 253 | } |
254 | 254 | |
255 | 255 | @MemberAccess |
256 | 256 | @ApiOperation("修改招生咨询会相关接口") |
257 | - @RequestMapping(value = "/consult/updateConsult" , method = RequestMethod.POST) | |
258 | - public BaseDto updateConsult(@RequestBody UniversityConsult universityConsult){ | |
259 | - BaseDto result = new BaseDto() ; | |
257 | + @RequestMapping(value = "/consult/updateConsult", method = RequestMethod.POST) | |
258 | + public BaseDto updateConsult(@RequestBody UniversityConsult universityConsult) { | |
259 | + BaseDto result = new BaseDto(); | |
260 | 260 | consultService.update(universityConsult); |
261 | - return result ; | |
261 | + return result; | |
262 | 262 | } |
263 | 263 | |
264 | 264 | @MemberAccess |
265 | 265 | @ApiOperation("删除招生咨询会(传主键)") |
266 | - @RequestMapping(value = "/consult/delete" , method = RequestMethod.POST) | |
267 | - public BaseDto deleteConsult(@RequestBody IdDto idDto){ | |
268 | - BaseDto result = new BaseDto() ; | |
266 | + @RequestMapping(value = "/consult/delete", method = RequestMethod.POST) | |
267 | + public BaseDto deleteConsult(@RequestBody IdDto idDto) { | |
268 | + BaseDto result = new BaseDto(); | |
269 | 269 | consultService.delete(idDto.getId()); |
270 | - return result ; | |
270 | + return result; | |
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
... | ... | @@ -275,49 +275,49 @@ public class AdminController { |
275 | 275 | */ |
276 | 276 | @MemberAccess |
277 | 277 | @ApiOperation("获取视频相关接口") |
278 | - @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) | |
279 | - public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ | |
280 | - BaseDto<Page<Video>> result = new BaseDto<>() ; | |
278 | + @RequestMapping(value = "/video/getList", method = RequestMethod.POST) | |
279 | + public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto) { | |
280 | + BaseDto<Page<Video>> result = new BaseDto<>(); | |
281 | 281 | Page<Video> page = videoService.getList(videoSearchDto); |
282 | 282 | result.setData(page); |
283 | - System.out.println("result:"+result.toString()+"----------page:"+page.toString()); | |
284 | - return result ; | |
283 | + System.out.println("result:" + result.toString() + "----------page:" + page.toString()); | |
284 | + return result; | |
285 | 285 | } |
286 | 286 | |
287 | 287 | @MemberAccess |
288 | 288 | @ApiOperation("新建视频相关接口") |
289 | - @RequestMapping(value = "/video/createVideo" , method = RequestMethod.POST) | |
290 | - public BaseDto<ReturnDto> createVideo(@RequestBody Video video){ | |
291 | - BaseDto<ReturnDto> result = new BaseDto() ; | |
289 | + @RequestMapping(value = "/video/createVideo", method = RequestMethod.POST) | |
290 | + public BaseDto<ReturnDto> createVideo(@RequestBody Video video) { | |
291 | + BaseDto<ReturnDto> result = new BaseDto(); | |
292 | 292 | ReturnDto dto = new ReturnDto(); |
293 | 293 | int id = videoService.create(video); |
294 | - try{ | |
294 | + try { | |
295 | 295 | String name = universityService.getById(video.getUniversityId()).getName(); |
296 | 296 | dto.setName(name); |
297 | 297 | dto.setId(video.getUniversityId()); |
298 | - }catch (Exception e){ | |
298 | + } catch (Exception e) { | |
299 | 299 | |
300 | 300 | } |
301 | 301 | result.setData(dto); |
302 | - return result ; | |
302 | + return result; | |
303 | 303 | } |
304 | 304 | |
305 | 305 | @MemberAccess |
306 | 306 | @ApiOperation("修改视频相关接口") |
307 | - @RequestMapping(value = "/video/updateVideo" , method = RequestMethod.POST) | |
308 | - public BaseDto updateVideo(@RequestBody Video video){ | |
309 | - BaseDto result = new BaseDto() ; | |
307 | + @RequestMapping(value = "/video/updateVideo", method = RequestMethod.POST) | |
308 | + public BaseDto updateVideo(@RequestBody Video video) { | |
309 | + BaseDto result = new BaseDto(); | |
310 | 310 | videoService.update(video); |
311 | - return result ; | |
311 | + return result; | |
312 | 312 | } |
313 | 313 | |
314 | 314 | @MemberAccess |
315 | 315 | @ApiOperation("删除视频(传主键)") |
316 | - @RequestMapping(value = "/video/delete" , method = RequestMethod.POST) | |
317 | - public BaseDto deleteVideo(@RequestBody IdDto idDto){ | |
318 | - BaseDto result = new BaseDto() ; | |
316 | + @RequestMapping(value = "/video/delete", method = RequestMethod.POST) | |
317 | + public BaseDto deleteVideo(@RequestBody IdDto idDto) { | |
318 | + BaseDto result = new BaseDto(); | |
319 | 319 | videoService.delete(idDto.getId()); |
320 | - return result ; | |
320 | + return result; | |
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
... | ... | @@ -325,35 +325,35 @@ public class AdminController { |
325 | 325 | */ |
326 | 326 | @MemberAccess |
327 | 327 | @ApiOperation("联系我们") |
328 | - @RequestMapping(value = "/linkUs/getLinkUs" , method = RequestMethod.POST) | |
329 | - public BaseDto<String> getLinkUs(){ | |
328 | + @RequestMapping(value = "/linkUs/getLinkUs", method = RequestMethod.POST) | |
329 | + public BaseDto<String> getLinkUs() { | |
330 | 330 | BaseDto<String> result = new BaseDto<>(); |
331 | - Parameter parameter = parameterService.getByCode(ParameterUtils.link_us) ; | |
332 | - if(parameter != null){ | |
331 | + Parameter parameter = parameterService.getByCode(ParameterUtils.link_us); | |
332 | + if (parameter != null) { | |
333 | 333 | result.setData(parameter.getMessage()); |
334 | - }else { | |
334 | + } else { | |
335 | 335 | result.setSuccess(false); |
336 | 336 | result.setMessage("还未设置联系我们的图片"); |
337 | 337 | } |
338 | - return result ; | |
338 | + return result; | |
339 | 339 | } |
340 | 340 | |
341 | 341 | @MemberAccess |
342 | 342 | @ApiOperation("更新联系我们") |
343 | - @RequestMapping(value = "/linkUs/updateLinkUs" , method = RequestMethod.POST) | |
344 | - public BaseDto updateLinkUs(@RequestBody LinkUsDto dto){ | |
343 | + @RequestMapping(value = "/linkUs/updateLinkUs", method = RequestMethod.POST) | |
344 | + public BaseDto updateLinkUs(@RequestBody LinkUsDto dto) { | |
345 | 345 | BaseDto result = new BaseDto<>(); |
346 | - Parameter parameter = parameterService.getByCode(ParameterUtils.link_us) ; | |
347 | - if(parameter == null){ | |
346 | + Parameter parameter = parameterService.getByCode(ParameterUtils.link_us); | |
347 | + if (parameter == null) { | |
348 | 348 | parameter = new Parameter(); |
349 | 349 | parameter.setCode(ParameterUtils.link_us); |
350 | 350 | parameter.setMessage(dto.getUrl()); |
351 | 351 | parameterService.create(parameter); |
352 | - }else { | |
352 | + } else { | |
353 | 353 | parameter.setMessage(dto.getUrl()); |
354 | 354 | parameterService.update(parameter); |
355 | 355 | } |
356 | - return result ; | |
356 | + return result; | |
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
... | ... | @@ -361,43 +361,43 @@ public class AdminController { |
361 | 361 | */ |
362 | 362 | @MemberAccess |
363 | 363 | @ApiOperation("获取高校相关接口") |
364 | - @RequestMapping(value = "/university/getUniversityList" , method = RequestMethod.POST) | |
365 | - public BaseDto<Page<University>> getUniversityList(@RequestBody UniversitySearchDto universitySearchDto){ | |
366 | - BaseDto<Page<University>> result = new BaseDto<>() ; | |
364 | + @RequestMapping(value = "/university/getUniversityList", method = RequestMethod.POST) | |
365 | + public BaseDto<Page<University>> getUniversityList(@RequestBody UniversitySearchDto universitySearchDto) { | |
366 | + BaseDto<Page<University>> result = new BaseDto<>(); | |
367 | 367 | Page<University> page = universityService.getList(universitySearchDto); |
368 | 368 | result.setData(page); |
369 | - return result ; | |
369 | + return result; | |
370 | 370 | } |
371 | 371 | |
372 | 372 | @MemberAccess |
373 | 373 | @ApiOperation("创建高校相关接口") |
374 | - @RequestMapping(value = "/university/createUniversity" , method = RequestMethod.POST) | |
375 | - public BaseDto createUniversity(@RequestBody University university){ | |
374 | + @RequestMapping(value = "/university/createUniversity", method = RequestMethod.POST) | |
375 | + public BaseDto createUniversity(@RequestBody University university) { | |
376 | 376 | universityService.create(university); |
377 | - return new BaseDto() ; | |
377 | + return new BaseDto(); | |
378 | 378 | } |
379 | 379 | |
380 | 380 | @MemberAccess |
381 | 381 | @ApiOperation("更新高校相关接口") |
382 | - @RequestMapping(value = "/university/updateUniversity" , method = RequestMethod.POST) | |
383 | - public BaseDto updateUniversity(@RequestBody University university){ | |
382 | + @RequestMapping(value = "/university/updateUniversity", method = RequestMethod.POST) | |
383 | + public BaseDto updateUniversity(@RequestBody University university) { | |
384 | 384 | universityService.update(university); |
385 | - return new BaseDto() ; | |
385 | + return new BaseDto(); | |
386 | 386 | } |
387 | 387 | |
388 | 388 | @MemberAccess |
389 | 389 | @ApiOperation("删除高校相关接口") |
390 | - @RequestMapping(value = "/university/delete" , method = RequestMethod.POST) | |
391 | - public BaseDto deleteUniversity(@RequestBody IdDto idDto){ | |
392 | - BaseDto result = new BaseDto() ; | |
390 | + @RequestMapping(value = "/university/delete", method = RequestMethod.POST) | |
391 | + public BaseDto deleteUniversity(@RequestBody IdDto idDto) { | |
392 | + BaseDto result = new BaseDto(); | |
393 | 393 | universityService.delete(idDto.getId()); |
394 | - return result ; | |
394 | + return result; | |
395 | 395 | } |
396 | 396 | |
397 | 397 | @MemberAccess |
398 | 398 | @ApiOperation("高校添加专业相关接口") |
399 | - @RequestMapping(value = "/university/addMajor" , method = RequestMethod.POST) | |
400 | - public BaseDto addMajor(@RequestBody List<UniversityMajor> list){ | |
399 | + @RequestMapping(value = "/university/addMajor", method = RequestMethod.POST) | |
400 | + public BaseDto addMajor(@RequestBody List<UniversityMajor> list) { | |
401 | 401 | universityService.addMajor(list); |
402 | 402 | return new BaseDto(); |
403 | 403 | } |
... | ... | @@ -407,102 +407,101 @@ public class AdminController { |
407 | 407 | */ |
408 | 408 | @MemberAccess |
409 | 409 | @ApiOperation("获取专业相关接口") |
410 | - @RequestMapping(value = "/major/getMajorList" , method = RequestMethod.POST) | |
411 | - public BaseDto<Page<Major>> getMajorList(@RequestBody MajorSearchDto majorSearchDto){ | |
410 | + @RequestMapping(value = "/major/getMajorList", method = RequestMethod.POST) | |
411 | + public BaseDto<Page<Major>> getMajorList(@RequestBody MajorSearchDto majorSearchDto) { | |
412 | 412 | BaseDto<Page<Major>> result = new BaseDto<>(); |
413 | 413 | Page<Major> page = majorService.getList(majorSearchDto); |
414 | 414 | result.setData(page); |
415 | - return result ; | |
415 | + return result; | |
416 | 416 | } |
417 | 417 | |
418 | 418 | @MemberAccess |
419 | 419 | @ApiOperation("获取专业列表 一级二级关系列表") |
420 | - @RequestMapping(value = "/major/getList" , method = RequestMethod.POST) | |
421 | - public BaseDto<List<Major>> majorGetList(){ | |
420 | + @RequestMapping(value = "/major/getList", method = RequestMethod.POST) | |
421 | + public BaseDto<List<Major>> majorGetList() { | |
422 | 422 | BaseDto<List<Major>> result = new BaseDto<>(); |
423 | 423 | result.setData(majorService.selectMajor()); |
424 | - return result ; | |
424 | + return result; | |
425 | 425 | } |
426 | 426 | |
427 | 427 | @MemberAccess |
428 | 428 | @ApiOperation("新增专业相关接口") |
429 | - @RequestMapping(value = "/major/createMajor" , method = RequestMethod.POST) | |
430 | - public BaseDto createMajor(@RequestBody Major major){ | |
429 | + @RequestMapping(value = "/major/createMajor", method = RequestMethod.POST) | |
430 | + public BaseDto createMajor(@RequestBody Major major) { | |
431 | 431 | majorService.create(major); |
432 | - return new BaseDto() ; | |
432 | + return new BaseDto(); | |
433 | 433 | } |
434 | 434 | |
435 | 435 | @MemberAccess |
436 | 436 | @ApiOperation("修改专业相关接口") |
437 | - @RequestMapping(value = "/major/updateMajor" , method = RequestMethod.POST) | |
438 | - public BaseDto updateMajor(@RequestBody Major major){ | |
437 | + @RequestMapping(value = "/major/updateMajor", method = RequestMethod.POST) | |
438 | + public BaseDto updateMajor(@RequestBody Major major) { | |
439 | 439 | BaseDto result = new BaseDto(); |
440 | 440 | Major before = majorService.getById(major.getId()); |
441 | - if(before.getPid() == -1 && major.getPid() != -1){ | |
441 | + if (before.getPid() == -1 && major.getPid() != -1) { | |
442 | 442 | result.setSuccess(false); |
443 | 443 | result.setMessage("一级专业不能被设置成二级"); |
444 | - }else { | |
444 | + } else { | |
445 | 445 | majorService.update(major); |
446 | 446 | } |
447 | - return result ; | |
447 | + return result; | |
448 | 448 | } |
449 | 449 | |
450 | 450 | @MemberAccess |
451 | 451 | @ApiOperation("删除专业相关接口") |
452 | - @RequestMapping(value = "/major/delete" , method = RequestMethod.POST) | |
453 | - public BaseDto deleteMajor(@RequestBody IdDto idDto){ | |
454 | - BaseDto result = new BaseDto() ; | |
452 | + @RequestMapping(value = "/major/delete", method = RequestMethod.POST) | |
453 | + public BaseDto deleteMajor(@RequestBody IdDto idDto) { | |
454 | + BaseDto result = new BaseDto(); | |
455 | 455 | majorService.delete(idDto.getId()); |
456 | - return result ; | |
456 | + return result; | |
457 | 457 | } |
458 | 458 | |
459 | 459 | |
460 | - | |
461 | 460 | /** |
462 | - *权威解读(文章广告)相关接口 | |
461 | + * 权威解读(文章广告)相关接口 | |
463 | 462 | */ |
464 | 463 | @MemberAccess |
465 | 464 | @ApiOperation("获取权威解读(文章广告)相关接口") |
466 | - @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) | |
467 | - public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ | |
468 | - BaseDto<Page<Article>> result = new BaseDto<>() ; | |
465 | + @RequestMapping(value = "/article/getList", method = RequestMethod.POST) | |
466 | + public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto) { | |
467 | + BaseDto<Page<Article>> result = new BaseDto<>(); | |
469 | 468 | articleSearchDto.setStatus(0); |
470 | 469 | Page<Article> page = articleService.getAdminList(articleSearchDto); |
471 | 470 | result.setData(page); |
472 | - return result ; | |
471 | + return result; | |
473 | 472 | } |
474 | 473 | |
475 | 474 | @MemberAccess |
476 | 475 | @ApiOperation("新建权威解读(文章广告)相关接口") |
477 | - @RequestMapping(value = "/article/createArticle" , method = RequestMethod.POST) | |
478 | - public BaseDto<Integer> createArticle(@RequestBody Article article){ | |
479 | - BaseDto<Integer> result = new BaseDto() ; | |
480 | - if(StringUtils.isBlank(article.getImageUrl())){ | |
476 | + @RequestMapping(value = "/article/createArticle", method = RequestMethod.POST) | |
477 | + public BaseDto<Integer> createArticle(@RequestBody Article article) { | |
478 | + BaseDto<Integer> result = new BaseDto(); | |
479 | + if (StringUtils.isBlank(article.getImageUrl())) { | |
481 | 480 | result.setSuccess(false); |
482 | 481 | result.setMessage("请上传封面图片"); |
483 | - }else { | |
482 | + } else { | |
484 | 483 | int id = articleService.create(article); |
485 | 484 | result.setData(id); |
486 | 485 | } |
487 | - return result ; | |
486 | + return result; | |
488 | 487 | } |
489 | 488 | |
490 | 489 | @MemberAccess |
491 | 490 | @ApiOperation("修改权威解读(文章广告)相关接口") |
492 | - @RequestMapping(value = "/article/updateArticle" , method = RequestMethod.POST) | |
493 | - public BaseDto updateArticle(@RequestBody Article article){ | |
494 | - BaseDto result = new BaseDto() ; | |
491 | + @RequestMapping(value = "/article/updateArticle", method = RequestMethod.POST) | |
492 | + public BaseDto updateArticle(@RequestBody Article article) { | |
493 | + BaseDto result = new BaseDto(); | |
495 | 494 | articleService.update(article); |
496 | - return result ; | |
495 | + return result; | |
497 | 496 | } |
498 | 497 | |
499 | 498 | @MemberAccess |
500 | 499 | @ApiOperation("删除权威解读(文章广告)(传主键)") |
501 | - @RequestMapping(value = "/article/delete" , method = RequestMethod.POST) | |
502 | - public BaseDto deleteArticle(@RequestBody IdDto idDto){ | |
503 | - BaseDto result = new BaseDto() ; | |
500 | + @RequestMapping(value = "/article/delete", method = RequestMethod.POST) | |
501 | + public BaseDto deleteArticle(@RequestBody IdDto idDto) { | |
502 | + BaseDto result = new BaseDto(); | |
504 | 503 | articleService.delete(idDto.getId()); |
505 | - return result ; | |
504 | + return result; | |
506 | 505 | } |
507 | 506 | |
508 | 507 | |
... | ... | @@ -511,76 +510,76 @@ public class AdminController { |
511 | 510 | */ |
512 | 511 | @MemberAccess |
513 | 512 | @ApiOperation("获取开屏图片") |
514 | - @RequestMapping(value = "/advert/getScreen" , method = RequestMethod.POST) | |
515 | - public BaseDto<Advert> getScreen(){ | |
516 | - BaseDto<Advert> result = new BaseDto<>() ; | |
513 | + @RequestMapping(value = "/advert/getScreen", method = RequestMethod.POST) | |
514 | + public BaseDto<Advert> getScreen() { | |
515 | + BaseDto<Advert> result = new BaseDto<>(); | |
517 | 516 | result.setData(advertService.getScreen()); |
518 | - return result ; | |
517 | + return result; | |
519 | 518 | } |
520 | 519 | |
521 | 520 | @MemberAccess |
522 | 521 | @ApiOperation("更新上传开屏图片") |
523 | - @RequestMapping(value = "/advert/updateScreen" , method = RequestMethod.POST) | |
524 | - public BaseDto updateScreen(@RequestBody LinkUsDto dto){ | |
525 | - Advert advert = advertService.getScreen() ; | |
526 | - if(advert == null){ | |
527 | - Advert temp =new Advert(); | |
522 | + @RequestMapping(value = "/advert/updateScreen", method = RequestMethod.POST) | |
523 | + public BaseDto updateScreen(@RequestBody LinkUsDto dto) { | |
524 | + Advert advert = advertService.getScreen(); | |
525 | + if (advert == null) { | |
526 | + Advert temp = new Advert(); | |
528 | 527 | temp.setSort(1); |
529 | 528 | temp.setType(AdvertEnums.screen.getType()); |
530 | 529 | temp.setImgUrl(dto.getUrl()); |
531 | 530 | temp.setUrlLink(dto.getUrlLink()); |
532 | 531 | advertService.create(temp); |
533 | - }else { | |
534 | - if(StringUtils.isNotBlank(dto.getUrl())){ | |
532 | + } else { | |
533 | + if (StringUtils.isNotBlank(dto.getUrl())) { | |
535 | 534 | advert.setImgUrl(dto.getUrl()); |
536 | 535 | } |
537 | 536 | advert.setUrlLink(dto.getUrlLink()); |
538 | 537 | advertService.update(advert); |
539 | 538 | } |
540 | - return new BaseDto() ; | |
539 | + return new BaseDto(); | |
541 | 540 | } |
542 | 541 | |
543 | 542 | @MemberAccess |
544 | 543 | @ApiOperation("获取banner") |
545 | - @RequestMapping(value = "/advert/getBanner" , method = RequestMethod.POST) | |
546 | - public BaseDto<List<Advert>> getBanner(){ | |
547 | - BaseDto<List<Advert>> result = new BaseDto<>() ; | |
544 | + @RequestMapping(value = "/advert/getBanner", method = RequestMethod.POST) | |
545 | + public BaseDto<List<Advert>> getBanner() { | |
546 | + BaseDto<List<Advert>> result = new BaseDto<>(); | |
548 | 547 | result.setData(advertService.getBanner()); |
549 | - return result ; | |
548 | + return result; | |
550 | 549 | } |
551 | 550 | |
552 | 551 | @MemberAccess |
553 | 552 | @ApiOperation("上传banner") |
554 | - @RequestMapping(value = "/advert/createBanner" , method = RequestMethod.POST) | |
555 | - public BaseDto createBanner(@RequestBody Advert advert){ | |
553 | + @RequestMapping(value = "/advert/createBanner", method = RequestMethod.POST) | |
554 | + public BaseDto createBanner(@RequestBody Advert advert) { | |
556 | 555 | BaseDto result = new BaseDto(); |
557 | - if(StringUtils.isBlank(advert.getImgUrl())){ | |
556 | + if (StringUtils.isBlank(advert.getImgUrl())) { | |
558 | 557 | result.setSuccess(false); |
559 | 558 | result.setMessage("图片地址不能为空"); |
560 | - }else { | |
559 | + } else { | |
561 | 560 | advert.setType(AdvertEnums.banner.getType()); |
562 | 561 | advertService.create(advert); |
563 | 562 | } |
564 | - return result ; | |
563 | + return result; | |
565 | 564 | } |
566 | 565 | |
567 | 566 | @MemberAccess |
568 | 567 | @ApiOperation("更新banner") |
569 | - @RequestMapping(value = "/advert/updateBanner" , method = RequestMethod.POST) | |
570 | - public BaseDto updateBanner(@RequestBody Advert advert){ | |
568 | + @RequestMapping(value = "/advert/updateBanner", method = RequestMethod.POST) | |
569 | + public BaseDto updateBanner(@RequestBody Advert advert) { | |
571 | 570 | BaseDto result = new BaseDto(); |
572 | 571 | advert.setType(AdvertEnums.banner.getType()); |
573 | 572 | advertService.update(advert); |
574 | - return result ; | |
573 | + return result; | |
575 | 574 | } |
576 | 575 | |
577 | 576 | @MemberAccess |
578 | 577 | @ApiOperation("删除banner(传主键)") |
579 | - @RequestMapping(value = "/advert/delete" , method = RequestMethod.POST) | |
580 | - public BaseDto deleteBanner(@RequestBody IdDto idDto){ | |
581 | - BaseDto result = new BaseDto() ; | |
578 | + @RequestMapping(value = "/advert/delete", method = RequestMethod.POST) | |
579 | + public BaseDto deleteBanner(@RequestBody IdDto idDto) { | |
580 | + BaseDto result = new BaseDto(); | |
582 | 581 | advertService.delete(idDto.getId()); |
583 | - return result ; | |
582 | + return result; | |
584 | 583 | } |
585 | 584 | |
586 | 585 | |
... | ... | @@ -589,94 +588,94 @@ public class AdminController { |
589 | 588 | */ |
590 | 589 | @MemberAccess |
591 | 590 | @ApiOperation("获取栏目列表(1 文章 2学校 3视频)") |
592 | - @RequestMapping(value = "/column/getList" , method = RequestMethod.POST) | |
593 | - public BaseDto<List<ColumnType>> getColumnList(@RequestBody ColumnDto columnDto){ | |
591 | + @RequestMapping(value = "/column/getList", method = RequestMethod.POST) | |
592 | + public BaseDto<List<ColumnType>> getColumnList(@RequestBody ColumnDto columnDto) { | |
594 | 593 | BaseDto<List<ColumnType>> result = new BaseDto<>(); |
595 | 594 | ColumnEnums columnEnums = ColumnEnums.getByType(columnDto.getType()); |
596 | - if(columnEnums != null){ | |
595 | + if (columnEnums != null) { | |
597 | 596 | List<ColumnType> data = columnService.getList(columnDto); |
598 | 597 | result.setData(data); |
599 | - }else { | |
598 | + } else { | |
600 | 599 | result.setSuccess(false); |
601 | 600 | result.setMessage("类型不匹配"); |
602 | 601 | } |
603 | - return result ; | |
602 | + return result; | |
604 | 603 | } |
605 | 604 | |
606 | 605 | @MemberAccess |
607 | 606 | @ApiOperation("创建栏目(type : 1 文章 2学校 3视频)") |
608 | - @RequestMapping(value = "/column/create" , method = RequestMethod.POST) | |
609 | - public BaseDto createColumn(@RequestBody ColumnType columnType){ | |
610 | - BaseDto result = new BaseDto() ; | |
607 | + @RequestMapping(value = "/column/create", method = RequestMethod.POST) | |
608 | + public BaseDto createColumn(@RequestBody ColumnType columnType) { | |
609 | + BaseDto result = new BaseDto(); | |
611 | 610 | columnService.create(columnType); |
612 | - return result ; | |
611 | + return result; | |
613 | 612 | } |
614 | 613 | |
615 | 614 | @MemberAccess |
616 | 615 | @ApiOperation("获取详情 栏目") |
617 | - @RequestMapping(value = "/column/getDetail" , method = RequestMethod.POST) | |
618 | - public BaseDto createColumn(@RequestBody IdDto idDto){ | |
619 | - BaseDto result = new BaseDto() ; | |
616 | + @RequestMapping(value = "/column/getDetail", method = RequestMethod.POST) | |
617 | + public BaseDto createColumn(@RequestBody IdDto idDto) { | |
618 | + BaseDto result = new BaseDto(); | |
620 | 619 | ColumnType c = columnService.selectDetail(idDto.getId()); |
621 | - return result ; | |
620 | + return result; | |
622 | 621 | } |
623 | 622 | |
624 | 623 | @MemberAccess |
625 | 624 | @ApiOperation("更新栏目(type : 1 文章 2学校 3视频)") |
626 | - @RequestMapping(value = "/column/update" , method = RequestMethod.POST) | |
627 | - public BaseDto updateColumn(@RequestBody ColumnType columnType){ | |
628 | - BaseDto result = new BaseDto() ; | |
629 | - if(columnType.getId() > 0){ | |
625 | + @RequestMapping(value = "/column/update", method = RequestMethod.POST) | |
626 | + public BaseDto updateColumn(@RequestBody ColumnType columnType) { | |
627 | + BaseDto result = new BaseDto(); | |
628 | + if (columnType.getId() > 0) { | |
630 | 629 | columnService.update(columnType); |
631 | - }else { | |
630 | + } else { | |
632 | 631 | result.setSuccess(false); |
633 | 632 | result.setMessage("id没传"); |
634 | 633 | } |
635 | - return result ; | |
634 | + return result; | |
636 | 635 | } |
637 | 636 | |
638 | 637 | @MemberAccess |
639 | 638 | @ApiOperation("删除栏目(传主键)") |
640 | - @RequestMapping(value = "/column/delete" , method = RequestMethod.POST) | |
641 | - public BaseDto deleteColumn(@RequestBody IdDto idDto){ | |
642 | - BaseDto result = new BaseDto() ; | |
643 | - int id = idDto.getId() ; | |
639 | + @RequestMapping(value = "/column/delete", method = RequestMethod.POST) | |
640 | + public BaseDto deleteColumn(@RequestBody IdDto idDto) { | |
641 | + BaseDto result = new BaseDto(); | |
642 | + int id = idDto.getId(); | |
644 | 643 | ColumnType columnType = columnService.selectDetail(id); |
645 | - if(columnType.getType() == ColumnEnums.article.getType()){ | |
644 | + if (columnType.getType() == ColumnEnums.article.getType()) { | |
646 | 645 | ArticleSearchDto articleSearchDto = new ArticleSearchDto(); |
647 | 646 | articleSearchDto.setColumnType(columnType.getId()); |
648 | 647 | articleSearchDto.setPage(1); |
649 | 648 | articleSearchDto.setPageSize(10); |
650 | 649 | Page<Article> articlePage = articleService.getList(articleSearchDto); |
651 | - if(articlePage.getCount() > 0){ | |
650 | + if (articlePage.getCount() > 0) { | |
652 | 651 | result.setSuccess(false); |
653 | 652 | result.setMessage("还有关联的权威解读,无法删除"); |
654 | - }else { | |
653 | + } else { | |
655 | 654 | columnService.delete(id); |
656 | 655 | } |
657 | - }else if(columnType.getType() == ColumnEnums.university.getType()){ | |
658 | - Page<Consult> consultPage =consultService.getColumnList(columnType.getId(),1,10); | |
659 | - if(consultPage.getCount() > 0){ | |
656 | + } else if (columnType.getType() == ColumnEnums.university.getType()) { | |
657 | + Page<Consult> consultPage = consultService.getColumnList(columnType.getId(), 1, 10); | |
658 | + if (consultPage.getCount() > 0) { | |
660 | 659 | result.setSuccess(false); |
661 | 660 | result.setMessage("还有关联的招生咨询会信息,无法删除"); |
662 | - }else { | |
661 | + } else { | |
663 | 662 | columnService.delete(id); |
664 | 663 | } |
665 | - }else if(columnType.getType() == ColumnEnums.video.getType()){ | |
664 | + } else if (columnType.getType() == ColumnEnums.video.getType()) { | |
666 | 665 | VideoSearchDto videoSearchDto = new VideoSearchDto(); |
667 | 666 | videoSearchDto.setColumnType(columnType.getId()); |
668 | 667 | videoSearchDto.setPage(1); |
669 | 668 | videoSearchDto.setPageSize(10); |
670 | 669 | Page<Video> videoPage = videoService.getList(videoSearchDto); |
671 | - if(videoPage.getCount() > 0){ | |
670 | + if (videoPage.getCount() > 0) { | |
672 | 671 | result.setSuccess(false); |
673 | 672 | result.setMessage("还有关联的视频,无法删除"); |
674 | - }else { | |
673 | + } else { | |
675 | 674 | columnService.delete(id); |
676 | 675 | } |
677 | - }else { | |
676 | + } else { | |
678 | 677 | columnService.delete(id); |
679 | 678 | } |
680 | - return result ; | |
679 | + return result; | |
681 | 680 | } |
682 | 681 | } | ... | ... |
src/main/java/com/sincere/student/controller/AppController.java
... | ... | @@ -25,34 +25,34 @@ public class AppController { |
25 | 25 | |
26 | 26 | |
27 | 27 | @Autowired |
28 | - ColumnService columnService ; | |
28 | + ColumnService columnService; | |
29 | 29 | |
30 | 30 | @Autowired |
31 | - AdvertService advertService ; | |
31 | + AdvertService advertService; | |
32 | 32 | |
33 | 33 | @Autowired |
34 | - ArticleService articleService ; | |
34 | + ArticleService articleService; | |
35 | 35 | |
36 | 36 | @Autowired |
37 | - MajorService majorService ; | |
37 | + MajorService majorService; | |
38 | 38 | |
39 | 39 | @Autowired |
40 | - UniversityService universityService ; | |
40 | + UniversityService universityService; | |
41 | 41 | |
42 | 42 | @Autowired |
43 | 43 | ParameterService parameterService; |
44 | 44 | |
45 | 45 | @Autowired |
46 | - VideoService videoService ; | |
46 | + VideoService videoService; | |
47 | 47 | |
48 | 48 | @Autowired |
49 | - ConsultService consultService ; | |
49 | + ConsultService consultService; | |
50 | 50 | |
51 | 51 | @Autowired |
52 | - UserService userService ; | |
52 | + UserService userService; | |
53 | 53 | |
54 | 54 | @Autowired |
55 | - MessageService messageService ; | |
55 | + MessageService messageService; | |
56 | 56 | |
57 | 57 | @Autowired |
58 | 58 | SubmitService submitService; |
... | ... | @@ -62,55 +62,55 @@ public class AppController { |
62 | 62 | * 广告相关接口 |
63 | 63 | */ |
64 | 64 | @ApiOperation("获取开屏图片") |
65 | - @RequestMapping(value = "/advert/getScreen" , method = RequestMethod.POST) | |
66 | - public BaseDto<Advert> getScreen(){ | |
67 | - BaseDto<Advert> result = new BaseDto<>() ; | |
65 | + @RequestMapping(value = "/advert/getScreen", method = RequestMethod.POST) | |
66 | + public BaseDto<Advert> getScreen() { | |
67 | + BaseDto<Advert> result = new BaseDto<>(); | |
68 | 68 | result.setData(advertService.getScreen()); |
69 | - return result ; | |
69 | + return result; | |
70 | 70 | } |
71 | 71 | |
72 | 72 | @ApiOperation("获取banner") |
73 | - @RequestMapping(value = "/advert/getBanner" , method = RequestMethod.POST) | |
74 | - public BaseDto<List<Advert>> getBanner(){ | |
75 | - BaseDto<List<Advert>> result = new BaseDto<>() ; | |
73 | + @RequestMapping(value = "/advert/getBanner", method = RequestMethod.POST) | |
74 | + public BaseDto<List<Advert>> getBanner() { | |
75 | + BaseDto<List<Advert>> result = new BaseDto<>(); | |
76 | 76 | result.setData(advertService.getBanner()); |
77 | - return result ; | |
77 | + return result; | |
78 | 78 | } |
79 | 79 | |
80 | 80 | @ApiOperation("获取首页学校 咨询列表") |
81 | - @RequestMapping(value = "/consult/getConsultList" , method = RequestMethod.POST) | |
82 | - public BaseDto<List<AppConsult>> getConsultList(){ | |
81 | + @RequestMapping(value = "/consult/getConsultList", method = RequestMethod.POST) | |
82 | + public BaseDto<List<AppConsult>> getConsultList() { | |
83 | 83 | BaseDto<List<AppConsult>> result = new BaseDto<>(); |
84 | 84 | List<AppConsult> data = new ArrayList<>(); |
85 | 85 | ColumnDto columnDto = new ColumnDto(); |
86 | 86 | columnDto.setType(ColumnEnums.university.getType()); |
87 | 87 | List<ColumnType> columnTypes = columnService.getList(columnDto); |
88 | - if(columnTypes != null && columnTypes.size() > 0){ | |
89 | - for(ColumnType columnType : columnTypes){ | |
88 | + if (columnTypes != null && columnTypes.size() > 0) { | |
89 | + for (ColumnType columnType : columnTypes) { | |
90 | 90 | AppConsult appConsult = new AppConsult(); |
91 | 91 | appConsult.setColumnTypeId(columnType.getId()); |
92 | 92 | appConsult.setName(columnType.getName()); |
93 | - appConsult.setList(consultService.getColumnList(columnType.getId(),1,3).getList()); | |
94 | - if(appConsult.getList() != null && appConsult.getList().size() > 0){ | |
93 | + appConsult.setList(consultService.getColumnList(columnType.getId(), 1, 3).getList()); | |
94 | + if (appConsult.getList() != null && appConsult.getList().size() > 0) { | |
95 | 95 | data.add(appConsult); |
96 | - if(data.size() == 2){ | |
96 | + if (data.size() == 2) { | |
97 | 97 | break; |
98 | 98 | } |
99 | - }else { | |
99 | + } else { | |
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | result.setData(data); |
104 | - }else { | |
104 | + } else { | |
105 | 105 | result.setSuccess(false); |
106 | 106 | result.setMessage("后台暂未分配招生咨询会栏目"); |
107 | 107 | } |
108 | - return result ; | |
108 | + return result; | |
109 | 109 | } |
110 | 110 | |
111 | 111 | @ApiOperation("首页 搜索 按钮 咨询列表") |
112 | - @RequestMapping(value = "/consult/getConsultListSearch" , method = RequestMethod.POST) | |
113 | - public BaseDto<List<AppConsult>> getConsultListSearch(@RequestBody ConsultSearchDto consultSearchDto){ | |
112 | + @RequestMapping(value = "/consult/getConsultListSearch", method = RequestMethod.POST) | |
113 | + public BaseDto<List<AppConsult>> getConsultListSearch(@RequestBody ConsultSearchDto consultSearchDto) { | |
114 | 114 | consultSearchDto.setStatus(1); |
115 | 115 | consultSearchDto.setPage(1); |
116 | 116 | consultSearchDto.setPageSize(3); |
... | ... | @@ -119,157 +119,157 @@ public class AppController { |
119 | 119 | ColumnDto columnDto = new ColumnDto(); |
120 | 120 | columnDto.setType(ColumnEnums.university.getType()); |
121 | 121 | List<ColumnType> columnTypes = columnService.getList(columnDto); |
122 | - if(columnTypes != null && columnTypes.size() > 0){ | |
123 | - for(ColumnType columnType : columnTypes){ | |
122 | + if (columnTypes != null && columnTypes.size() > 0) { | |
123 | + for (ColumnType columnType : columnTypes) { | |
124 | 124 | consultSearchDto.setColumnType(columnType.getId()); |
125 | 125 | Page<Consult> page = consultService.getList(consultSearchDto); |
126 | 126 | AppConsult appConsult = new AppConsult(); |
127 | 127 | appConsult.setColumnTypeId(columnType.getId()); |
128 | 128 | appConsult.setName(columnType.getName()); |
129 | 129 | appConsult.setList(page.getList()); |
130 | - if(appConsult.getList() != null && appConsult.getList().size() > 0){ | |
130 | + if (appConsult.getList() != null && appConsult.getList().size() > 0) { | |
131 | 131 | data.add(appConsult); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | result.setData(data); |
135 | - }else { | |
135 | + } else { | |
136 | 136 | result.setSuccess(false); |
137 | 137 | result.setMessage("后台暂未分配招生咨询会栏目"); |
138 | 138 | } |
139 | - return result ; | |
139 | + return result; | |
140 | 140 | } |
141 | 141 | |
142 | 142 | @ApiOperation("获取首页学校 咨询列表 more") |
143 | - @RequestMapping(value = "/consult/getConsultPage" , method = RequestMethod.POST) | |
144 | - public BaseDto<Page<Consult>> getConsultTypeList(@RequestBody ConsultPageDto consultPageDto){ | |
143 | + @RequestMapping(value = "/consult/getConsultPage", method = RequestMethod.POST) | |
144 | + public BaseDto<Page<Consult>> getConsultTypeList(@RequestBody ConsultPageDto consultPageDto) { | |
145 | 145 | BaseDto<Page<Consult>> result = new BaseDto<>(); |
146 | - result.setData(consultService.getColumnList(consultPageDto.getColumnTypeId(),consultPageDto.getPage(),consultPageDto.getPageSize())); | |
147 | - return result ; | |
146 | + result.setData(consultService.getColumnList(consultPageDto.getColumnTypeId(), consultPageDto.getPage(), consultPageDto.getPageSize())); | |
147 | + return result; | |
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * 招生咨询会 |
152 | 152 | */ |
153 | 153 | @ApiOperation("获取招生咨询会相关接口") |
154 | - @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) | |
155 | - public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ | |
156 | - BaseDto<Page<Consult>> result = new BaseDto<>() ; | |
154 | + @RequestMapping(value = "/consult/getList", method = RequestMethod.POST) | |
155 | + public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto) { | |
156 | + BaseDto<Page<Consult>> result = new BaseDto<>(); | |
157 | 157 | consultSearchDto.setStatus(1); |
158 | 158 | Page<Consult> page = consultService.getList(consultSearchDto); |
159 | 159 | result.setData(page); |
160 | - return result ; | |
160 | + return result; | |
161 | 161 | } |
162 | 162 | |
163 | 163 | @ApiOperation("获取招生咨询会详情相关接口") |
164 | - @RequestMapping(value = "/consult/getDetail" , method = RequestMethod.POST) | |
165 | - public BaseDto<Consult> getConsultDetail(@RequestBody IdDto id){ | |
166 | - BaseDto<Consult> result = new BaseDto<>() ; | |
164 | + @RequestMapping(value = "/consult/getDetail", method = RequestMethod.POST) | |
165 | + public BaseDto<Consult> getConsultDetail(@RequestBody IdDto id) { | |
166 | + BaseDto<Consult> result = new BaseDto<>(); | |
167 | 167 | result.setData(consultService.getDetail(id.getId())); |
168 | - return result ; | |
168 | + return result; | |
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | 172 | * 栏目相关接口 |
173 | 173 | */ |
174 | 174 | @ApiOperation("获取栏目列表(1 文章 2学校 3视频)") |
175 | - @RequestMapping(value = "/column/getList" , method = RequestMethod.POST) | |
176 | - public BaseDto<List<ColumnType>> getColumnList(@RequestBody IdDto idDto){ | |
175 | + @RequestMapping(value = "/column/getList", method = RequestMethod.POST) | |
176 | + public BaseDto<List<ColumnType>> getColumnList(@RequestBody IdDto idDto) { | |
177 | 177 | BaseDto<List<ColumnType>> result = new BaseDto<>(); |
178 | 178 | int type = idDto.getId(); |
179 | 179 | ColumnEnums columnEnums = ColumnEnums.getByType(type); |
180 | - if(columnEnums != null){ | |
181 | - ColumnDto columnDto = new ColumnDto() ; | |
180 | + if (columnEnums != null) { | |
181 | + ColumnDto columnDto = new ColumnDto(); | |
182 | 182 | columnDto.setType(type); |
183 | 183 | List<ColumnType> data = columnService.getList(columnDto); |
184 | 184 | result.setData(data); |
185 | - }else { | |
185 | + } else { | |
186 | 186 | result.setSuccess(false); |
187 | 187 | result.setMessage("类型不匹配"); |
188 | 188 | } |
189 | - return result ; | |
189 | + return result; | |
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
193 | - *权威解读(文章广告)相关接口 | |
193 | + * 权威解读(文章广告)相关接口 | |
194 | 194 | */ |
195 | 195 | @ApiOperation("获取权威解读(文章广告)相关接口") |
196 | - @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) | |
197 | - public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ | |
198 | - BaseDto<Page<Article>> result = new BaseDto<>() ; | |
196 | + @RequestMapping(value = "/article/getList", method = RequestMethod.POST) | |
197 | + public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto) { | |
198 | + BaseDto<Page<Article>> result = new BaseDto<>(); | |
199 | 199 | articleSearchDto.setStatus(1); |
200 | 200 | Page<Article> page = articleService.getList(articleSearchDto); |
201 | 201 | result.setData(page); |
202 | - return result ; | |
202 | + return result; | |
203 | 203 | } |
204 | 204 | |
205 | 205 | @ApiOperation("获取权威解读(文章广告)详情相关接口") |
206 | - @RequestMapping(value = "/article/getDetail" , method = RequestMethod.POST) | |
207 | - public BaseDto<Article> getDetail(@RequestBody IdDto idDto){ | |
208 | - BaseDto<Article> result = new BaseDto<>() ; | |
209 | - Article article = articleService.selectById(idDto.getId()) ; | |
206 | + @RequestMapping(value = "/article/getDetail", method = RequestMethod.POST) | |
207 | + public BaseDto<Article> getDetail(@RequestBody IdDto idDto) { | |
208 | + BaseDto<Article> result = new BaseDto<>(); | |
209 | + Article article = articleService.selectById(idDto.getId()); | |
210 | 210 | result.setData(article); |
211 | 211 | Article temp = new Article(); |
212 | 212 | temp.setId(idDto.getId()); |
213 | - temp.setLookNumber(article.getLookNumber()+1); | |
213 | + temp.setLookNumber(article.getLookNumber() + 1); | |
214 | 214 | temp.setStatus(-1); |
215 | 215 | articleService.update(temp); |
216 | - return result ; | |
216 | + return result; | |
217 | 217 | } |
218 | 218 | |
219 | 219 | |
220 | 220 | @ApiOperation(" 点赞 权威解读(文章广告)相关接口") |
221 | - @RequestMapping(value = "/article/good" , method = RequestMethod.POST) | |
222 | - public BaseDto good(@RequestBody IdDto idDto){ | |
223 | - BaseDto result = new BaseDto<>() ; | |
224 | - Article article = articleService.selectById(idDto.getId()) ; | |
221 | + @RequestMapping(value = "/article/good", method = RequestMethod.POST) | |
222 | + public BaseDto good(@RequestBody IdDto idDto) { | |
223 | + BaseDto result = new BaseDto<>(); | |
224 | + Article article = articleService.selectById(idDto.getId()); | |
225 | 225 | Article temp = new Article(); |
226 | 226 | temp.setId(idDto.getId()); |
227 | - temp.setGoodNumber(article.getGoodNumber()+1); | |
227 | + temp.setGoodNumber(article.getGoodNumber() + 1); | |
228 | 228 | temp.setStatus(-1); |
229 | 229 | articleService.update(temp); |
230 | - return result ; | |
230 | + return result; | |
231 | 231 | } |
232 | 232 | |
233 | 233 | @ApiOperation("获取权威解读(文章广告) 相关咨询 相关接口 传学校id") |
234 | - @RequestMapping(value = "/article/getRelation" , method = RequestMethod.POST) | |
235 | - public BaseDto<List<Article>> getRelation(@RequestBody IdDto idDto){ | |
236 | - BaseDto<List<Article>> result = new BaseDto<>() ; | |
234 | + @RequestMapping(value = "/article/getRelation", method = RequestMethod.POST) | |
235 | + public BaseDto<List<Article>> getRelation(@RequestBody IdDto idDto) { | |
236 | + BaseDto<List<Article>> result = new BaseDto<>(); | |
237 | 237 | result.setData(articleService.getRelationList(idDto.getId())); |
238 | - return result ; | |
238 | + return result; | |
239 | 239 | } |
240 | 240 | |
241 | 241 | @ApiOperation("联系我们") |
242 | - @RequestMapping(value = "/linkUs/getLinkUs" , method = RequestMethod.POST) | |
243 | - public BaseDto<String> getLinkUs(){ | |
242 | + @RequestMapping(value = "/linkUs/getLinkUs", method = RequestMethod.POST) | |
243 | + public BaseDto<String> getLinkUs() { | |
244 | 244 | BaseDto<String> result = new BaseDto<>(); |
245 | - Parameter parameter = parameterService.getByCode(ParameterUtils.link_us) ; | |
246 | - if(parameter != null){ | |
245 | + Parameter parameter = parameterService.getByCode(ParameterUtils.link_us); | |
246 | + if (parameter != null) { | |
247 | 247 | result.setData(parameter.getMessage()); |
248 | - }else { | |
248 | + } else { | |
249 | 249 | result.setSuccess(false); |
250 | 250 | result.setMessage("还未设置联系我们的图片"); |
251 | 251 | } |
252 | - return result ; | |
252 | + return result; | |
253 | 253 | } |
254 | 254 | |
255 | 255 | @ApiOperation("留言板,只传page,pageSize") |
256 | - @RequestMapping(value = "/message/getList" , method = RequestMethod.POST) | |
257 | - public BaseDto<Page<Message>> insertMessage(@RequestBody MessageSearchDto messageSearchDto){ | |
256 | + @RequestMapping(value = "/message/getList", method = RequestMethod.POST) | |
257 | + public BaseDto<Page<Message>> insertMessage(@RequestBody MessageSearchDto messageSearchDto) { | |
258 | 258 | BaseDto<Page<Message>> result = new BaseDto<>(); |
259 | 259 | result.setData(messageService.getList(messageSearchDto)); |
260 | - return result ; | |
260 | + return result; | |
261 | 261 | } |
262 | 262 | |
263 | 263 | @ApiOperation("留言") |
264 | - @RequestMapping(value = "/message/create" , method = RequestMethod.POST) | |
265 | - public BaseDto insertMessage(@RequestBody Message message){ | |
264 | + @RequestMapping(value = "/message/create", method = RequestMethod.POST) | |
265 | + public BaseDto insertMessage(@RequestBody Message message) { | |
266 | 266 | messageService.create(message); |
267 | 267 | return new BaseDto(); |
268 | 268 | } |
269 | 269 | |
270 | 270 | @ApiOperation("留言详情") |
271 | - @RequestMapping(value = "/message/detail" , method = RequestMethod.POST) | |
272 | - public BaseDto<Message> insertMessage(@RequestBody IdDto idDto){ | |
271 | + @RequestMapping(value = "/message/detail", method = RequestMethod.POST) | |
272 | + public BaseDto<Message> insertMessage(@RequestBody IdDto idDto) { | |
273 | 273 | BaseDto<Message> result = new BaseDto<>(); |
274 | 274 | result.setData(messageService.getDetail(idDto.getId())); |
275 | 275 | return result; |
... | ... | @@ -277,55 +277,55 @@ public class AppController { |
277 | 277 | |
278 | 278 | |
279 | 279 | @ApiOperation("获取视频相关接口") |
280 | - @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) | |
281 | - public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ | |
282 | - BaseDto<Page<Video>> result = new BaseDto<>() ; | |
280 | + @RequestMapping(value = "/video/getList", method = RequestMethod.POST) | |
281 | + public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto) { | |
282 | + BaseDto<Page<Video>> result = new BaseDto<>(); | |
283 | 283 | videoSearchDto.setStatus(1); |
284 | 284 | Page<Video> page = videoService.getUniversityList(videoSearchDto); |
285 | 285 | result.setData(page); |
286 | - return result ; | |
286 | + return result; | |
287 | 287 | } |
288 | 288 | |
289 | 289 | @ApiOperation("获取视频相关接口") |
290 | - @RequestMapping(value = "/video/getDetail" , method = RequestMethod.POST) | |
291 | - public BaseDto<Page<Video>> getVideoDetail(@RequestBody VideoSearchDto videoSearchDto){ | |
292 | - BaseDto<Page<Video>> result = new BaseDto<>() ; | |
290 | + @RequestMapping(value = "/video/getDetail", method = RequestMethod.POST) | |
291 | + public BaseDto<Page<Video>> getVideoDetail(@RequestBody VideoSearchDto videoSearchDto) { | |
292 | + BaseDto<Page<Video>> result = new BaseDto<>(); | |
293 | 293 | Page<Video> page = videoService.getList(videoSearchDto); |
294 | 294 | result.setData(page); |
295 | - return result ; | |
295 | + return result; | |
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
299 | 299 | * 投档线 |
300 | 300 | */ |
301 | 301 | @ApiOperation("投档线列表接口") |
302 | - @RequestMapping(value = "/submit/getList" , method = RequestMethod.POST) | |
303 | - public BaseDto<Page<SubmitLine>> getFileList(@RequestBody PointSearchDto pointSearchDto){ | |
302 | + @RequestMapping(value = "/submit/getList", method = RequestMethod.POST) | |
303 | + public BaseDto<Page<SubmitLine>> getFileList(@RequestBody PointSearchDto pointSearchDto) { | |
304 | 304 | BaseDto<Page<SubmitLine>> result = new BaseDto<>(); |
305 | 305 | result.setData(submitService.getAppList(pointSearchDto)); |
306 | - return result ; | |
306 | + return result; | |
307 | 307 | } |
308 | 308 | |
309 | 309 | @ApiOperation("投档线首页列表接口") |
310 | - @RequestMapping(value = "/submit/getSubmitList" , method = RequestMethod.POST) | |
311 | - public BaseDto<Page<SubmitFile>> getSubmitList(@RequestBody PageDto pageDto){ | |
310 | + @RequestMapping(value = "/submit/getSubmitList", method = RequestMethod.POST) | |
311 | + public BaseDto<Page<SubmitFile>> getSubmitList(@RequestBody PageDto pageDto) { | |
312 | 312 | BaseDto<Page<SubmitFile>> result = new BaseDto<>(); |
313 | 313 | MessageSearchDto pointSearchDto = new MessageSearchDto(); |
314 | 314 | pointSearchDto.setPage(pageDto.getPage()); |
315 | 315 | pointSearchDto.setPageSize(pageDto.getPageSize()); |
316 | 316 | result.setData(submitService.getAdminList(pointSearchDto)); |
317 | - return result ; | |
317 | + return result; | |
318 | 318 | } |
319 | 319 | |
320 | 320 | @ApiOperation("具体某个投档线详情接口") |
321 | - @RequestMapping(value = "/submit/getDetail" , method = RequestMethod.POST) | |
322 | - public BaseDto<SubmitLine> getSubmitDetail(@RequestBody IdDto idDto){ | |
321 | + @RequestMapping(value = "/submit/getDetail", method = RequestMethod.POST) | |
322 | + public BaseDto<SubmitLine> getSubmitDetail(@RequestBody IdDto idDto) { | |
323 | 323 | BaseDto<SubmitLine> result = new BaseDto<>(); |
324 | 324 | PointSearchDto pointSearchDto = new PointSearchDto(); |
325 | 325 | pointSearchDto.setPage(1); |
326 | 326 | pointSearchDto.setPageSize(9999); |
327 | 327 | pointSearchDto.setSubmitId(idDto.getId()); |
328 | 328 | result.setData(submitService.getAppList(pointSearchDto).getList().get(0)); |
329 | - return result ; | |
329 | + return result; | |
330 | 330 | } |
331 | 331 | } | ... | ... |
src/main/java/com/sincere/student/controller/CommonController.java
... | ... | @@ -30,38 +30,38 @@ import java.util.*; |
30 | 30 | public class CommonController { |
31 | 31 | |
32 | 32 | @Autowired |
33 | - CommonService commonService ; | |
33 | + CommonService commonService; | |
34 | 34 | |
35 | 35 | @Autowired |
36 | - ParameterService parameterService ; | |
36 | + ParameterService parameterService; | |
37 | 37 | |
38 | 38 | private static List<Area> list = new ArrayList<>(); |
39 | 39 | |
40 | 40 | private static List<Province> provinces = new ArrayList<>(); |
41 | 41 | |
42 | - @RequestMapping(value = "GetWxSign",method = RequestMethod.GET) | |
42 | + @RequestMapping(value = "GetWxSign", method = RequestMethod.GET) | |
43 | 43 | @ApiOperation(value = "获取微信分享签名") |
44 | - public BaseDto<WxSign> GetWxSign(String url){ | |
44 | + public BaseDto<WxSign> GetWxSign(String url) { | |
45 | 45 | try { |
46 | 46 | url = java.net.URLDecoder.decode(url, "UTF-8"); |
47 | 47 | } catch (UnsupportedEncodingException e) { |
48 | 48 | e.printStackTrace(); |
49 | 49 | } |
50 | - url=url.replaceAll("\\+", "%2B"); | |
51 | - BaseDto<WxSign> result=new BaseDto<>(); | |
50 | + url = url.replaceAll("\\+", "%2B"); | |
51 | + BaseDto<WxSign> result = new BaseDto<>(); | |
52 | 52 | // String r=Get("http://114.55.30.100:1111/api/UserRegisterApp/GetWxShareSign","url="+url); |
53 | 53 | // JSONObject jsonObject= JSONObject.parseObject(r); |
54 | 54 | // String data = jsonObject.getString("result"); |
55 | 55 | // WxSign wxSign=JSON.parseObject(data,new TypeReference<WxSign>(){}); |
56 | 56 | // result.setData(wxSign); |
57 | 57 | |
58 | - WxSign wxSign1=new WxSign(); | |
58 | + WxSign wxSign1 = new WxSign(); | |
59 | 59 | wxSign1.setTimestamp(Long.toString(System.currentTimeMillis())); |
60 | 60 | wxSign1.setNoncestr(UUID.randomUUID().toString()); |
61 | 61 | String token = getToken(); |
62 | 62 | |
63 | - String js=Get("https://api.weixin.qq.com/cgi-bin/ticket/getticket","type=jsapi&access_token="+token); | |
64 | - JSONObject jsonObject= JSONObject.parseObject(js); | |
63 | + String js = Get("https://api.weixin.qq.com/cgi-bin/ticket/getticket", "type=jsapi&access_token=" + token); | |
64 | + JSONObject jsonObject = JSONObject.parseObject(js); | |
65 | 65 | wxSign1.setJsapi_ticket(jsonObject.getString("ticket")); |
66 | 66 | String rawstring = "jsapi_ticket=" + wxSign1.getJsapi_ticket() + "&noncestr=" + wxSign1.getNoncestr() + "×tamp=" + wxSign1.getTimestamp() + "&url=" + url + ""; |
67 | 67 | wxSign1.setSignature(SHA1(rawstring)); |
... | ... | @@ -70,61 +70,61 @@ public class CommonController { |
70 | 70 | } |
71 | 71 | |
72 | 72 | @ApiOperation("省份") |
73 | - @RequestMapping(value = "getProvince",method = RequestMethod.GET) | |
74 | - public List<Area> getProvince(){ | |
75 | - if(list.size() == 0){ | |
73 | + @RequestMapping(value = "getProvince", method = RequestMethod.GET) | |
74 | + public List<Area> getProvince() { | |
75 | + if (list.size() == 0) { | |
76 | 76 | List<Area> areas = commonService.getProvince(); |
77 | - for(Area area : areas){ | |
77 | + for (Area area : areas) { | |
78 | 78 | List<Area> cityList = commonService.getCity(area.getCode()); |
79 | - if(area.getName().contains("市")){ | |
79 | + if (area.getName().contains("市")) { | |
80 | 80 | //获取全部 |
81 | 81 | area.setList(cityList); |
82 | - }else { | |
82 | + } else { | |
83 | 83 | //获取4位的市 |
84 | 84 | List<Area> trueCityList = new ArrayList<>(); |
85 | - for(Area city : cityList){ | |
86 | - if(city.getCode().length() < 6){ | |
85 | + for (Area city : cityList) { | |
86 | + if (city.getCode().length() < 6) { | |
87 | 87 | trueCityList.add(city); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | area.setList(trueCityList); |
91 | 91 | } |
92 | 92 | } |
93 | - list = areas ; | |
93 | + list = areas; | |
94 | 94 | } |
95 | - return list ; | |
95 | + return list; | |
96 | 96 | } |
97 | 97 | |
98 | 98 | @ApiOperation("省份") |
99 | - @RequestMapping(value = "getProvince2",method = RequestMethod.GET) | |
100 | - public List<Province> getProvince2(){ | |
101 | - if(provinces.size() == 0){ | |
102 | - if(list.size() == 0){ | |
99 | + @RequestMapping(value = "getProvince2", method = RequestMethod.GET) | |
100 | + public List<Province> getProvince2() { | |
101 | + if (provinces.size() == 0) { | |
102 | + if (list.size() == 0) { | |
103 | 103 | List<Area> areas = commonService.getProvince(); |
104 | - for(Area area : areas){ | |
104 | + for (Area area : areas) { | |
105 | 105 | List<Area> cityList = commonService.getCity(area.getCode()); |
106 | - if(area.getName().contains("市")){ | |
106 | + if (area.getName().contains("市")) { | |
107 | 107 | //获取全部 |
108 | 108 | area.setList(cityList); |
109 | - }else { | |
109 | + } else { | |
110 | 110 | //获取4位的市 |
111 | 111 | List<Area> trueCityList = new ArrayList<>(); |
112 | - for(Area city : cityList){ | |
113 | - if(city.getCode().length() < 6){ | |
112 | + for (Area city : cityList) { | |
113 | + if (city.getCode().length() < 6) { | |
114 | 114 | trueCityList.add(city); |
115 | 115 | } |
116 | 116 | } |
117 | 117 | area.setList(trueCityList); |
118 | 118 | } |
119 | 119 | } |
120 | - list = areas ; | |
120 | + list = areas; | |
121 | 121 | } |
122 | - for(Area area : list){ | |
123 | - Province province = new Province() ; | |
122 | + for (Area area : list) { | |
123 | + Province province = new Province(); | |
124 | 124 | province.setValue(area.getName()); |
125 | 125 | province.setLabel(area.getName()); |
126 | 126 | List<Province> cityList = new ArrayList<>(); |
127 | - for(Area city : area.getList()){ | |
127 | + for (Area city : area.getList()) { | |
128 | 128 | Province newCity = new Province(); |
129 | 129 | newCity.setLabel(city.getName()); |
130 | 130 | newCity.setValue(city.getName()); |
... | ... | @@ -134,30 +134,30 @@ public class CommonController { |
134 | 134 | provinces.add(province); |
135 | 135 | } |
136 | 136 | } |
137 | - return provinces ; | |
137 | + return provinces; | |
138 | 138 | } |
139 | 139 | |
140 | 140 | @ApiOperation("市") |
141 | - @RequestMapping(value = "getCity",method = RequestMethod.GET) | |
142 | - public List<Area> getCity(String code){ | |
141 | + @RequestMapping(value = "getCity", method = RequestMethod.GET) | |
142 | + public List<Area> getCity(String code) { | |
143 | 143 | return commonService.getCity(code); |
144 | 144 | } |
145 | 145 | |
146 | 146 | @ApiOperation("高校类型") |
147 | - @RequestMapping(value = "getUniversityType",method = RequestMethod.GET) | |
148 | - public List<String> getUniversityType(){ | |
149 | - String[] array = new String[]{"综合类","理工类","师范类","农林类","政法类","医药类" | |
150 | - ,"财经类","民族类","语言类","艺术类","体育类","军事类","旅游类"}; | |
151 | - List<String> list = Arrays.asList(array); | |
152 | - return list ; | |
147 | + @RequestMapping(value = "getUniversityType", method = RequestMethod.GET) | |
148 | + public List<String> getUniversityType() { | |
149 | + String[] array = new String[]{"综合类", "理工类", "师范类", "农林类", "政法类", "医药类" | |
150 | + , "财经类", "民族类", "语言类", "艺术类", "体育类", "军事类", "旅游类"}; | |
151 | + List<String> list = Arrays.asList(array); | |
152 | + return list; | |
153 | 153 | } |
154 | 154 | |
155 | 155 | @ApiOperation("高校教学层次") |
156 | - @RequestMapping(value = "getUniversityLevel",method = RequestMethod.GET) | |
157 | - public List<String> getUniversityLevel(){ | |
158 | - String[] array = new String[]{"本科","高职"}; | |
159 | - List<String> list = Arrays.asList(array); | |
160 | - return list ; | |
156 | + @RequestMapping(value = "getUniversityLevel", method = RequestMethod.GET) | |
157 | + public List<String> getUniversityLevel() { | |
158 | + String[] array = new String[]{"本科", "高职"}; | |
159 | + List<String> list = Arrays.asList(array); | |
160 | + return list; | |
161 | 161 | } |
162 | 162 | |
163 | 163 | |
... | ... | @@ -188,7 +188,7 @@ public class CommonController { |
188 | 188 | } |
189 | 189 | // 定义 BufferedReader输入流来读取URL的响应 |
190 | 190 | in = new BufferedReader(new InputStreamReader( |
191 | - connection.getInputStream(),"UTF-8")); | |
191 | + connection.getInputStream(), "UTF-8")); | |
192 | 192 | String line; |
193 | 193 | while ((line = in.readLine()) != null) { |
194 | 194 | result += line; |
... | ... | @@ -215,8 +215,8 @@ public class CommonController { |
215 | 215 | String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appID + "&secret=" |
216 | 216 | + appScret; |
217 | 217 | try { |
218 | - URL getUrl=new URL(url); | |
219 | - HttpURLConnection http=(HttpURLConnection)getUrl.openConnection(); | |
218 | + URL getUrl = new URL(url); | |
219 | + HttpURLConnection http = (HttpURLConnection) getUrl.openConnection(); | |
220 | 220 | http.setRequestMethod("GET"); |
221 | 221 | http.setRequestProperty("Content-Type", |
222 | 222 | "application/x-www-form-urlencoded"); | ... | ... |
src/main/java/com/sincere/student/dto/ArticleSearchDto.java
... | ... | @@ -4,16 +4,16 @@ import io.swagger.annotations.ApiModel; |
4 | 4 | import io.swagger.annotations.ApiModelProperty; |
5 | 5 | |
6 | 6 | @ApiModel |
7 | -public class ArticleSearchDto extends PageDto{ | |
7 | +public class ArticleSearchDto extends PageDto { | |
8 | 8 | |
9 | 9 | @ApiModelProperty(value = "文章类型 1广告文章 2权威解读 必传") |
10 | - private int articleType ; | |
10 | + private int articleType; | |
11 | 11 | @ApiModelProperty(value = "标题") |
12 | - private String title ; | |
12 | + private String title; | |
13 | 13 | @ApiModelProperty(value = "文章栏目") |
14 | - private int columnType ; | |
14 | + private int columnType; | |
15 | 15 | @ApiModelProperty(value = "状态 0预览1发布 都不用传") |
16 | - private int status ; | |
16 | + private int status; | |
17 | 17 | |
18 | 18 | public int getStatus() { |
19 | 19 | return status; | ... | ... |
src/main/java/com/sincere/student/dto/BaseDto.java
... | ... | @@ -7,11 +7,11 @@ import io.swagger.annotations.ApiModelProperty; |
7 | 7 | public class BaseDto<T> { |
8 | 8 | |
9 | 9 | @ApiModelProperty(value = "接口成功与否") |
10 | - private boolean success ; | |
10 | + private boolean success; | |
11 | 11 | @ApiModelProperty(value = "错误信息") |
12 | - private String message ; | |
12 | + private String message; | |
13 | 13 | @ApiModelProperty(value = "数据") |
14 | - private T data ; | |
14 | + private T data; | |
15 | 15 | |
16 | 16 | public boolean isSuccess() { |
17 | 17 | return success; |
... | ... | @@ -38,7 +38,7 @@ public class BaseDto<T> { |
38 | 38 | } |
39 | 39 | |
40 | 40 | public BaseDto() { |
41 | - this.success = true ; | |
41 | + this.success = true; | |
42 | 42 | } |
43 | 43 | |
44 | 44 | @Override | ... | ... |
src/main/java/com/sincere/student/dto/ColumnDto.java
src/main/java/com/sincere/student/dto/ConsultSearchDto.java
... | ... | @@ -7,17 +7,17 @@ import io.swagger.annotations.ApiModelProperty; |
7 | 7 | public class ConsultSearchDto extends PageDto { |
8 | 8 | |
9 | 9 | @ApiModelProperty(value = "栏目类型") |
10 | - private int columnType ; | |
10 | + private int columnType; | |
11 | 11 | @ApiModelProperty(value = "查询学校") |
12 | - private String universityName ; | |
12 | + private String universityName; | |
13 | 13 | @ApiModelProperty(value = "省") |
14 | - private String province ; | |
14 | + private String province; | |
15 | 15 | @ApiModelProperty(value = "市") |
16 | - private String city ; | |
16 | + private String city; | |
17 | 17 | @ApiModelProperty(value = "专业") |
18 | - private String majorName ; | |
18 | + private String majorName; | |
19 | 19 | @ApiModelProperty(value = "状态 0预览1发布 都不用传") |
20 | - private int status ; | |
20 | + private int status; | |
21 | 21 | |
22 | 22 | public int getStatus() { |
23 | 23 | return status; | ... | ... |
src/main/java/com/sincere/student/dto/IdDto.java
src/main/java/com/sincere/student/dto/LinkUsDto.java
src/main/java/com/sincere/student/dto/MajorSearchDto.java
... | ... | @@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty; |
7 | 7 | public class MajorSearchDto extends PageDto { |
8 | 8 | |
9 | 9 | @ApiModelProperty(value = "查询名称,或编码") |
10 | - private String search ; | |
10 | + private String search; | |
11 | 11 | @ApiModelProperty(value = "父级专业id 查一级专业时,pid传-1") |
12 | - private int pid ; | |
12 | + private int pid; | |
13 | 13 | |
14 | 14 | public int getPid() { |
15 | 15 | return pid; | ... | ... |
src/main/java/com/sincere/student/dto/MessageSearchDto.java
src/main/java/com/sincere/student/dto/PageDto.java
... | ... | @@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModelProperty; |
6 | 6 | @ApiModel |
7 | 7 | public class PageDto { |
8 | 8 | @ApiModelProperty(value = "页码") |
9 | - private int page ; | |
9 | + private int page; | |
10 | 10 | @ApiModelProperty(value = "每页数量") |
11 | - private int pageSize ; | |
11 | + private int pageSize; | |
12 | 12 | |
13 | 13 | public int getPage() { |
14 | 14 | return page; | ... | ... |
src/main/java/com/sincere/student/dto/PointSearchDto.java
... | ... | @@ -7,19 +7,19 @@ import io.swagger.annotations.ApiModelProperty; |
7 | 7 | public class PointSearchDto extends PageDto { |
8 | 8 | |
9 | 9 | @ApiModelProperty(value = "投档线主键") |
10 | - private int submitId ; | |
10 | + private int submitId; | |
11 | 11 | @ApiModelProperty(value = "查询学校") |
12 | - private String universityName ; | |
12 | + private String universityName; | |
13 | 13 | @ApiModelProperty(value = "省") |
14 | - private String province ; | |
14 | + private String province; | |
15 | 15 | @ApiModelProperty(value = "市") |
16 | - private String city ; | |
16 | + private String city; | |
17 | 17 | @ApiModelProperty(value = "专业") |
18 | - private String majorName ; | |
18 | + private String majorName; | |
19 | 19 | @ApiModelProperty(value = "分数") |
20 | - private int point ; | |
20 | + private int point; | |
21 | 21 | @ApiModelProperty(value = "位次") |
22 | - private int rank ; | |
22 | + private int rank; | |
23 | 23 | |
24 | 24 | public String getUniversityName() { |
25 | 25 | return universityName; | ... | ... |
src/main/java/com/sincere/student/dto/Province.java
... | ... | @@ -4,9 +4,9 @@ import java.util.List; |
4 | 4 | |
5 | 5 | public class Province { |
6 | 6 | |
7 | - private String value ; | |
8 | - private String label ; | |
9 | - private List<Province> children ; | |
7 | + private String value; | |
8 | + private String label; | |
9 | + private List<Province> children; | |
10 | 10 | |
11 | 11 | public String getValue() { |
12 | 12 | return value; | ... | ... |
src/main/java/com/sincere/student/dto/ReturnDto.java
src/main/java/com/sincere/student/dto/UniversitySearchDto.java
src/main/java/com/sincere/student/dto/VideoSearchDto.java
... | ... | @@ -7,14 +7,14 @@ import io.swagger.annotations.ApiModelProperty; |
7 | 7 | public class VideoSearchDto extends PageDto { |
8 | 8 | |
9 | 9 | @ApiModelProperty(value = "视频栏目主键") |
10 | - private int columnType ; | |
10 | + private int columnType; | |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "查询名称") |
13 | - private String universityName ; | |
13 | + private String universityName; | |
14 | 14 | @ApiModelProperty(value = "学校主键") |
15 | - private int universityId ; | |
15 | + private int universityId; | |
16 | 16 | @ApiModelProperty(value = "状态 0预览1发布 都不用传") |
17 | - private int status ; | |
17 | + private int status; | |
18 | 18 | |
19 | 19 | public int getUniversityId() { |
20 | 20 | return universityId; | ... | ... |
src/main/java/com/sincere/student/dto/app/AppConsult.java
... | ... | @@ -11,11 +11,11 @@ import java.util.List; |
11 | 11 | public class AppConsult { |
12 | 12 | |
13 | 13 | @ApiModelProperty(value = "招生咨询栏目主键") |
14 | - private int columnTypeId ; | |
14 | + private int columnTypeId; | |
15 | 15 | @ApiModelProperty(value = "招生咨询栏目名称") |
16 | - private String name ; | |
16 | + private String name; | |
17 | 17 | @ApiModelProperty(value = "具体招生咨询 信息") |
18 | - private List<Consult> list ; | |
18 | + private List<Consult> list; | |
19 | 19 | |
20 | 20 | public int getColumnTypeId() { |
21 | 21 | return columnTypeId; | ... | ... |
src/main/java/com/sincere/student/dto/app/ConsultPageDto.java
... | ... | @@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModelProperty; |
8 | 8 | public class ConsultPageDto extends PageDto { |
9 | 9 | |
10 | 10 | @ApiModelProperty(value = "招生咨询栏目主键") |
11 | - private int columnTypeId ; | |
11 | + private int columnTypeId; | |
12 | 12 | |
13 | 13 | public int getColumnTypeId() { |
14 | 14 | return columnTypeId; | ... | ... |
src/main/java/com/sincere/student/dto/submit/SubmitLine.java
... | ... | @@ -9,11 +9,11 @@ import java.util.List; |
9 | 9 | public class SubmitLine { |
10 | 10 | |
11 | 11 | @ApiModelProperty(value = "主键") |
12 | - private int id ; | |
12 | + private int id; | |
13 | 13 | @ApiModelProperty(value = "标题") |
14 | - private String title ; | |
14 | + private String title; | |
15 | 15 | @ApiModelProperty(value = "学校列表") |
16 | - private List<SubmitUniv> universityList ; | |
16 | + private List<SubmitUniv> universityList; | |
17 | 17 | |
18 | 18 | public int getId() { |
19 | 19 | return id; | ... | ... |
src/main/java/com/sincere/student/dto/submit/SubmitUniv.java
... | ... | @@ -9,17 +9,17 @@ import java.util.List; |
9 | 9 | public class SubmitUniv { |
10 | 10 | |
11 | 11 | @ApiModelProperty(value = "主键") |
12 | - private int universityId ; | |
12 | + private int universityId; | |
13 | 13 | @ApiModelProperty(value = "学校名称") |
14 | - private String universityName ; | |
14 | + private String universityName; | |
15 | 15 | @ApiModelProperty(value = "专业") |
16 | - private String major ; | |
16 | + private String major; | |
17 | 17 | @ApiModelProperty(value = "分数") |
18 | - private int grade ; | |
18 | + private int grade; | |
19 | 19 | @ApiModelProperty(value = "招收数量") |
20 | - private int enrollNumber ; | |
20 | + private int enrollNumber; | |
21 | 21 | @ApiModelProperty(value = "位次号") |
22 | - private int rank ; | |
22 | + private int rank; | |
23 | 23 | |
24 | 24 | public String getMajor() { |
25 | 25 | return major; | ... | ... |
src/main/java/com/sincere/student/enums/AdvertEnums.java
src/main/java/com/sincere/student/enums/ArticleEnums.java
src/main/java/com/sincere/student/enums/ColumnEnums.java
... | ... | @@ -2,12 +2,12 @@ package com.sincere.student.enums; |
2 | 2 | |
3 | 3 | public enum ColumnEnums { |
4 | 4 | |
5 | - article(1,"权威解读"), | |
6 | - university(2,"招生"), | |
7 | - video(3,"视频"); | |
5 | + article(1, "权威解读"), | |
6 | + university(2, "招生"), | |
7 | + video(3, "视频"); | |
8 | 8 | |
9 | - private int type ; | |
10 | - private String message ; | |
9 | + private int type; | |
10 | + private String message; | |
11 | 11 | |
12 | 12 | public int getType() { |
13 | 13 | return type; |
... | ... | @@ -30,12 +30,12 @@ public enum ColumnEnums { |
30 | 30 | this.message = message; |
31 | 31 | } |
32 | 32 | |
33 | - public static ColumnEnums getByType(int type){ | |
34 | - for(ColumnEnums columnEnums : ColumnEnums.values()){ | |
35 | - if(columnEnums.getType() == type){ | |
36 | - return columnEnums ; | |
33 | + public static ColumnEnums getByType(int type) { | |
34 | + for (ColumnEnums columnEnums : ColumnEnums.values()) { | |
35 | + if (columnEnums.getType() == type) { | |
36 | + return columnEnums; | |
37 | 37 | } |
38 | 38 | } |
39 | - return null ; | |
39 | + return null; | |
40 | 40 | } |
41 | 41 | } | ... | ... |
src/main/java/com/sincere/student/enums/ParameterUtils.java
src/main/java/com/sincere/student/filter/AllowOriginFilter.java
... | ... | @@ -6,8 +6,10 @@ import javax.servlet.*; |
6 | 6 | import javax.servlet.annotation.WebFilter; |
7 | 7 | import javax.servlet.http.HttpServletResponse; |
8 | 8 | import java.io.IOException; |
9 | + | |
9 | 10 | /** |
10 | 11 | * 用于解决跨域问题 |
12 | + * | |
11 | 13 | * @author chen |
12 | 14 | * @version 1.0 |
13 | 15 | * @date 2019/10/11 0011 10:17 |
... | ... | @@ -25,7 +27,8 @@ public class AllowOriginFilter implements Filter { |
25 | 27 | response.setHeader("Access-Control-Allow-Origin", "*"); |
26 | 28 | response.setHeader("Access-Control-Allow-Methods", "*"); |
27 | 29 | response.setHeader("Access-Control-Allow-Credentials", "true"); |
28 | - response.setHeader("Access-Control-Allow-Headers","*"); | |
30 | + response.setHeader("Access-Control-Allow-Headers", "*"); | |
31 | + response.setHeader("Access-Control-Request-Headers", "*"); | |
29 | 32 | chain.doFilter(req, res); |
30 | 33 | } |
31 | 34 | ... | ... |
src/main/java/com/sincere/student/mapper/ArticleMapper.java
... | ... | @@ -2,6 +2,7 @@ package com.sincere.student.mapper; |
2 | 2 | |
3 | 3 | import com.sincere.student.dto.ArticleSearchDto; |
4 | 4 | import com.sincere.student.model.Article; |
5 | +import org.apache.ibatis.annotations.Param; | |
5 | 6 | |
6 | 7 | import java.util.List; |
7 | 8 | |
... | ... | @@ -22,4 +23,6 @@ public interface ArticleMapper { |
22 | 23 | int update(Article article); |
23 | 24 | |
24 | 25 | Article getAdvert(); |
26 | + | |
27 | + List<Article> countSort(@Param(value = "sort") int sort, @Param(value = "flag") int flag, @Param(value = "id") Integer id); | |
25 | 28 | } | ... | ... |
src/main/java/com/sincere/student/mapper/ColumnMapper.java
... | ... | @@ -2,6 +2,7 @@ package com.sincere.student.mapper; |
2 | 2 | |
3 | 3 | import com.sincere.student.dto.ColumnDto; |
4 | 4 | import com.sincere.student.model.ColumnType; |
5 | +import org.apache.ibatis.annotations.Param; | |
5 | 6 | |
6 | 7 | import java.util.List; |
7 | 8 | |
... | ... | @@ -16,4 +17,6 @@ public interface ColumnMapper { |
16 | 17 | int update(ColumnType columnType); |
17 | 18 | |
18 | 19 | int delete(int id); |
20 | + | |
21 | + List<ColumnType> countSort(@Param(value = "sort") int sort, @Param(value = "type") int type, @Param(value = "flag") int flag, @Param(value = "id") Integer id); | |
19 | 22 | } | ... | ... |
src/main/java/com/sincere/student/mapper/UniversityConsultMapper.java
... | ... | @@ -3,6 +3,7 @@ package com.sincere.student.mapper; |
3 | 3 | import com.sincere.student.dto.ConsultSearchDto; |
4 | 4 | import com.sincere.student.model.Consult; |
5 | 5 | import com.sincere.student.model.UniversityConsult; |
6 | +import org.apache.ibatis.annotations.Param; | |
6 | 7 | |
7 | 8 | import java.util.List; |
8 | 9 | |
... | ... | @@ -28,4 +29,8 @@ public interface UniversityConsultMapper { |
28 | 29 | |
29 | 30 | List<Consult> selectByUniversityIdAndColumnType(UniversityConsult consult); |
30 | 31 | |
32 | + List<Consult> countSort(@Param(value = "sort") int sort, @Param(value = "flag") int flag, @Param(value = "id") Integer id); | |
33 | + | |
34 | + int updateSort(Consult consult); | |
35 | + | |
31 | 36 | } |
32 | 37 | \ No newline at end of file | ... | ... |
src/main/java/com/sincere/student/mapper/UniversityMajorMapper.java
src/main/java/com/sincere/student/mapper/VideoMapper.java
... | ... | @@ -2,6 +2,7 @@ package com.sincere.student.mapper; |
2 | 2 | |
3 | 3 | import com.sincere.student.dto.VideoSearchDto; |
4 | 4 | import com.sincere.student.model.Video; |
5 | +import org.apache.ibatis.annotations.Param; | |
5 | 6 | |
6 | 7 | import java.util.List; |
7 | 8 | |
... | ... | @@ -24,4 +25,6 @@ public interface VideoMapper { |
24 | 25 | Video getById(int id); |
25 | 26 | |
26 | 27 | int updateRead(int id); |
28 | + | |
29 | + List<Video> countSort(@Param(value = "sort") int sort, @Param(value = "flag") int flag, @Param(value = "id") Integer id); | |
27 | 30 | } | ... | ... |
src/main/java/com/sincere/student/model/Advert.java
... | ... | @@ -11,21 +11,21 @@ public class Advert implements Serializable { |
11 | 11 | |
12 | 12 | private static final long serialVersionUID = 765348013299664647L; |
13 | 13 | @ApiModelProperty(value = "主键 , 新增接口不用传") |
14 | - private int id ; | |
14 | + private int id; | |
15 | 15 | @ApiModelProperty(value = "广告类型 1:开屏 2:banner 所有接口不用传") |
16 | - private int type ; | |
16 | + private int type; | |
17 | 17 | @ApiModelProperty(value = "必传 图片地址") |
18 | - private String imgUrl ; | |
18 | + private String imgUrl; | |
19 | 19 | @ApiModelProperty(value = "外链") |
20 | - private String urlLink ; | |
20 | + private String urlLink; | |
21 | 21 | @ApiModelProperty(value = "必传 排序") |
22 | - private int sort ; | |
22 | + private int sort; | |
23 | 23 | @ApiModelProperty(value = "状态 预留字段 所有接口不用传") |
24 | - private int status ; | |
24 | + private int status; | |
25 | 25 | @ApiModelProperty(value = "创建时间 所有接口不用传") |
26 | - private Date createTime ; | |
26 | + private Date createTime; | |
27 | 27 | @ApiModelProperty(value = "标题") |
28 | - private String title ; | |
28 | + private String title; | |
29 | 29 | |
30 | 30 | public int getId() { |
31 | 31 | return id; | ... | ... |
src/main/java/com/sincere/student/model/Area.java
... | ... | @@ -4,10 +4,10 @@ import java.util.List; |
4 | 4 | |
5 | 5 | public class Area { |
6 | 6 | |
7 | - private String code ; | |
8 | - private String name ; | |
7 | + private String code; | |
8 | + private String name; | |
9 | 9 | |
10 | - private List<Area> list ; | |
10 | + private List<Area> list; | |
11 | 11 | |
12 | 12 | public List<Area> getList() { |
13 | 13 | return list; | ... | ... |
src/main/java/com/sincere/student/model/Article.java
... | ... | @@ -10,41 +10,41 @@ import java.util.List; |
10 | 10 | public class Article { |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "主键 , 新增接口不用传") |
13 | - private int id ; | |
13 | + private int id; | |
14 | 14 | @ApiModelProperty(value = "必传 标题") |
15 | - private String title ; | |
15 | + private String title; | |
16 | 16 | @ApiModelProperty(value = "栏目 type=1 不用传") |
17 | - private int columnType ; | |
17 | + private int columnType; | |
18 | 18 | @ApiModelProperty(value = "栏目中文") |
19 | - private String columnTypeString ; | |
19 | + private String columnTypeString; | |
20 | 20 | @ApiModelProperty(value = "必传 大学id") |
21 | - private int universityId ; | |
21 | + private int universityId; | |
22 | 22 | @ApiModelProperty(value = "必传 排序") |
23 | - private int sort ; | |
23 | + private int sort; | |
24 | 24 | @ApiModelProperty(value = "内容") |
25 | - private String context ; | |
25 | + private String context; | |
26 | 26 | @ApiModelProperty(value = "必传 作者") |
27 | - private String author ; | |
27 | + private String author; | |
28 | 28 | @ApiModelProperty(value = "封面图片") |
29 | - private String imageUrl ; | |
29 | + private String imageUrl; | |
30 | 30 | @ApiModelProperty(value = "封面图片 展示用") |
31 | - private List<String> imageUrlList ; | |
31 | + private List<String> imageUrlList; | |
32 | 32 | @ApiModelProperty(value = "封面图片数量 展示用") |
33 | - private int imageCount ; | |
33 | + private int imageCount; | |
34 | 34 | @ApiModelProperty(value = "视频链接") |
35 | - private String videoUrl ; | |
35 | + private String videoUrl; | |
36 | 36 | @ApiModelProperty(value = "外链") |
37 | - private String articleLink ; | |
37 | + private String articleLink; | |
38 | 38 | @ApiModelProperty(value = "点赞数 不用传") |
39 | - private int goodNumber ; | |
39 | + private int goodNumber; | |
40 | 40 | @ApiModelProperty(value = "浏览量 不用传") |
41 | - private int lookNumber ; | |
41 | + private int lookNumber; | |
42 | 42 | @ApiModelProperty(value = "创建时间 不用传") |
43 | - private Date createTime ; | |
43 | + private Date createTime; | |
44 | 44 | @ApiModelProperty(value = "文章类型 1广告文章 2权威解读 ") |
45 | - private int type ; | |
45 | + private int type; | |
46 | 46 | @ApiModelProperty(value = "状态 0预览1发布") |
47 | - private int status ; | |
47 | + private int status; | |
48 | 48 | |
49 | 49 | public String getColumnTypeString() { |
50 | 50 | return columnTypeString; |
... | ... | @@ -77,6 +77,7 @@ public class Article { |
77 | 77 | public void setStatus(int status) { |
78 | 78 | this.status = status; |
79 | 79 | } |
80 | + | |
80 | 81 | public int getType() { |
81 | 82 | return type; |
82 | 83 | } | ... | ... |
src/main/java/com/sincere/student/model/ColumnType.java
... | ... | @@ -10,17 +10,17 @@ import java.util.Date; |
10 | 10 | public class ColumnType implements Serializable { |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "主键 , 新增接口不用传") |
13 | - private int id ; | |
13 | + private int id; | |
14 | 14 | @ApiModelProperty(value = "栏目类型(1 文章 2学校 3视频)") |
15 | - private int type ; | |
15 | + private int type; | |
16 | 16 | @ApiModelProperty(value = "名称") |
17 | - private String name ; | |
17 | + private String name; | |
18 | 18 | @ApiModelProperty(value = "排序") |
19 | - private int sort ; | |
19 | + private int sort; | |
20 | 20 | @ApiModelProperty(value = "创建时间, 新增,修改接口不用传") |
21 | - private Date createTime ; | |
21 | + private Date createTime; | |
22 | 22 | @ApiModelProperty(value = "外链,只有type=1传") |
23 | - private String urlLink ; | |
23 | + private String urlLink; | |
24 | 24 | |
25 | 25 | public int getId() { |
26 | 26 | return id; | ... | ... |
src/main/java/com/sincere/student/model/Consult.java
... | ... | @@ -10,17 +10,17 @@ import java.util.List; |
10 | 10 | public class Consult { |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "主键") |
13 | - private int id ; | |
13 | + private int id; | |
14 | 14 | @ApiModelProperty(value = "学校主键") |
15 | - private int universityId ; | |
15 | + private int universityId; | |
16 | 16 | @ApiModelProperty(value = "排序") |
17 | - private int sort ; | |
17 | + private int sort; | |
18 | 18 | @ApiModelProperty(value = "图片地址") |
19 | - private String imgUrl ; | |
19 | + private String imgUrl; | |
20 | 20 | @ApiModelProperty(value = "名称") |
21 | - private String name ; | |
21 | + private String name; | |
22 | 22 | @ApiModelProperty(value = "编码") |
23 | - private String code ; | |
23 | + private String code; | |
24 | 24 | @ApiModelProperty(value = "栏目分类") |
25 | 25 | private Integer columnType; |
26 | 26 | @ApiModelProperty(value = "栏目分类名称") |
... | ... | @@ -38,10 +38,31 @@ public class Consult { |
38 | 38 | @ApiModelProperty(value = "状态") |
39 | 39 | private Integer status; |
40 | 40 | @ApiModelProperty(value = "4个栏目") |
41 | - private List<UniversityConsultDetail> list ; | |
41 | + private List<UniversityConsultDetail> list; | |
42 | 42 | @ApiModelProperty(value = "阅读量") |
43 | 43 | private int readNumber; |
44 | 44 | |
45 | + @ApiModelProperty(value = "背景图片地址") | |
46 | + private String background; | |
47 | + @ApiModelProperty(value = "模板排版信息") | |
48 | + private String modelList; | |
49 | + | |
50 | + public String getBackground() { | |
51 | + return background; | |
52 | + } | |
53 | + | |
54 | + public void setBackground(String background) { | |
55 | + this.background = background; | |
56 | + } | |
57 | + | |
58 | + public String getModelList() { | |
59 | + return modelList; | |
60 | + } | |
61 | + | |
62 | + public void setModelList(String modelList) { | |
63 | + this.modelList = modelList; | |
64 | + } | |
65 | + | |
45 | 66 | public String getColumnTypeString() { |
46 | 67 | return columnTypeString; |
47 | 68 | } | ... | ... |
src/main/java/com/sincere/student/model/Major.java
... | ... | @@ -10,17 +10,17 @@ import java.util.List; |
10 | 10 | public class Major { |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "主键 , 新增接口不用传") |
13 | - private int id ; | |
13 | + private int id; | |
14 | 14 | @ApiModelProperty(value = "必传 专业名") |
15 | - private String major ; | |
15 | + private String major; | |
16 | 16 | @ApiModelProperty(value = "必传 专业编码") |
17 | - private String majorCode ; | |
17 | + private String majorCode; | |
18 | 18 | @ApiModelProperty(value = "父级专业id") //-1 说明是一级专业 |
19 | - private int pid ; | |
19 | + private int pid; | |
20 | 20 | @ApiModelProperty(value = "创建时间") |
21 | - private Date createTime ; | |
21 | + private Date createTime; | |
22 | 22 | |
23 | - private List<Major> children ; | |
23 | + private List<Major> children; | |
24 | 24 | |
25 | 25 | public List<Major> getChildren() { |
26 | 26 | return children; | ... | ... |
src/main/java/com/sincere/student/model/Message.java
... | ... | @@ -19,7 +19,7 @@ public class Message { |
19 | 19 | @ApiModelProperty(value = "不用传") |
20 | 20 | private Date createTime; |
21 | 21 | @ApiModelProperty(value = "相差的时间") |
22 | - private Long[] distanceTimes ; | |
22 | + private Long[] distanceTimes; | |
23 | 23 | |
24 | 24 | public Long[] getDistanceTimes() { |
25 | 25 | return distanceTimes; |
... | ... | @@ -29,7 +29,7 @@ public class Message { |
29 | 29 | this.distanceTimes = distanceTimes; |
30 | 30 | } |
31 | 31 | |
32 | - private List<Reply> list ; | |
32 | + private List<Reply> list; | |
33 | 33 | |
34 | 34 | public List<Reply> getList() { |
35 | 35 | return list; | ... | ... |
src/main/java/com/sincere/student/model/Parameter.java
src/main/java/com/sincere/student/model/Point.java
... | ... | @@ -7,7 +7,7 @@ public class Point { |
7 | 7 | |
8 | 8 | private Integer submitId; |
9 | 9 | private String universityName; |
10 | - private String major ; | |
10 | + private String major; | |
11 | 11 | |
12 | 12 | private Integer grade; |
13 | 13 | |
... | ... | @@ -17,7 +17,7 @@ public class Point { |
17 | 17 | |
18 | 18 | private Date createTime; |
19 | 19 | private String province; |
20 | - private String city ; | |
20 | + private String city; | |
21 | 21 | |
22 | 22 | public Integer getId() { |
23 | 23 | return id; | ... | ... |
src/main/java/com/sincere/student/model/Reply.java
src/main/java/com/sincere/student/model/SubmitFile.java
... | ... | @@ -17,13 +17,13 @@ public class SubmitFile { |
17 | 17 | @ApiModelProperty(value = " 排序") |
18 | 18 | private Integer sort; |
19 | 19 | @ApiModelProperty(value = " 文件路径") |
20 | - private String fileUrl ; | |
20 | + private String fileUrl; | |
21 | 21 | @ApiModelProperty(value = " 文件名称 展示用") |
22 | - private String fileName ; | |
22 | + private String fileName; | |
23 | 23 | @ApiModelProperty(value = "不用传") |
24 | 24 | private Date createTime; |
25 | 25 | @ApiModelProperty(value = "不用传") |
26 | - private List<Point> list ; | |
26 | + private List<Point> list; | |
27 | 27 | |
28 | 28 | public String getFileName() { |
29 | 29 | return fileName; | ... | ... |
src/main/java/com/sincere/student/model/University.java
... | ... | @@ -10,29 +10,29 @@ import java.util.List; |
10 | 10 | public class University { |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "主键 , 新增接口不用传") |
13 | - private int id ; | |
13 | + private int id; | |
14 | 14 | @ApiModelProperty(value = "必传 学校名称") |
15 | - private String name ; | |
15 | + private String name; | |
16 | 16 | @ApiModelProperty(value = "必传 学校编码") |
17 | - private String code ; | |
17 | + private String code; | |
18 | 18 | @ApiModelProperty(value = "必传 高校学科类型") |
19 | - private String universityType ; | |
19 | + private String universityType; | |
20 | 20 | @ApiModelProperty(value = "必传 主管部门") |
21 | 21 | private String department; |
22 | 22 | @ApiModelProperty(value = "必传 所在省") |
23 | - private String province ; | |
23 | + private String province; | |
24 | 24 | @ApiModelProperty(value = "必传 所在市") |
25 | - private String city ; | |
25 | + private String city; | |
26 | 26 | @ApiModelProperty(value = "必传 办学层次") |
27 | - private String level ; | |
27 | + private String level; | |
28 | 28 | @ApiModelProperty(value = "联系方式") |
29 | - private String phone ; | |
29 | + private String phone; | |
30 | 30 | @ApiModelProperty(value = "logo") |
31 | - private String logoUrl ; | |
31 | + private String logoUrl; | |
32 | 32 | @ApiModelProperty(value = "创建时间") |
33 | - private Date createTime ; | |
33 | + private Date createTime; | |
34 | 34 | @ApiModelProperty(value = "专业列表,展示用") |
35 | - private List<Major> majorList ; | |
35 | + private List<Major> majorList; | |
36 | 36 | |
37 | 37 | public String getLogoUrl() { |
38 | 38 | return logoUrl; | ... | ... |
src/main/java/com/sincere/student/model/UniversityConsult.java
... | ... | @@ -18,6 +18,8 @@ public class UniversityConsult { |
18 | 18 | private String videoUrl; |
19 | 19 | @ApiModelProperty(value = "内容") |
20 | 20 | private String context; |
21 | + @ApiModelProperty(value = "背景图片地址") | |
22 | + private String background; | |
21 | 23 | @ApiModelProperty(value = "图片地址") |
22 | 24 | private String imgUrl; |
23 | 25 | @ApiModelProperty(value = "时间") |
... | ... | @@ -27,10 +29,29 @@ public class UniversityConsult { |
27 | 29 | @ApiModelProperty(value = "4个栏目") |
28 | 30 | private List<UniversityConsultDetail> list; |
29 | 31 | @ApiModelProperty(value = "状态 0预览1发布") |
30 | - private int status ; | |
31 | - private int readNumber ; | |
32 | + private int status; | |
33 | + private int readNumber; | |
32 | 34 | @ApiModelProperty(value = "栏目中文") |
33 | - private String columnTypeString ; | |
35 | + private String columnTypeString; | |
36 | + | |
37 | + @ApiModelProperty(value = "模板排版信息") | |
38 | + private String modelList; | |
39 | + | |
40 | + public String getBackground() { | |
41 | + return background; | |
42 | + } | |
43 | + | |
44 | + public void setBackground(String background) { | |
45 | + this.background = background; | |
46 | + } | |
47 | + | |
48 | + public String getModelList() { | |
49 | + return modelList; | |
50 | + } | |
51 | + | |
52 | + public void setModelList(String modelList) { | |
53 | + this.modelList = modelList; | |
54 | + } | |
34 | 55 | |
35 | 56 | public int getReadNumber() { |
36 | 57 | return readNumber; |
... | ... | @@ -55,6 +76,7 @@ public class UniversityConsult { |
55 | 76 | public void setStatus(int status) { |
56 | 77 | this.status = status; |
57 | 78 | } |
79 | + | |
58 | 80 | public List<UniversityConsultDetail> getList() { |
59 | 81 | return list; |
60 | 82 | } | ... | ... |
src/main/java/com/sincere/student/model/UniversityMajor.java
... | ... | @@ -8,9 +8,9 @@ public class UniversityMajor { |
8 | 8 | |
9 | 9 | |
10 | 10 | @ApiModelProperty(value = "高校id") |
11 | - private int universityId ; | |
11 | + private int universityId; | |
12 | 12 | @ApiModelProperty(value = "专业id") |
13 | - private int majorId ; | |
13 | + private int majorId; | |
14 | 14 | |
15 | 15 | public int getUniversityId() { |
16 | 16 | return universityId; | ... | ... |
src/main/java/com/sincere/student/model/Video.java
... | ... | @@ -10,38 +10,38 @@ import java.util.List; |
10 | 10 | public class Video { |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "主键 , 新增接口不用传") |
13 | - private int id ; | |
13 | + private int id; | |
14 | 14 | @ApiModelProperty(value = "学校") |
15 | - private int universityId ; | |
15 | + private int universityId; | |
16 | 16 | @ApiModelProperty(value = "栏目") |
17 | - private int columnType ; | |
17 | + private int columnType; | |
18 | 18 | @ApiModelProperty(value = "栏目中文") |
19 | - private String columnTypeString ; | |
19 | + private String columnTypeString; | |
20 | 20 | @ApiModelProperty(value = "视频路径") |
21 | - private String videoUrl ; | |
21 | + private String videoUrl; | |
22 | 22 | |
23 | 23 | @ApiModelProperty(value = "视频路径") |
24 | - private List<String> videoUrlList ; | |
24 | + private List<String> videoUrlList; | |
25 | 25 | @ApiModelProperty(value = "排序") |
26 | - private int sort ; | |
26 | + private int sort; | |
27 | 27 | @ApiModelProperty(value = "创建时间") |
28 | - private Date createTime ; | |
28 | + private Date createTime; | |
29 | 29 | @ApiModelProperty(value = "学校名称 展示用") |
30 | 30 | private String name; |
31 | 31 | @ApiModelProperty(value = "学校编码 展示用") |
32 | 32 | private String code; |
33 | 33 | @ApiModelProperty(value = "状态 0预览1发布") |
34 | - private int status ; | |
34 | + private int status; | |
35 | 35 | @ApiModelProperty(value = "图片地址 展示用 学校logo") |
36 | - private String imgUrl ; | |
36 | + private String imgUrl; | |
37 | 37 | @ApiModelProperty(value = "视频时长") |
38 | - private String duration ; | |
38 | + private String duration; | |
39 | 39 | @ApiModelProperty(value = "视频标题") |
40 | - private String videoName ; | |
40 | + private String videoName; | |
41 | 41 | @ApiModelProperty(value = "视频封面") |
42 | - private String coverUrl ; | |
42 | + private String coverUrl; | |
43 | 43 | @ApiModelProperty(value = "阅读量") |
44 | - private int readNumber ; | |
44 | + private int readNumber; | |
45 | 45 | |
46 | 46 | public String getColumnTypeString() { |
47 | 47 | return columnTypeString; | ... | ... |
src/main/java/com/sincere/student/service/ColumnService.java
src/main/java/com/sincere/student/service/ConsultService.java
... | ... | @@ -12,9 +12,9 @@ public interface ConsultService { |
12 | 12 | |
13 | 13 | Page<Consult> getList(ConsultSearchDto consultSearchDto); |
14 | 14 | |
15 | - List<Consult> selectByUniversityIdAndColumnType(int universityId , int columnType); | |
15 | + List<Consult> selectByUniversityIdAndColumnType(int universityId, int columnType); | |
16 | 16 | |
17 | - Page<Consult> getColumnList(int columnType ,int page ,int pageSize); | |
17 | + Page<Consult> getColumnList(int columnType, int page, int pageSize); | |
18 | 18 | |
19 | 19 | Consult getDetail(int id); |
20 | 20 | ... | ... |
src/main/java/com/sincere/student/service/UniversityService.java
src/main/java/com/sincere/student/service/UserService.java
src/main/java/com/sincere/student/service/impl/AdvertServiceImpl.java
... | ... | @@ -13,15 +13,15 @@ import java.util.List; |
13 | 13 | public class AdvertServiceImpl implements AdvertService { |
14 | 14 | |
15 | 15 | @Autowired |
16 | - AdvertMapper advertMapper ; | |
16 | + AdvertMapper advertMapper; | |
17 | 17 | |
18 | 18 | @Override |
19 | 19 | public Advert getScreen() { |
20 | 20 | List<Advert> list = advertMapper.getList(AdvertEnums.screen.getType()); |
21 | - if(list != null && list.size() > 0){ | |
21 | + if (list != null && list.size() > 0) { | |
22 | 22 | return list.get(0); |
23 | - }else { | |
24 | - return null ; | |
23 | + } else { | |
24 | + return null; | |
25 | 25 | } |
26 | 26 | } |
27 | 27 | ... | ... |
src/main/java/com/sincere/student/service/impl/ArticleServiceImpl.java
... | ... | @@ -4,11 +4,13 @@ import com.github.pagehelper.PageHelper; |
4 | 4 | import com.sincere.student.dto.ArticleSearchDto; |
5 | 5 | import com.sincere.student.mapper.ArticleMapper; |
6 | 6 | import com.sincere.student.model.Article; |
7 | +import com.sincere.student.model.Consult; | |
7 | 8 | import com.sincere.student.service.ArticleService; |
8 | 9 | import com.sincere.student.utils.Page; |
9 | 10 | import org.apache.commons.lang3.StringUtils; |
10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 12 | import org.springframework.stereotype.Service; |
13 | +import org.springframework.util.CollectionUtils; | |
12 | 14 | |
13 | 15 | import java.util.ArrayList; |
14 | 16 | import java.util.Arrays; |
... | ... | @@ -23,28 +25,28 @@ public class ArticleServiceImpl implements ArticleService { |
23 | 25 | |
24 | 26 | @Override |
25 | 27 | public Page<Article> getList(ArticleSearchDto articleSearchDto) { |
26 | - Page<Article> result = new Page<>(articleSearchDto.getPage(),articleSearchDto.getPageSize()); | |
27 | - if(StringUtils.isNotBlank(articleSearchDto.getTitle())){ | |
28 | - articleSearchDto.setTitle("%"+articleSearchDto.getTitle()+"%"); | |
28 | + Page<Article> result = new Page<>(articleSearchDto.getPage(), articleSearchDto.getPageSize()); | |
29 | + if (StringUtils.isNotBlank(articleSearchDto.getTitle())) { | |
30 | + articleSearchDto.setTitle("%" + articleSearchDto.getTitle() + "%"); | |
29 | 31 | } |
30 | - PageHelper.startPage(articleSearchDto.getPage(),articleSearchDto.getPageSize()); | |
31 | - List<Article> list = articleMapper.getList(articleSearchDto) ; | |
32 | - for(Article article : list){ | |
32 | + PageHelper.startPage(articleSearchDto.getPage(), articleSearchDto.getPageSize()); | |
33 | + List<Article> list = articleMapper.getList(articleSearchDto); | |
34 | + for (Article article : list) { | |
33 | 35 | String[] urlList = article.getImageUrl().split(","); |
34 | 36 | article.setImageUrlList(Arrays.asList(urlList)); |
35 | 37 | article.setImageCount(urlList.length); |
36 | 38 | } |
37 | 39 | List<Article> addAdvertList = new ArrayList<>(); |
38 | - for(int i = 0 ; i < list.size() ;i++){ | |
40 | + for (int i = 0; i < list.size(); i++) { | |
39 | 41 | addAdvertList.add(list.get(i)); |
40 | - if(i % 6 ==5){ | |
41 | - try{ | |
42 | - Article advert =articleMapper.getAdvert(); | |
42 | + if (i % 6 == 5) { | |
43 | + try { | |
44 | + Article advert = articleMapper.getAdvert(); | |
43 | 45 | String[] urlList = advert.getImageUrl().split(","); |
44 | 46 | advert.setImageUrlList(Arrays.asList(urlList)); |
45 | 47 | advert.setImageCount(urlList.length); |
46 | 48 | addAdvertList.add(advert); |
47 | - }catch (Exception e){ | |
49 | + } catch (Exception e) { | |
48 | 50 | |
49 | 51 | } |
50 | 52 | } |
... | ... | @@ -56,13 +58,13 @@ public class ArticleServiceImpl implements ArticleService { |
56 | 58 | |
57 | 59 | @Override |
58 | 60 | public Page<Article> getAdminList(ArticleSearchDto articleSearchDto) { |
59 | - Page<Article> result = new Page<>(articleSearchDto.getPage(),articleSearchDto.getPageSize()); | |
60 | - if(StringUtils.isNotBlank(articleSearchDto.getTitle())){ | |
61 | - articleSearchDto.setTitle("%"+articleSearchDto.getTitle()+"%"); | |
61 | + Page<Article> result = new Page<>(articleSearchDto.getPage(), articleSearchDto.getPageSize()); | |
62 | + if (StringUtils.isNotBlank(articleSearchDto.getTitle())) { | |
63 | + articleSearchDto.setTitle("%" + articleSearchDto.getTitle() + "%"); | |
62 | 64 | } |
63 | - PageHelper.startPage(articleSearchDto.getPage(),articleSearchDto.getPageSize()); | |
64 | - List<Article> list = articleMapper.getList(articleSearchDto) ; | |
65 | - for(Article article : list){ | |
65 | + PageHelper.startPage(articleSearchDto.getPage(), articleSearchDto.getPageSize()); | |
66 | + List<Article> list = articleMapper.getList(articleSearchDto); | |
67 | + for (Article article : list) { | |
66 | 68 | String[] urlList = article.getImageUrl().split(","); |
67 | 69 | article.setImageUrlList(Arrays.asList(urlList)); |
68 | 70 | article.setImageCount(urlList.length); |
... | ... | @@ -83,16 +85,31 @@ public class ArticleServiceImpl implements ArticleService { |
83 | 85 | String[] urlList = article.getImageUrl().split(","); |
84 | 86 | article.setImageUrlList(Arrays.asList(urlList)); |
85 | 87 | article.setImageCount(urlList.length); |
86 | - return article ; | |
88 | + return article; | |
87 | 89 | } |
88 | 90 | |
89 | 91 | @Override |
90 | 92 | public int create(Article article) { |
91 | - if(article.getType() == 1){ | |
93 | + if (article.getType() == 1) { | |
92 | 94 | article.setColumnType(0); |
93 | 95 | } |
96 | + //排序 | |
97 | + Integer sort = article.getSort(); | |
98 | + List<Article> articleList = articleMapper.countSort(sort.intValue(), 1, null); | |
99 | + if (!CollectionUtils.isEmpty(articleList)) { | |
100 | + int i = 1; | |
101 | + for (Article oldArticle : articleList) { | |
102 | + int add = i + sort; | |
103 | + if (add > oldArticle.getSort()) { | |
104 | + //若已存在自增1 | |
105 | + oldArticle.setSort(oldArticle.getSort() + 1); | |
106 | + articleMapper.update(oldArticle); | |
107 | + } | |
108 | + i++; | |
109 | + } | |
110 | + } | |
94 | 111 | articleMapper.create(article); |
95 | - return article.getId() ; | |
112 | + return article.getId(); | |
96 | 113 | } |
97 | 114 | |
98 | 115 | @Override |
... | ... | @@ -102,9 +119,24 @@ public class ArticleServiceImpl implements ArticleService { |
102 | 119 | |
103 | 120 | @Override |
104 | 121 | public int update(Article article) { |
105 | - if(article.getType() == 1){ | |
122 | + if (article.getType() == 1) { | |
106 | 123 | article.setColumnType(0); |
107 | 124 | } |
125 | + //排序 | |
126 | + Integer sort = article.getSort(); | |
127 | + List<Article> articleList = articleMapper.countSort(sort.intValue(), 2, article.getId()); | |
128 | + if (!CollectionUtils.isEmpty(articleList)) { | |
129 | + int i = 1; | |
130 | + for (Article oldArticle : articleList) { | |
131 | + int add = i + sort; | |
132 | + if (add > oldArticle.getSort()) { | |
133 | + //若已存在自增1 | |
134 | + oldArticle.setSort(oldArticle.getSort() + 1); | |
135 | + articleMapper.update(oldArticle); | |
136 | + } | |
137 | + i++; | |
138 | + } | |
139 | + } | |
108 | 140 | return articleMapper.update(article); |
109 | 141 | } |
110 | 142 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/ColumnServiceImpl.java
... | ... | @@ -7,6 +7,7 @@ import com.sincere.student.service.ColumnService; |
7 | 7 | import org.apache.commons.lang3.StringUtils; |
8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 9 | import org.springframework.stereotype.Service; |
10 | +import org.springframework.util.CollectionUtils; | |
10 | 11 | |
11 | 12 | import java.util.List; |
12 | 13 | |
... | ... | @@ -14,12 +15,12 @@ import java.util.List; |
14 | 15 | public class ColumnServiceImpl implements ColumnService { |
15 | 16 | |
16 | 17 | @Autowired |
17 | - ColumnMapper columnMapper ; | |
18 | + ColumnMapper columnMapper; | |
18 | 19 | |
19 | 20 | @Override |
20 | 21 | public List<ColumnType> getList(ColumnDto columnDto) { |
21 | - if(StringUtils.isNotBlank(columnDto.getName())){ | |
22 | - columnDto.setName("%"+columnDto.getName()+"%"); | |
22 | + if (StringUtils.isNotBlank(columnDto.getName())) { | |
23 | + columnDto.setName("%" + columnDto.getName() + "%"); | |
23 | 24 | } |
24 | 25 | return columnMapper.getList(columnDto); |
25 | 26 | } |
... | ... | @@ -31,11 +32,46 @@ public class ColumnServiceImpl implements ColumnService { |
31 | 32 | |
32 | 33 | @Override |
33 | 34 | public int create(ColumnType columnType) { |
35 | + //栏目类型 | |
36 | + Integer type = columnType.getType(); | |
37 | + //栏目排序 | |
38 | + Integer sort = columnType.getSort(); | |
39 | + List<ColumnType> countList = columnMapper.countSort(sort.intValue(), type.intValue(), 1, null); | |
40 | + if (!CollectionUtils.isEmpty(countList)) { | |
41 | + int i = 1; | |
42 | + for (ColumnType oldType : countList) { | |
43 | + int addSort = i + sort; | |
44 | + if (addSort > oldType.getSort()) { | |
45 | + //若已存在自增1 | |
46 | + oldType.setSort(oldType.getSort() + 1); | |
47 | + columnMapper.update(oldType); | |
48 | + } | |
49 | + i++; | |
50 | + } | |
51 | + } | |
34 | 52 | return columnMapper.create(columnType); |
35 | 53 | } |
36 | 54 | |
37 | 55 | @Override |
38 | 56 | public int update(ColumnType columnType) { |
57 | + ColumnType colum = columnMapper.selectDetail(columnType.getId()); | |
58 | + //栏目类型 | |
59 | + Integer type = columnType.getType(); | |
60 | + //栏目排序 | |
61 | + Integer sort = columnType.getSort(); | |
62 | + List<ColumnType> countList = columnMapper.countSort(sort.intValue(), type.intValue(), 2, columnType.getId()); | |
63 | + if (!CollectionUtils.isEmpty(countList)) { | |
64 | + int i = 1; | |
65 | + for (ColumnType oldType : countList) { | |
66 | + int addSort = i + sort; | |
67 | + if (addSort > oldType.getSort()) { | |
68 | + //若已存在自增1 | |
69 | + oldType.setSort(oldType.getSort() + 1); | |
70 | + columnMapper.update(oldType); | |
71 | + } | |
72 | + i++; | |
73 | + } | |
74 | + } | |
39 | 75 | return columnMapper.update(columnType); |
40 | 76 | } |
41 | 77 | ... | ... |
src/main/java/com/sincere/student/service/impl/CommonServiceImpl.java
... | ... | @@ -12,7 +12,7 @@ import java.util.List; |
12 | 12 | public class CommonServiceImpl implements CommonService { |
13 | 13 | |
14 | 14 | @Autowired |
15 | - AreaMapper areaMapper ; | |
15 | + AreaMapper areaMapper; | |
16 | 16 | |
17 | 17 | @Override |
18 | 18 | public List<Area> getProvince() { |
... | ... | @@ -21,7 +21,7 @@ public class CommonServiceImpl implements CommonService { |
21 | 21 | |
22 | 22 | @Override |
23 | 23 | public List<Area> getCity(String code) { |
24 | - code = code + "%" ; | |
24 | + code = code + "%"; | |
25 | 25 | return areaMapper.getCity(code); |
26 | 26 | } |
27 | 27 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/ConsultServiceImpl.java
... | ... | @@ -7,15 +7,13 @@ import com.sincere.student.enums.ColumnEnums; |
7 | 7 | import com.sincere.student.mapper.ColumnMapper; |
8 | 8 | import com.sincere.student.mapper.UniversityConsultDetailMapper; |
9 | 9 | import com.sincere.student.mapper.UniversityConsultMapper; |
10 | -import com.sincere.student.model.ColumnType; | |
11 | -import com.sincere.student.model.Consult; | |
12 | -import com.sincere.student.model.UniversityConsult; | |
13 | -import com.sincere.student.model.UniversityConsultDetail; | |
10 | +import com.sincere.student.model.*; | |
14 | 11 | import com.sincere.student.service.ConsultService; |
15 | 12 | import com.sincere.student.utils.Page; |
16 | 13 | import org.apache.commons.lang3.StringUtils; |
17 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
18 | 15 | import org.springframework.stereotype.Service; |
16 | +import org.springframework.util.CollectionUtils; | |
19 | 17 | |
20 | 18 | import java.util.Arrays; |
21 | 19 | import java.util.List; |
... | ... | @@ -24,13 +22,13 @@ import java.util.List; |
24 | 22 | public class ConsultServiceImpl implements ConsultService { |
25 | 23 | |
26 | 24 | @Autowired |
27 | - UniversityConsultMapper universityConsultMapper ; | |
25 | + UniversityConsultMapper universityConsultMapper; | |
28 | 26 | |
29 | 27 | @Autowired |
30 | - UniversityConsultDetailMapper universityConsultDetailMapper ; | |
28 | + UniversityConsultDetailMapper universityConsultDetailMapper; | |
31 | 29 | |
32 | 30 | @Autowired |
33 | - ColumnMapper columnMapper ; | |
31 | + ColumnMapper columnMapper; | |
34 | 32 | |
35 | 33 | @Override |
36 | 34 | public List<Consult> selectByUniversityIdAndColumnType(int universityId, int columnType) { |
... | ... | @@ -42,21 +40,23 @@ public class ConsultServiceImpl implements ConsultService { |
42 | 40 | |
43 | 41 | @Override |
44 | 42 | public Page<Consult> getList(ConsultSearchDto consultSearchDto) { |
45 | - Page<Consult> page = new Page<>(consultSearchDto.getPage(),consultSearchDto.getPageSize()); | |
46 | - if(StringUtils.isNotBlank(consultSearchDto.getUniversityName())){ | |
47 | - consultSearchDto.setUniversityName("%"+consultSearchDto.getUniversityName()+"%"); | |
43 | + Page<Consult> page = new Page<>(consultSearchDto.getPage(), consultSearchDto.getPageSize()); | |
44 | + if (StringUtils.isNotBlank(consultSearchDto.getUniversityName())) { | |
45 | + consultSearchDto.setUniversityName("%" + consultSearchDto.getUniversityName() + "%"); | |
48 | 46 | } |
49 | - if(StringUtils.isNotBlank(consultSearchDto.getMajorName())){ | |
50 | - consultSearchDto.setMajorName("%"+consultSearchDto.getMajorName()+"%"); | |
47 | + if (StringUtils.isNotBlank(consultSearchDto.getMajorName())) { | |
48 | + consultSearchDto.setMajorName("%" + consultSearchDto.getMajorName() + "%"); | |
51 | 49 | } |
52 | - PageHelper.startPage(consultSearchDto.getPage(),consultSearchDto.getPageSize()); | |
53 | - List<Consult> list =universityConsultMapper.getList(consultSearchDto) ; | |
50 | + PageHelper.startPage(consultSearchDto.getPage(), consultSearchDto.getPageSize()); | |
51 | + List<Consult> list = universityConsultMapper.getList(consultSearchDto); | |
54 | 52 | ColumnDto columnDto = new ColumnDto(); |
55 | 53 | columnDto.setType(ColumnEnums.university.getType()); |
56 | 54 | List<ColumnType> columnTypes = columnMapper.getList(columnDto); |
57 | - for(Consult consult : list){ | |
58 | - for(ColumnType columnType :columnTypes){ | |
59 | - if(consult.getColumnType() == columnType.getId()){ | |
55 | + for (Consult consult : list) { | |
56 | + Consult newConsut = universityConsultMapper.selectByPrimaryKey(consult.getId()); | |
57 | + consult.setModelList(newConsut.getModelList()); | |
58 | + for (ColumnType columnType : columnTypes) { | |
59 | + if (consult.getColumnType() == columnType.getId()) { | |
60 | 60 | consult.setColumnTypeName(columnType.getName()); |
61 | 61 | } |
62 | 62 | } |
... | ... | @@ -67,9 +67,9 @@ public class ConsultServiceImpl implements ConsultService { |
67 | 67 | } |
68 | 68 | |
69 | 69 | @Override |
70 | - public Page<Consult> getColumnList(int columnType , int page ,int pageSize) { | |
71 | - Page<Consult> result = new Page<>(page,pageSize); | |
72 | - PageHelper.startPage(page,pageSize); | |
70 | + public Page<Consult> getColumnList(int columnType, int page, int pageSize) { | |
71 | + Page<Consult> result = new Page<>(page, pageSize); | |
72 | + PageHelper.startPage(page, pageSize); | |
73 | 73 | result.setList(universityConsultMapper.getColumnList(columnType)); |
74 | 74 | result.setCount(universityConsultMapper.getColumnListCount(columnType)); |
75 | 75 | return result; |
... | ... | @@ -79,41 +79,71 @@ public class ConsultServiceImpl implements ConsultService { |
79 | 79 | public Consult getDetail(int id) { |
80 | 80 | Consult consult = universityConsultMapper.selectByPrimaryKey(id); |
81 | 81 | universityConsultMapper.updateRead(id); |
82 | - try{ | |
82 | + try { | |
83 | 83 | consult.setVideoUrlList(Arrays.asList(consult.getVideoUrl().split(","))); |
84 | - }catch (Exception e){ | |
84 | + } catch (Exception e) { | |
85 | 85 | |
86 | 86 | } |
87 | 87 | consult.setList(universityConsultDetailMapper.selectByConsult(id)); |
88 | - return consult ; | |
88 | + return consult; | |
89 | 89 | } |
90 | 90 | |
91 | 91 | @Override |
92 | 92 | public int create(UniversityConsult consult) { |
93 | + //排序 | |
94 | + Integer sort = consult.getSort(); | |
95 | + List<Consult> consultList = universityConsultMapper.countSort(sort.intValue(), 1, null); | |
96 | + if (!CollectionUtils.isEmpty(consultList)) { | |
97 | + int i = 1; | |
98 | + for (Consult oldConsult : consultList) { | |
99 | + int addSort = i + sort; | |
100 | + if (addSort > oldConsult.getSort()) { | |
101 | + //若已存在自增1 | |
102 | + oldConsult.setSort(oldConsult.getSort() + 1); | |
103 | + universityConsultMapper.updateSort(oldConsult); | |
104 | + } | |
105 | + i++; | |
106 | + } | |
107 | + } | |
93 | 108 | universityConsultMapper.insert(consult); |
94 | - for(UniversityConsultDetail detail : consult.getList()){ | |
109 | + for (UniversityConsultDetail detail : consult.getList()) { | |
95 | 110 | detail.setConsultId(consult.getId()); |
96 | 111 | universityConsultDetailMapper.insert(detail); |
97 | 112 | } |
98 | - return consult.getId() ; | |
113 | + return consult.getId(); | |
99 | 114 | } |
100 | 115 | |
101 | 116 | @Override |
102 | 117 | public int update(UniversityConsult consult) { |
118 | + //排序 | |
119 | + Integer sort = consult.getSort(); | |
120 | + List<Consult> consultList = universityConsultMapper.countSort(sort.intValue(), 2, consult.getId()); | |
121 | + if (!CollectionUtils.isEmpty(consultList)) { | |
122 | + int i = 1; | |
123 | + for (Consult oldConsult : consultList) { | |
124 | + int addSort = i + sort; | |
125 | + if (addSort > oldConsult.getSort()) { | |
126 | + //若已存在自增1 | |
127 | + oldConsult.setSort(oldConsult.getSort() + 1); | |
128 | + universityConsultMapper.updateSort(oldConsult); | |
129 | + } | |
130 | + i++; | |
131 | + } | |
132 | + } | |
103 | 133 | universityConsultMapper.updateByPrimaryKeySelective(consult); |
104 | 134 | universityConsultDetailMapper.deleteByPrimaryKey(consult.getId()); |
105 | - for(UniversityConsultDetail detail : consult.getList()){ | |
135 | + for (UniversityConsultDetail detail : consult.getList()) { | |
106 | 136 | detail.setConsultId(consult.getId()); |
107 | 137 | universityConsultDetailMapper.insert(detail); |
108 | 138 | } |
109 | - return 1 ; | |
139 | + return 1; | |
110 | 140 | } |
111 | 141 | |
112 | 142 | @Override |
113 | 143 | public int delete(int id) { |
114 | 144 | universityConsultMapper.deleteByPrimaryKey(id); |
115 | 145 | universityConsultDetailMapper.deleteByPrimaryKey(id); |
116 | - return 1 ; | |
146 | + return 1; | |
117 | 147 | |
118 | 148 | } |
119 | 149 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/MajorServiceImpl.java
... | ... | @@ -16,23 +16,23 @@ import java.util.List; |
16 | 16 | public class MajorServiceImpl implements MajorService { |
17 | 17 | |
18 | 18 | @Autowired |
19 | - MajorMapper majorMapper ; | |
19 | + MajorMapper majorMapper; | |
20 | 20 | |
21 | 21 | @Override |
22 | 22 | public Page<Major> getList(MajorSearchDto majorSearchDto) { |
23 | - Page<Major> page = new Page<>(majorSearchDto.getPage(),majorSearchDto.getPageSize()); | |
24 | - Major major = new Major() ; | |
25 | - if(StringUtils.isNotBlank(majorSearchDto.getSearch())){ | |
26 | - major.setMajor("%"+majorSearchDto.getSearch()+"%"); | |
23 | + Page<Major> page = new Page<>(majorSearchDto.getPage(), majorSearchDto.getPageSize()); | |
24 | + Major major = new Major(); | |
25 | + if (StringUtils.isNotBlank(majorSearchDto.getSearch())) { | |
26 | + major.setMajor("%" + majorSearchDto.getSearch() + "%"); | |
27 | 27 | } |
28 | - if(majorSearchDto.getPid() != 0){ | |
28 | + if (majorSearchDto.getPid() != 0) { | |
29 | 29 | major.setPid(majorSearchDto.getPid()); |
30 | 30 | } |
31 | - PageHelper.startPage(majorSearchDto.getPage(),majorSearchDto.getPageSize()); | |
31 | + PageHelper.startPage(majorSearchDto.getPage(), majorSearchDto.getPageSize()); | |
32 | 32 | List<Major> list = majorMapper.getList(major); |
33 | 33 | page.setList(list); |
34 | 34 | page.setCount(majorMapper.getListCount(major)); |
35 | - return page ; | |
35 | + return page; | |
36 | 36 | } |
37 | 37 | |
38 | 38 | @Override |
... | ... | @@ -42,7 +42,7 @@ public class MajorServiceImpl implements MajorService { |
42 | 42 | |
43 | 43 | @Override |
44 | 44 | public int create(Major major) { |
45 | - if(major.getPid() == 0){ //说明是一级专业 | |
45 | + if (major.getPid() == 0) { //说明是一级专业 | |
46 | 46 | major.setPid(-1); |
47 | 47 | } |
48 | 48 | return majorMapper.create(major); | ... | ... |
src/main/java/com/sincere/student/service/impl/MessageServiceImpl.java
... | ... | @@ -20,24 +20,24 @@ import java.util.List; |
20 | 20 | public class MessageServiceImpl implements MessageService { |
21 | 21 | |
22 | 22 | @Autowired |
23 | - UniversityMessageMapper messageMapper ; | |
23 | + UniversityMessageMapper messageMapper; | |
24 | 24 | |
25 | 25 | @Autowired |
26 | - UniversityReplyMapper replyMapper ; | |
26 | + UniversityReplyMapper replyMapper; | |
27 | 27 | |
28 | 28 | @Override |
29 | 29 | public Page<Message> getList(MessageSearchDto messageSearchDto) { |
30 | - Page<Message> page = new Page<>(messageSearchDto.getPage(),messageSearchDto.getPageSize()); | |
31 | - if(StringUtils.isNotBlank(messageSearchDto.getSearch())){ | |
32 | - messageSearchDto.setSearch("%"+messageSearchDto.getSearch()+"%"); | |
30 | + Page<Message> page = new Page<>(messageSearchDto.getPage(), messageSearchDto.getPageSize()); | |
31 | + if (StringUtils.isNotBlank(messageSearchDto.getSearch())) { | |
32 | + messageSearchDto.setSearch("%" + messageSearchDto.getSearch() + "%"); | |
33 | 33 | } |
34 | - PageHelper.startPage(messageSearchDto.getPage(),messageSearchDto.getPageSize()); | |
35 | - List<Message> list = messageMapper.getList(messageSearchDto) ; | |
36 | - for(Message message : list){ | |
37 | - message.setDistanceTimes(DateUtils.getDistanceTimes(new Date(),message.getCreateTime())); | |
34 | + PageHelper.startPage(messageSearchDto.getPage(), messageSearchDto.getPageSize()); | |
35 | + List<Message> list = messageMapper.getList(messageSearchDto); | |
36 | + for (Message message : list) { | |
37 | + message.setDistanceTimes(DateUtils.getDistanceTimes(new Date(), message.getCreateTime())); | |
38 | 38 | List<Reply> replies = replyMapper.selectByMessageId(message.getId()); |
39 | - for(Reply reply : replies){ | |
40 | - reply.setDistanceTimes(DateUtils.getDistanceTimes(new Date(),reply.getCreateTime())); | |
39 | + for (Reply reply : replies) { | |
40 | + reply.setDistanceTimes(DateUtils.getDistanceTimes(new Date(), reply.getCreateTime())); | |
41 | 41 | } |
42 | 42 | message.setList(replies); |
43 | 43 | } |
... | ... | @@ -67,7 +67,7 @@ public class MessageServiceImpl implements MessageService { |
67 | 67 | public Message getDetail(int id) { |
68 | 68 | Message message = messageMapper.getDetail(id); |
69 | 69 | message.setList(replyMapper.selectByMessageId(id)); |
70 | - return message ; | |
70 | + return message; | |
71 | 71 | } |
72 | 72 | |
73 | 73 | @Override | ... | ... |
src/main/java/com/sincere/student/service/impl/ParameterServiceImpl.java
... | ... | @@ -13,12 +13,12 @@ import java.util.List; |
13 | 13 | public class ParameterServiceImpl implements ParameterService { |
14 | 14 | |
15 | 15 | @Autowired |
16 | - ParameterMapper parameterMapper ; | |
16 | + ParameterMapper parameterMapper; | |
17 | 17 | |
18 | 18 | @Override |
19 | 19 | public Parameter getByCode(String code) { |
20 | 20 | List<Parameter> list = parameterMapper.getByCode(code); |
21 | - if(list != null && list.size() > 0){ | |
21 | + if (list != null && list.size() > 0) { | |
22 | 22 | return list.get(0); |
23 | 23 | } |
24 | 24 | return null; |
... | ... | @@ -35,9 +35,13 @@ public class ParameterServiceImpl implements ParameterService { |
35 | 35 | } |
36 | 36 | |
37 | 37 | @Override |
38 | - public int insertAccessToken(AccessToken accessToken){return parameterMapper.insertAccessToken(accessToken);} | |
38 | + public int insertAccessToken(AccessToken accessToken) { | |
39 | + return parameterMapper.insertAccessToken(accessToken); | |
40 | + } | |
39 | 41 | |
40 | 42 | @Override |
41 | - public AccessToken getAccessToken(){return parameterMapper.getAccessToken();} | |
43 | + public AccessToken getAccessToken() { | |
44 | + return parameterMapper.getAccessToken(); | |
45 | + } | |
42 | 46 | |
43 | 47 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/SubmitServiceImpl.java
... | ... | @@ -21,18 +21,18 @@ import java.util.List; |
21 | 21 | public class SubmitServiceImpl implements SubmitService { |
22 | 22 | |
23 | 23 | @Autowired |
24 | - UniversityPointMapper pointMapper ; | |
24 | + UniversityPointMapper pointMapper; | |
25 | 25 | |
26 | 26 | @Autowired |
27 | - UniversitySubmitFileMapper submitFileMapper ; | |
27 | + UniversitySubmitFileMapper submitFileMapper; | |
28 | 28 | |
29 | 29 | @Override |
30 | 30 | public Page<SubmitFile> getAdminList(MessageSearchDto dto) { |
31 | - Page<SubmitFile> result = new Page<>(dto.getPage(),dto.getPageSize()); | |
32 | - PageHelper.startPage(dto.getPage(),dto.getPageSize()); | |
33 | - List<SubmitFile> list = submitFileMapper.getList(dto) ; | |
34 | - for(SubmitFile submitFile : list){ | |
35 | - String fileName = submitFile.getFileUrl().substring(submitFile.getFileUrl().lastIndexOf("/")+1); | |
31 | + Page<SubmitFile> result = new Page<>(dto.getPage(), dto.getPageSize()); | |
32 | + PageHelper.startPage(dto.getPage(), dto.getPageSize()); | |
33 | + List<SubmitFile> list = submitFileMapper.getList(dto); | |
34 | + for (SubmitFile submitFile : list) { | |
35 | + String fileName = submitFile.getFileUrl().substring(submitFile.getFileUrl().lastIndexOf("/") + 1); | |
36 | 36 | submitFile.setFileName(fileName); |
37 | 37 | } |
38 | 38 | result.setList(list); |
... | ... | @@ -42,14 +42,14 @@ public class SubmitServiceImpl implements SubmitService { |
42 | 42 | |
43 | 43 | @Override |
44 | 44 | public Page<SubmitLine> getAppList(PointSearchDto dto) { |
45 | - Page<SubmitLine> result = new Page<>(dto.getPage(),dto.getPageSize()); | |
46 | - if(StringUtils.isNotBlank(dto.getMajorName())){ | |
47 | - dto.setMajorName("%"+dto.getMajorName()+"%"); | |
45 | + Page<SubmitLine> result = new Page<>(dto.getPage(), dto.getPageSize()); | |
46 | + if (StringUtils.isNotBlank(dto.getMajorName())) { | |
47 | + dto.setMajorName("%" + dto.getMajorName() + "%"); | |
48 | 48 | } |
49 | - if(StringUtils.isNotBlank(dto.getUniversityName())){ | |
50 | - dto.setUniversityName("%"+dto.getUniversityName()+"%"); | |
49 | + if (StringUtils.isNotBlank(dto.getUniversityName())) { | |
50 | + dto.setUniversityName("%" + dto.getUniversityName() + "%"); | |
51 | 51 | } |
52 | - PageHelper.startPage(dto.getPage(),dto.getPageSize()); | |
52 | + PageHelper.startPage(dto.getPage(), dto.getPageSize()); | |
53 | 53 | result.setList(submitFileMapper.getAppList(dto)); |
54 | 54 | result.setCount(submitFileMapper.getAppListCount(dto)); |
55 | 55 | return result; |
... | ... | @@ -58,18 +58,18 @@ public class SubmitServiceImpl implements SubmitService { |
58 | 58 | @Override |
59 | 59 | public int create(SubmitFile submitFile) { |
60 | 60 | submitFileMapper.insert(submitFile); |
61 | - int i = 0 ; | |
61 | + int i = 0; | |
62 | 62 | List<Point> list = new ArrayList<>(); |
63 | - for(Point point :submitFile.getList()){ | |
63 | + for (Point point : submitFile.getList()) { | |
64 | 64 | point.setSubmitId(submitFile.getId()); |
65 | - i++ ; | |
65 | + i++; | |
66 | 66 | list.add(point); |
67 | - if(i % 100 == 0){ | |
67 | + if (i % 100 == 0) { | |
68 | 68 | pointMapper.insertBatch(list); |
69 | 69 | list = new ArrayList<>(); |
70 | 70 | } |
71 | 71 | } |
72 | - if(list.size() > 0){ | |
72 | + if (list.size() > 0) { | |
73 | 73 | pointMapper.insertBatch(list); |
74 | 74 | } |
75 | 75 | return 1; |
... | ... | @@ -83,7 +83,7 @@ public class SubmitServiceImpl implements SubmitService { |
83 | 83 | } |
84 | 84 | |
85 | 85 | @Override |
86 | - public int update(SubmitFile submitFile){ | |
86 | + public int update(SubmitFile submitFile) { | |
87 | 87 | if (StringUtils.isNotBlank(submitFile.getFileUrl())) { |
88 | 88 | int i = 0; |
89 | 89 | pointMapper.deleteBySubmit(submitFile.getId()); | ... | ... |
src/main/java/com/sincere/student/service/impl/UniversityServiceImpl.java
... | ... | @@ -22,21 +22,21 @@ import java.util.logging.Handler; |
22 | 22 | public class UniversityServiceImpl implements UniversityService { |
23 | 23 | |
24 | 24 | @Autowired |
25 | - UniversityMapper universityMapper ; | |
25 | + UniversityMapper universityMapper; | |
26 | 26 | |
27 | 27 | @Autowired |
28 | - UniversityMajorMapper universityMajorMapper ; | |
28 | + UniversityMajorMapper universityMajorMapper; | |
29 | 29 | |
30 | 30 | |
31 | 31 | @Override |
32 | 32 | public Page<University> getList(UniversitySearchDto universitySearchDto) { |
33 | - Page<University> page = new Page<>(universitySearchDto.getPage(),universitySearchDto.getPageSize()); | |
34 | - PageHelper.startPage(universitySearchDto.getPage(),universitySearchDto.getPageSize()); | |
35 | - if(StringUtils.isNotBlank(universitySearchDto.getSearch())){ | |
36 | - universitySearchDto.setSearch("%"+universitySearchDto.getSearch()+"%"); | |
33 | + Page<University> page = new Page<>(universitySearchDto.getPage(), universitySearchDto.getPageSize()); | |
34 | + PageHelper.startPage(universitySearchDto.getPage(), universitySearchDto.getPageSize()); | |
35 | + if (StringUtils.isNotBlank(universitySearchDto.getSearch())) { | |
36 | + universitySearchDto.setSearch("%" + universitySearchDto.getSearch() + "%"); | |
37 | 37 | } |
38 | 38 | List<University> list = universityMapper.getList(universitySearchDto); |
39 | - for(University university : list){ | |
39 | + for (University university : list) { | |
40 | 40 | university.setMajorList(universityMajorMapper.selectUniversityMajor(university.getId())); |
41 | 41 | } |
42 | 42 | page.setList(list); |
... | ... | @@ -69,16 +69,16 @@ public class UniversityServiceImpl implements UniversityService { |
69 | 69 | public int addMajor(List<UniversityMajor> list) { |
70 | 70 | universityMajorMapper.deleteByUniversityId(list.get(0).getUniversityId()); |
71 | 71 | List<UniversityMajor> result = new ArrayList<>(); |
72 | - int i = 0 ; | |
73 | - for(UniversityMajor universityMajor :list){ | |
74 | - i++ ; | |
72 | + int i = 0; | |
73 | + for (UniversityMajor universityMajor : list) { | |
74 | + i++; | |
75 | 75 | result.add(universityMajor); |
76 | - if(i % 100 == 0){ | |
76 | + if (i % 100 == 0) { | |
77 | 77 | universityMajorMapper.insertBatch(result); |
78 | 78 | result = new ArrayList<>(); |
79 | 79 | } |
80 | 80 | } |
81 | - if(result.size() > 0){ | |
81 | + if (result.size() > 0) { | |
82 | 82 | universityMajorMapper.insertBatch(result); |
83 | 83 | } |
84 | 84 | return 1; |
... | ... | @@ -90,10 +90,10 @@ public class UniversityServiceImpl implements UniversityService { |
90 | 90 | } |
91 | 91 | |
92 | 92 | @Override |
93 | - public Integer selectIdByMajor(String major , int id) { | |
94 | - Map<String ,String> map = new HashMap<>(); | |
95 | - map.put("major",major); | |
96 | - map.put("id",id+""); | |
93 | + public Integer selectIdByMajor(String major, int id) { | |
94 | + Map<String, String> map = new HashMap<>(); | |
95 | + map.put("major", major); | |
96 | + map.put("id", id + ""); | |
97 | 97 | return universityMajorMapper.selectIdByMajor(map); |
98 | 98 | } |
99 | 99 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/VideoServiceImpl.java
... | ... | @@ -3,12 +3,14 @@ package com.sincere.student.service.impl; |
3 | 3 | import com.github.pagehelper.PageHelper; |
4 | 4 | import com.sincere.student.dto.VideoSearchDto; |
5 | 5 | import com.sincere.student.mapper.VideoMapper; |
6 | +import com.sincere.student.model.ColumnType; | |
6 | 7 | import com.sincere.student.model.Video; |
7 | 8 | import com.sincere.student.service.VideoService; |
8 | 9 | import com.sincere.student.utils.Page; |
9 | 10 | import org.apache.commons.lang3.StringUtils; |
10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 12 | import org.springframework.stereotype.Service; |
13 | +import org.springframework.util.CollectionUtils; | |
12 | 14 | |
13 | 15 | import java.util.Arrays; |
14 | 16 | import java.util.List; |
... | ... | @@ -18,15 +20,15 @@ public class VideoServiceImpl implements VideoService { |
18 | 20 | |
19 | 21 | |
20 | 22 | @Autowired |
21 | - VideoMapper videoMapper ; | |
23 | + VideoMapper videoMapper; | |
22 | 24 | |
23 | 25 | @Override |
24 | 26 | public Page<Video> getUniversityList(VideoSearchDto dto) { |
25 | - Page<Video> page = new Page<>(dto.getPage(),dto.getPageSize()); | |
26 | - if(StringUtils.isNotBlank(dto.getUniversityName())){ | |
27 | - dto.setUniversityName("%"+dto.getUniversityName()+"%"); | |
27 | + Page<Video> page = new Page<>(dto.getPage(), dto.getPageSize()); | |
28 | + if (StringUtils.isNotBlank(dto.getUniversityName())) { | |
29 | + dto.setUniversityName("%" + dto.getUniversityName() + "%"); | |
28 | 30 | } |
29 | - PageHelper.startPage(dto.getPage(),dto.getPageSize()); | |
31 | + PageHelper.startPage(dto.getPage(), dto.getPageSize()); | |
30 | 32 | page.setList(videoMapper.getUniversityList(dto)); |
31 | 33 | page.setCount(videoMapper.getUniversityListCount(dto)); |
32 | 34 | return page; |
... | ... | @@ -34,17 +36,17 @@ public class VideoServiceImpl implements VideoService { |
34 | 36 | |
35 | 37 | @Override |
36 | 38 | public Page<Video> getList(VideoSearchDto dto) { |
37 | - Page<Video> page = new Page<>(dto.getPage(),dto.getPageSize()); | |
38 | - if(StringUtils.isNotBlank(dto.getUniversityName())){ | |
39 | - dto.setUniversityName("%"+dto.getUniversityName()+"%"); | |
39 | + Page<Video> page = new Page<>(dto.getPage(), dto.getPageSize()); | |
40 | + if (StringUtils.isNotBlank(dto.getUniversityName())) { | |
41 | + dto.setUniversityName("%" + dto.getUniversityName() + "%"); | |
40 | 42 | } |
41 | 43 | |
42 | - PageHelper.startPage(dto.getPage(),dto.getPageSize()); | |
44 | + PageHelper.startPage(dto.getPage(), dto.getPageSize()); | |
43 | 45 | List<Video> list = videoMapper.getList(dto); |
44 | - for(Video video : list){ | |
46 | + for (Video video : list) { | |
45 | 47 | videoMapper.updateRead(video.getId()); |
46 | 48 | } |
47 | - for(Video video : list){ | |
49 | + for (Video video : list) { | |
48 | 50 | String[] array = video.getVideoUrl().split(","); |
49 | 51 | video.setVideoUrlList(Arrays.asList(array)); |
50 | 52 | } |
... | ... | @@ -60,12 +62,42 @@ public class VideoServiceImpl implements VideoService { |
60 | 62 | |
61 | 63 | @Override |
62 | 64 | public int create(Video video) { |
65 | + //排序 | |
66 | + Integer sort = video.getSort(); | |
67 | + List<Video> videoList = videoMapper.countSort(sort.intValue(), 1, null); | |
68 | + if (!CollectionUtils.isEmpty(videoList)) { | |
69 | + int i = 1; | |
70 | + for (Video oldVideo : videoList) { | |
71 | + int add = i + sort; | |
72 | + if (add > oldVideo.getSort()) { | |
73 | + //若已存在自增1 | |
74 | + oldVideo.setSort(oldVideo.getSort() + 1); | |
75 | + videoMapper.update(oldVideo); | |
76 | + } | |
77 | + i++; | |
78 | + } | |
79 | + } | |
63 | 80 | videoMapper.create(video); |
64 | 81 | return video.getId(); |
65 | 82 | } |
66 | 83 | |
67 | 84 | @Override |
68 | 85 | public int update(Video video) { |
86 | + //排序 | |
87 | + Integer sort = video.getSort(); | |
88 | + List<Video> videoList = videoMapper.countSort(sort.intValue(), 2, video.getId()); | |
89 | + if (!CollectionUtils.isEmpty(videoList)) { | |
90 | + int i = 1; | |
91 | + for (Video oldVideo : videoList) { | |
92 | + int add = i + sort; | |
93 | + if (add > oldVideo.getSort()) { | |
94 | + //若已存在自增1 | |
95 | + oldVideo.setSort(oldVideo.getSort() + 1); | |
96 | + videoMapper.update(oldVideo); | |
97 | + } | |
98 | + i++; | |
99 | + } | |
100 | + } | |
69 | 101 | return videoMapper.update(video); |
70 | 102 | } |
71 | 103 | ... | ... |
src/main/java/com/sincere/student/utils/DateUtils.java
... | ... | @@ -25,7 +25,7 @@ public class DateUtils { |
25 | 25 | min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60); |
26 | 26 | sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); |
27 | 27 | |
28 | - Long[] times = { day, hour, min, sec }; | |
28 | + Long[] times = {day, hour, min, sec}; | |
29 | 29 | return times; |
30 | 30 | } |
31 | 31 | ... | ... |
src/main/java/com/sincere/student/utils/ExcelUtils.java
... | ... | @@ -3,6 +3,7 @@ package com.sincere.student.utils; |
3 | 3 | import com.aliyun.oss.OSSClient; |
4 | 4 | import com.aliyun.oss.model.OSSObject; |
5 | 5 | import com.sincere.student.model.Point; |
6 | +import org.apache.commons.lang3.StringUtils; | |
6 | 7 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
7 | 8 | import org.apache.poi.ss.usermodel.*; |
8 | 9 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
... | ... | @@ -14,13 +15,13 @@ import java.util.List; |
14 | 15 | |
15 | 16 | public class ExcelUtils { |
16 | 17 | |
17 | - public static OSSClient ossClient = null ; | |
18 | + public static OSSClient ossClient = null; | |
18 | 19 | |
19 | - private static final String key = "QiuM3PwHTnVotcGy" ; | |
20 | - private static final String secret = "Yqs7RlaC1MioZu2YYJ6u0TdeO13VFC" ; | |
21 | - private static final String endPoint = "http://oss-cn-hangzhou.aliyuncs.com" ; | |
22 | - private static final String bucketName = "szyundisk" ; | |
23 | - private static final String domain = "https://szyundisk.oss-cn-hangzhou.aliyuncs.com/" ; | |
20 | + private static final String key = "QiuM3PwHTnVotcGy"; | |
21 | + private static final String secret = "Yqs7RlaC1MioZu2YYJ6u0TdeO13VFC"; | |
22 | + private static final String endPoint = "http://oss-cn-hangzhou.aliyuncs.com"; | |
23 | + private static final String bucketName = "szyundisk"; | |
24 | + private static final String domain = "https://szyundisk.oss-cn-hangzhou.aliyuncs.com/"; | |
24 | 25 | |
25 | 26 | public static synchronized OSSClient getInstance() { |
26 | 27 | if (ossClient == null) { |
... | ... | @@ -33,18 +34,18 @@ public class ExcelUtils { |
33 | 34 | return ossClient; |
34 | 35 | } |
35 | 36 | |
36 | - public static List<Point> analysisExcel(String url) throws ResultException{ | |
37 | - InputStream inputStream = null ; | |
37 | + public static List<Point> analysisExcel(String url) throws ResultException { | |
38 | + InputStream inputStream = null; | |
38 | 39 | OSSClient ossClient = getInstance(); |
39 | - OSSObject object = ossClient.getObject(bucketName,url.replace(domain,"")); | |
40 | - try{ | |
40 | + OSSObject object = ossClient.getObject(bucketName, url.replace(domain, "")); | |
41 | + try { | |
41 | 42 | File excelFile = new File(url); |
42 | 43 | // 获得工作簿 |
43 | 44 | String file = excelFile.getName(); |
44 | 45 | Workbook workbook = null; |
45 | 46 | inputStream = object.getObjectContent(); |
46 | - if(inputStream == null){ | |
47 | - throw new ResultException(901,"路径错误"); | |
47 | + if (inputStream == null) { | |
48 | + throw new ResultException(901, "路径错误"); | |
48 | 49 | } |
49 | 50 | if (file.endsWith("xls")) { |
50 | 51 | workbook = new HSSFWorkbook(inputStream); |
... | ... | @@ -58,55 +59,67 @@ public class ExcelUtils { |
58 | 59 | for (int i = 1; i <= rows; i++) { |
59 | 60 | // 获取第i行数据 |
60 | 61 | Row sheetRow = sheet.getRow(i); |
61 | - if(sheetRow != null){ | |
62 | + if (sheetRow != null) { | |
62 | 63 | Point point = new Point(); |
63 | 64 | Cell cell1 = sheetRow.getCell(0); |
64 | - if(cell1 != null){ | |
65 | + if (cell1 != null) { | |
65 | 66 | cell1.setCellType(CellType.STRING); |
66 | 67 | point.setUniversityName(cell1.getStringCellValue().trim()); |
67 | 68 | } |
68 | 69 | Cell cell2 = sheetRow.getCell(1); |
69 | - if(cell2 != null){ | |
70 | + if (cell2 != null) { | |
70 | 71 | cell2.setCellType(CellType.STRING); |
71 | 72 | point.setMajor(cell2.getStringCellValue().trim()); |
72 | 73 | } |
73 | 74 | Cell cell3 = sheetRow.getCell(2); |
74 | - if(cell3 != null){ | |
75 | + if (cell3 != null) { | |
75 | 76 | cell3.setCellType(CellType.STRING); |
76 | - point.setEnrollNumber(Integer.valueOf(cell3.getStringCellValue().trim())); | |
77 | + if(StringUtils.isNotBlank(cell3.getStringCellValue())){ | |
78 | + point.setEnrollNumber(Integer.valueOf(cell3.getStringCellValue().trim())); | |
79 | + }else{ | |
80 | + point.setEnrollNumber(null); | |
81 | + } | |
77 | 82 | } |
78 | 83 | Cell cell4 = sheetRow.getCell(3); |
79 | - if(cell4 != null){ | |
84 | + if (cell4 != null) { | |
80 | 85 | cell4.setCellType(CellType.STRING); |
81 | - point.setGrade(Integer.valueOf(cell4.getStringCellValue().trim())); | |
86 | + if(StringUtils.isNotBlank(cell4.getStringCellValue())){ | |
87 | + point.setGrade(Integer.valueOf(cell4.getStringCellValue().trim())); | |
88 | + }else{ | |
89 | + point.setGrade(null); | |
90 | + } | |
82 | 91 | } |
83 | 92 | Cell cell5 = sheetRow.getCell(4); |
84 | - if(cell5 != null){ | |
93 | + if (cell5 != null) { | |
85 | 94 | cell5.setCellType(CellType.STRING); |
86 | - point.setRank(Integer.valueOf(cell5.getStringCellValue().trim())); | |
95 | + if(StringUtils.isNotBlank(cell5.getStringCellValue())){ | |
96 | + point.setRank(Integer.valueOf(cell5.getStringCellValue().trim())); | |
97 | + }else{ | |
98 | + point.setRank(null); | |
99 | + } | |
87 | 100 | } |
88 | 101 | Cell cell6 = sheetRow.getCell(5); |
89 | - if(cell6 != null){ | |
102 | + if (cell6 != null) { | |
90 | 103 | cell6.setCellType(CellType.STRING); |
91 | 104 | point.setProvince(cell6.getStringCellValue().trim()); |
92 | 105 | } |
93 | 106 | Cell cell7 = sheetRow.getCell(6); |
94 | - if(cell7 != null){ | |
107 | + if (cell7 != null) { | |
95 | 108 | cell7.setCellType(CellType.STRING); |
96 | 109 | point.setCity(cell7.getStringCellValue()); |
97 | 110 | } |
98 | 111 | list.add(point); |
99 | 112 | } |
100 | 113 | } |
101 | - return list ; | |
102 | - }catch (Exception e){ | |
114 | + return list; | |
115 | + } catch (Exception e) { | |
103 | 116 | e.printStackTrace(); |
104 | - throw new ResultException(999,"系统错误"); | |
105 | - }finally { | |
106 | - try{ | |
117 | + throw new ResultException(999, "系统错误"); | |
118 | + } finally { | |
119 | + try { | |
107 | 120 | inputStream.close(); |
108 | 121 | object.close(); |
109 | - }catch (Exception e){ | |
122 | + } catch (Exception e) { | |
110 | 123 | |
111 | 124 | } |
112 | 125 | ... | ... |
src/main/java/com/sincere/student/utils/HttpClientUtils.java
... | ... | @@ -19,6 +19,7 @@ import java.net.URL; |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * HttpClient4.3工具类 |
22 | + * | |
22 | 23 | * @author chen |
23 | 24 | * @version 1.0 |
24 | 25 | * @date 2019/10/11 0011 10:17 |
... | ... | @@ -38,7 +39,8 @@ public class HttpClientUtils { |
38 | 39 | |
39 | 40 | /** |
40 | 41 | * post请求传输json参数 |
41 | - * @param url url地址 | |
42 | + * | |
43 | + * @param url url地址 | |
42 | 44 | * @param jsonParam 参数 |
43 | 45 | * @return |
44 | 46 | */ |
... | ... | @@ -78,8 +80,9 @@ public class HttpClientUtils { |
78 | 80 | /** |
79 | 81 | * post请求传输String参数 例如:name=Jack&sex=1&type=2 |
80 | 82 | * Content-type:application/x-www-form-urlencoded |
81 | - * @param url url地址 | |
82 | - * @param strParam 参数 | |
83 | + * | |
84 | + * @param url url地址 | |
85 | + * @param strParam 参数 | |
83 | 86 | * @return |
84 | 87 | */ |
85 | 88 | public static JSONObject httpPost(String url, String strParam) { |
... | ... | @@ -115,6 +118,7 @@ public class HttpClientUtils { |
115 | 118 | |
116 | 119 | /** |
117 | 120 | * 发送get请求 |
121 | + * | |
118 | 122 | * @param url 路径 |
119 | 123 | * @return |
120 | 124 | */ |
... | ... | @@ -146,7 +150,7 @@ public class HttpClientUtils { |
146 | 150 | public static String httpGet2(String url) { |
147 | 151 | // get请求返回结果 |
148 | 152 | JSONObject jsonResult = null; |
149 | - String result = "" ; | |
153 | + String result = ""; | |
150 | 154 | CloseableHttpClient client = HttpClients.createDefault(); |
151 | 155 | // 发送get请求 |
152 | 156 | HttpGet request = new HttpGet(url); |
... | ... | @@ -171,20 +175,20 @@ public class HttpClientUtils { |
171 | 175 | } |
172 | 176 | |
173 | 177 | |
174 | - public static InputStream GetFileInputStream(String fileUrl){ | |
175 | - try{ | |
178 | + public static InputStream GetFileInputStream(String fileUrl) { | |
179 | + try { | |
176 | 180 | URL url = new URL(fileUrl); |
177 | - HttpURLConnection conn = (HttpURLConnection)url.openConnection(); | |
181 | + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |
178 | 182 | //设置超时间为3秒 |
179 | - conn.setConnectTimeout(8*1000); | |
183 | + conn.setConnectTimeout(8 * 1000); | |
180 | 184 | //得到输入流 |
181 | 185 | InputStream inputStream = conn.getInputStream(); |
182 | 186 | |
183 | - return inputStream ; | |
184 | - }catch (Exception e){ | |
187 | + return inputStream; | |
188 | + } catch (Exception e) { | |
185 | 189 | |
186 | 190 | } |
187 | - return null ; | |
191 | + return null; | |
188 | 192 | } |
189 | 193 | |
190 | 194 | } | ... | ... |
src/main/java/com/sincere/student/utils/Page.java
... | ... | @@ -9,12 +9,12 @@ import java.util.List; |
9 | 9 | public class Page<T> { |
10 | 10 | |
11 | 11 | @ApiModelProperty(value = "页码") |
12 | - private int page ; | |
12 | + private int page; | |
13 | 13 | @ApiModelProperty(value = "每页数量") |
14 | - private int pageSize ; | |
14 | + private int pageSize; | |
15 | 15 | @ApiModelProperty(value = "总数") |
16 | - private int count ; | |
17 | - private List<T> list ; | |
16 | + private int count; | |
17 | + private List<T> list; | |
18 | 18 | |
19 | 19 | public int getCount() { |
20 | 20 | return count; | ... | ... |
src/main/java/com/sincere/student/utils/ResultException.java
src/main/java/com/sincere/student/utils/TokenUtils.java
... | ... | @@ -25,6 +25,7 @@ public class TokenUtils { |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * 生成Token |
28 | + * | |
28 | 29 | * @param account |
29 | 30 | * @return |
30 | 31 | */ |
... | ... | @@ -39,7 +40,7 @@ public class TokenUtils { |
39 | 40 | */ |
40 | 41 | JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() |
41 | 42 | .expirationTime(new Date(System.currentTimeMillis() + EXPIRE_TIME)) |
42 | - .claim("ACCOUNT",account) | |
43 | + .claim("ACCOUNT", account) | |
43 | 44 | .build(); |
44 | 45 | |
45 | 46 | /** |
... | ... | @@ -63,6 +64,7 @@ public class TokenUtils { |
63 | 64 | |
64 | 65 | /** |
65 | 66 | * 校验token |
67 | + * | |
66 | 68 | * @param token |
67 | 69 | * @return |
68 | 70 | */ |
... | ... | @@ -84,7 +86,7 @@ public class TokenUtils { |
84 | 86 | //获取载体中的数据 |
85 | 87 | Object account = jwt.getJWTClaimsSet().getClaim("ACCOUNT"); |
86 | 88 | //是否有openUid |
87 | - if (Objects.isNull(account)){ | |
89 | + if (Objects.isNull(account)) { | |
88 | 90 | throw new ResultException(-3, "账号为空"); |
89 | 91 | } |
90 | 92 | return account.toString(); | ... | ... |
src/main/resources/generatorConfig.xml
... | ... | @@ -3,9 +3,9 @@ |
3 | 3 | PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" |
4 | 4 | "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> |
5 | 5 | <generatorConfiguration> |
6 | - <classPathEntry location="C://root//sqljdbc4-4.0.jar" /> | |
6 | + <classPathEntry location="C://root//sqljdbc4-4.0.jar"/> | |
7 | 7 | |
8 | - <context targetRuntime="MyBatis3" id="a"> | |
8 | + <context targetRuntime="MyBatis3" id="a"> | |
9 | 9 | |
10 | 10 | <!--<commentGenerator> |
11 | 11 | <!– 去除自动生成的注释 –> |
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | <jdbcConnection driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver" |
22 | 22 | connectionURL="jdbc:sqlserver://60.190.202.57:14333;database=consultative" |
23 | 23 | userId="SZJXTUSER" |
24 | - password="xst200919" /> | |
24 | + password="xst200919"/> | |
25 | 25 | |
26 | 26 | <!-- 非必需,类型处理器,在数据库类型和java类型之间的转换控制--> |
27 | 27 | <javaTypeResolver> |
... | ... | @@ -32,16 +32,18 @@ |
32 | 32 | targetPackage:生成的实体包位置,默认存放在src目录下 |
33 | 33 | targetProject:目标工程名 |
34 | 34 | --> |
35 | - <javaModelGenerator targetPackage="com.sincere.student.model" targetProject="src/main/java" /> | |
35 | + <javaModelGenerator targetPackage="com.sincere.student.model" targetProject="src/main/java"/> | |
36 | 36 | |
37 | 37 | <!-- 实体包对应映射文件位置及名称,默认存放在src目录下 --> |
38 | - <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources" /> | |
38 | + <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"/> | |
39 | 39 | <!--生成Dao类存放位置--> |
40 | 40 | <javaClientGenerator type="XMLMAPPER" targetPackage="com.sincere.student.mapper" targetProject="src/main/java"> |
41 | 41 | <property name="enableSubPackages" value="true"/> |
42 | 42 | </javaClientGenerator> |
43 | 43 | <!--生成对应表及类名--> |
44 | - <table tableName="university_submit_file" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" enableSelectByPrimaryKey="true" | |
44 | + <table tableName="university_submit_file" enableCountByExample="false" enableUpdateByExample="false" | |
45 | + enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" | |
46 | + enableSelectByPrimaryKey="true" | |
45 | 47 | enableUpdateByPrimaryKey="true" |
46 | 48 | enableDeleteByPrimaryKey="true"></table> |
47 | 49 | </context> | ... | ... |
src/main/resources/mapper/AdvertMapper.xml
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | select * from university_advert where id=#{id} |
22 | 22 | </select> |
23 | 23 | |
24 | - <insert id="create" parameterType="com.sincere.student.model.Advert" > | |
24 | + <insert id="create" parameterType="com.sincere.student.model.Advert"> | |
25 | 25 | insert into university_advert (type,img_url,url_link,sort,status,create_time,title) |
26 | 26 | values (#{type},#{imgUrl},#{urlLink},#{sort},#{status},GETDATE(),#{title}) |
27 | 27 | </insert> | ... | ... |
src/main/resources/mapper/AreaMapper.xml
src/main/resources/mapper/ArticleMapper.xml
... | ... | @@ -17,8 +17,8 @@ |
17 | 17 | <result column="look_number" property="lookNumber"/> |
18 | 18 | <result column="create_time" property="createTime"/> |
19 | 19 | <result column="type" property="type"/> |
20 | - <result column="status" property="status" /> | |
21 | - <result column="columnTypeString" property="columnTypeString" /> | |
20 | + <result column="status" property="status"/> | |
21 | + <result column="columnTypeString" property="columnTypeString"/> | |
22 | 22 | </resultMap> |
23 | 23 | |
24 | 24 | |
... | ... | @@ -44,31 +44,46 @@ |
44 | 44 | </select> |
45 | 45 | |
46 | 46 | <select id="getList" parameterType="com.sincere.student.dto.ArticleSearchDto" resultMap="ArticleMap"> |
47 | - select university_article.* , university_column_type.name as columnTypeString from university_article left join university_column_type on university_article.column_type = university_column_type.id | |
48 | - <where> | |
49 | - <if test="title != null and title != ''"> | |
50 | - and university_article.title like #{title} | |
51 | - </if> | |
52 | - <if test="columnType != 0"> | |
53 | - and university_article.column_type = #{columnType} | |
54 | - </if> | |
55 | - <if test="articleType != 0"> | |
56 | - and university_article.type = #{articleType} | |
57 | - </if> | |
58 | - <if test="status == 1"> | |
59 | - and university_article.status = 1 | |
60 | - </if> | |
61 | - <if test="status != 1"> | |
62 | - and 1 = 1 | |
63 | - </if> | |
64 | - </where> | |
65 | - order by university_article.sort | |
47 | + select university_article.* , university_column_type.name as columnTypeString from university_article left join | |
48 | + university_column_type on university_article.column_type = university_column_type.id | |
49 | + <where> | |
50 | + <if test="title != null and title != ''"> | |
51 | + and university_article.title like #{title} | |
52 | + </if> | |
53 | + <if test="columnType != 0"> | |
54 | + and university_article.column_type = #{columnType} | |
55 | + </if> | |
56 | + <if test="articleType != 0"> | |
57 | + and university_article.type = #{articleType} | |
58 | + </if> | |
59 | + <if test="status == 1"> | |
60 | + and university_article.status = 1 | |
61 | + </if> | |
62 | + <if test="status != 1"> | |
63 | + and 1 = 1 | |
64 | + </if> | |
65 | + </where> | |
66 | + order by university_article.sort | |
66 | 67 | </select> |
67 | 68 | |
68 | 69 | <select id="getAdvert" resultMap="ArticleMap"> |
69 | - select top 1 * from university_article where type = 1 ORDER BY NEWID() | |
70 | + select top 1 * from university_article where type = 1 ORDER BY NEWID() | |
71 | + </select> | |
72 | + | |
73 | + <select id="countSort" resultMap="ArticleMap"> | |
74 | + select * from university_article where | |
75 | + <choose> | |
76 | + <when test="flag ==1"> | |
77 | + sort >= #{sort} | |
78 | + </when> | |
79 | + <when test="flag ==2"> | |
80 | + sort >= #{sort} and id != #{id} | |
81 | + </when> | |
82 | + </choose> | |
83 | + order by sort asc | |
70 | 84 | </select> |
71 | 85 | |
86 | + | |
72 | 87 | <select id="getRelationList" parameterType="java.lang.Integer" resultMap="ArticleMap"> |
73 | 88 | select top 3 * from university_article where university_id = #{universityId} |
74 | 89 | </select> |
... | ... | @@ -77,9 +92,11 @@ |
77 | 92 | select * from university_article where id = #{id} |
78 | 93 | </select> |
79 | 94 | |
80 | - <insert id="create" parameterType="com.sincere.student.model.Article" useGeneratedKeys="true" keyProperty="id"> | |
81 | - insert into university_article (title,column_type,university_id,sort,context,author,image_url,video_url,article_link,good_number,look_number,create_time,type,status) | |
82 | - values (#{title},#{columnType},#{universityId},#{sort},#{context},#{author},#{imageUrl},#{videoUrl},#{articleLink},#{goodNumber},#{lookNumber},GETDATE(),#{type},#{status}) | |
95 | + <insert id="create" parameterType="com.sincere.student.model.Article" useGeneratedKeys="true" keyProperty="id"> | |
96 | + insert into university_article | |
97 | + (title,column_type,university_id,sort,context,author,image_url,video_url,article_link,good_number,look_number,create_time,type,status) | |
98 | + values | |
99 | + (#{title},#{columnType},#{universityId},#{sort},#{context},#{author},#{imageUrl},#{videoUrl},#{articleLink},#{goodNumber},#{lookNumber},GETDATE(),#{type},#{status}) | |
83 | 100 | </insert> |
84 | 101 | |
85 | 102 | <delete id="delete" parameterType="java.lang.Integer"> |
... | ... | @@ -126,6 +143,6 @@ |
126 | 143 | status=#{status}, |
127 | 144 | </if> |
128 | 145 | </trim> |
129 | - where id = #{id} | |
146 | + where id = #{id} | |
130 | 147 | </update> |
131 | 148 | </mapper> | ... | ... |
src/main/resources/mapper/ColumnMapper.xml
... | ... | @@ -10,8 +10,8 @@ |
10 | 10 | <result column="create_time" property="createTime"/> |
11 | 11 | <result column="url_link" property="urlLink"/> |
12 | 12 | </resultMap> |
13 | - | |
14 | - | |
13 | + | |
14 | + | |
15 | 15 | <select id="getList" parameterType="com.sincere.student.dto.ColumnDto" resultMap="ColumnMap"> |
16 | 16 | select * from university_column_type |
17 | 17 | <where> |
... | ... | @@ -33,7 +33,20 @@ |
33 | 33 | insert into university_column_type(type,name,sort,create_time,url_link) |
34 | 34 | values (#{type},#{name},#{sort},GETDATE(),#{urlLink}) |
35 | 35 | </insert> |
36 | - | |
36 | + | |
37 | + <select id="countSort" resultMap="ColumnMap"> | |
38 | + select * from university_column_type where type = #{type} | |
39 | + <choose> | |
40 | + <when test="flag ==1"> | |
41 | + and sort >= #{sort} | |
42 | + </when> | |
43 | + <when test="flag ==2"> | |
44 | + and sort >= #{sort} and id != #{id} | |
45 | + </when> | |
46 | + </choose> | |
47 | + order by sort asc | |
48 | + </select> | |
49 | + | |
37 | 50 | <insert id="update" parameterType="com.sincere.student.model.ColumnType"> |
38 | 51 | update university_column_type |
39 | 52 | <trim prefix="set" suffixOverrides=","> | ... | ... |
src/main/resources/mapper/MajorMapper.xml
... | ... | @@ -17,14 +17,14 @@ |
17 | 17 | |
18 | 18 | <select id="getList" parameterType="com.sincere.student.model.Major" resultMap="MajorMap"> |
19 | 19 | select * from university_major |
20 | - <where> | |
21 | - <if test="pid != 0"> | |
20 | + <where> | |
21 | + <if test="pid != 0"> | |
22 | 22 | and p_id = #{pid} |
23 | - </if> | |
24 | - <if test="major != null and major != ''"> | |
23 | + </if> | |
24 | + <if test="major != null and major != ''"> | |
25 | 25 | and major like #{major} |
26 | - </if> | |
27 | - </where> | |
26 | + </if> | |
27 | + </where> | |
28 | 28 | </select> |
29 | 29 | |
30 | 30 | <select id="getListCount" parameterType="com.sincere.student.model.Major" resultType="java.lang.Integer"> |
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | </where> |
40 | 40 | </select> |
41 | 41 | |
42 | - <insert id="create" parameterType="com.sincere.student.model.Major" > | |
42 | + <insert id="create" parameterType="com.sincere.student.model.Major"> | |
43 | 43 | insert into university_major (major,major_code,p_id,create_time) |
44 | 44 | values (#{major},#{majorCode},#{pid},GETDATE()) |
45 | 45 | </insert> |
... | ... | @@ -77,10 +77,10 @@ |
77 | 77 | </collection> |
78 | 78 | </resultMap> |
79 | 79 | |
80 | - <select id="selectMajor" resultMap="MajorMap2" > | |
81 | - select f.id as f_id , f.major as f_major , s.id as s_id , s.major as s_major from | |
82 | - university_major s | |
83 | - join university_major f on f.id = s.p_id | |
80 | + <select id="selectMajor" resultMap="MajorMap2"> | |
81 | + select f.id as f_id , f.major as f_major , s.id as s_id , s.major as s_major from | |
82 | + university_major s | |
83 | + join university_major f on f.id = s.p_id | |
84 | 84 | |
85 | 85 | </select> |
86 | 86 | </mapper> | ... | ... |
src/main/resources/mapper/ParameterMapper.xml
... | ... | @@ -7,11 +7,11 @@ |
7 | 7 | <result column="message" property="message"/> |
8 | 8 | </resultMap> |
9 | 9 | |
10 | - <select id="getByCode" resultMap="ParameterMap"> | |
10 | + <select id="getByCode" resultMap="ParameterMap"> | |
11 | 11 | select * from sys_parameter where code = #{code} |
12 | 12 | </select> |
13 | 13 | |
14 | - <insert id="create" parameterType="com.sincere.student.model.Parameter" > | |
14 | + <insert id="create" parameterType="com.sincere.student.model.Parameter"> | |
15 | 15 | insert into sys_parameter values (#{code},#{message}) |
16 | 16 | </insert> |
17 | 17 | |
... | ... | @@ -21,15 +21,15 @@ |
21 | 21 | </update> |
22 | 22 | |
23 | 23 | <resultMap id="AccessTokenMap" type="com.sincere.student.model.AccessToken"> |
24 | - <id column="id" jdbcType="INTEGER" property="id" /> | |
25 | - <result column="access_token" jdbcType="VARCHAR" property="accessToken" /> | |
26 | - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |
24 | + <id column="id" jdbcType="INTEGER" property="id"/> | |
25 | + <result column="access_token" jdbcType="VARCHAR" property="accessToken"/> | |
26 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |
27 | 27 | </resultMap> |
28 | 28 | |
29 | 29 | <insert id="insertAccessToken" parameterType="com.sincere.student.model.AccessToken"> |
30 | - insert into access_token (access_token) | |
31 | - values (#{accessToken,jdbcType=VARCHAR} | |
32 | - ) | |
30 | + insert into access_token (access_token) | |
31 | + values (#{accessToken,jdbcType=VARCHAR} | |
32 | + ) | |
33 | 33 | </insert> |
34 | 34 | |
35 | 35 | <select id="getAccessToken" resultMap="AccessTokenMap"> | ... | ... |
src/main/resources/mapper/SysUserMapper.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 | <mapper namespace="com.sincere.student.mapper.SysUserMapper"> |
4 | - <resultMap id="BaseResultMap" type="com.sincere.student.model.SysUser"> | |
5 | - <id column="id" jdbcType="INTEGER" property="id" /> | |
6 | - <result column="user_name" jdbcType="VARCHAR" property="userName" /> | |
7 | - <result column="password" jdbcType="VARCHAR" property="password" /> | |
8 | - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |
9 | - </resultMap> | |
10 | - <sql id="Base_Column_List"> | |
11 | - id, user_name, password, create_time | |
12 | - </sql> | |
13 | - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
14 | - select | |
15 | - <include refid="Base_Column_List" /> | |
16 | - from sys_user | |
17 | - where id = #{id,jdbcType=INTEGER} | |
18 | - </select> | |
19 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
20 | - delete from sys_user | |
21 | - where id = #{id,jdbcType=INTEGER} | |
22 | - </delete> | |
23 | - <insert id="insert" parameterType="com.sincere.student.model.SysUser"> | |
24 | - insert into sys_user (id, user_name, password, | |
25 | - create_time) | |
26 | - values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, | |
27 | - #{createTime,jdbcType=TIMESTAMP}) | |
28 | - </insert> | |
29 | - <insert id="insertSelective" parameterType="com.sincere.student.model.SysUser"> | |
30 | - insert into sys_user | |
31 | - <trim prefix="(" suffix=")" suffixOverrides=","> | |
32 | - <if test="id != null"> | |
33 | - id, | |
34 | - </if> | |
35 | - <if test="userName != null"> | |
36 | - user_name, | |
37 | - </if> | |
38 | - <if test="password != null"> | |
39 | - password, | |
40 | - </if> | |
41 | - <if test="createTime != null"> | |
42 | - create_time, | |
43 | - </if> | |
44 | - </trim> | |
45 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | |
46 | - <if test="id != null"> | |
47 | - #{id,jdbcType=INTEGER}, | |
48 | - </if> | |
49 | - <if test="userName != null"> | |
50 | - #{userName,jdbcType=VARCHAR}, | |
51 | - </if> | |
52 | - <if test="password != null"> | |
53 | - #{password,jdbcType=VARCHAR}, | |
54 | - </if> | |
55 | - <if test="createTime != null"> | |
56 | - #{createTime,jdbcType=TIMESTAMP}, | |
57 | - </if> | |
58 | - </trim> | |
59 | - </insert> | |
60 | - <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.SysUser"> | |
61 | - update sys_user | |
62 | - <set> | |
63 | - <if test="userName != null"> | |
64 | - user_name = #{userName,jdbcType=VARCHAR}, | |
65 | - </if> | |
66 | - <if test="password != null"> | |
4 | + <resultMap id="BaseResultMap" type="com.sincere.student.model.SysUser"> | |
5 | + <id column="id" jdbcType="INTEGER" property="id"/> | |
6 | + <result column="user_name" jdbcType="VARCHAR" property="userName"/> | |
7 | + <result column="password" jdbcType="VARCHAR" property="password"/> | |
8 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |
9 | + </resultMap> | |
10 | + <sql id="Base_Column_List"> | |
11 | + id, user_name, password, create_time | |
12 | + </sql> | |
13 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
14 | + select | |
15 | + <include refid="Base_Column_List"/> | |
16 | + from sys_user | |
17 | + where id = #{id,jdbcType=INTEGER} | |
18 | + </select> | |
19 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
20 | + delete from sys_user | |
21 | + where id = #{id,jdbcType=INTEGER} | |
22 | + </delete> | |
23 | + <insert id="insert" parameterType="com.sincere.student.model.SysUser"> | |
24 | + insert into sys_user (id, user_name, password, | |
25 | + create_time) | |
26 | + values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, | |
27 | + #{createTime,jdbcType=TIMESTAMP}) | |
28 | + </insert> | |
29 | + <insert id="insertSelective" parameterType="com.sincere.student.model.SysUser"> | |
30 | + insert into sys_user | |
31 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
32 | + <if test="id != null"> | |
33 | + id, | |
34 | + </if> | |
35 | + <if test="userName != null"> | |
36 | + user_name, | |
37 | + </if> | |
38 | + <if test="password != null"> | |
39 | + password, | |
40 | + </if> | |
41 | + <if test="createTime != null"> | |
42 | + create_time, | |
43 | + </if> | |
44 | + </trim> | |
45 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
46 | + <if test="id != null"> | |
47 | + #{id,jdbcType=INTEGER}, | |
48 | + </if> | |
49 | + <if test="userName != null"> | |
50 | + #{userName,jdbcType=VARCHAR}, | |
51 | + </if> | |
52 | + <if test="password != null"> | |
53 | + #{password,jdbcType=VARCHAR}, | |
54 | + </if> | |
55 | + <if test="createTime != null"> | |
56 | + #{createTime,jdbcType=TIMESTAMP}, | |
57 | + </if> | |
58 | + </trim> | |
59 | + </insert> | |
60 | + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.SysUser"> | |
61 | + update sys_user | |
62 | + <set> | |
63 | + <if test="userName != null"> | |
64 | + user_name = #{userName,jdbcType=VARCHAR}, | |
65 | + </if> | |
66 | + <if test="password != null"> | |
67 | + password = #{password,jdbcType=VARCHAR}, | |
68 | + </if> | |
69 | + <if test="createTime != null"> | |
70 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | |
71 | + </if> | |
72 | + </set> | |
73 | + where id = #{id,jdbcType=INTEGER} | |
74 | + </update> | |
75 | + <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.SysUser"> | |
76 | + update sys_user | |
77 | + set user_name = #{userName,jdbcType=VARCHAR}, | |
67 | 78 | password = #{password,jdbcType=VARCHAR}, |
68 | - </if> | |
69 | - <if test="createTime != null"> | |
70 | - create_time = #{createTime,jdbcType=TIMESTAMP}, | |
71 | - </if> | |
72 | - </set> | |
73 | - where id = #{id,jdbcType=INTEGER} | |
74 | - </update> | |
75 | - <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.SysUser"> | |
76 | - update sys_user | |
77 | - set user_name = #{userName,jdbcType=VARCHAR}, | |
78 | - password = #{password,jdbcType=VARCHAR}, | |
79 | - create_time = #{createTime,jdbcType=TIMESTAMP} | |
80 | - where id = #{id,jdbcType=INTEGER} | |
81 | - </update> | |
79 | + create_time = #{createTime,jdbcType=TIMESTAMP} | |
80 | + where id = #{id,jdbcType=INTEGER} | |
81 | + </update> | |
82 | 82 | </mapper> |
83 | 83 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/UniversityConsultDetailMapper.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 | <mapper namespace="com.sincere.student.mapper.UniversityConsultDetailMapper"> |
4 | - <resultMap id="BaseResultMap" type="com.sincere.student.model.UniversityConsultDetail"> | |
5 | - <id column="id" jdbcType="INTEGER" property="id" /> | |
6 | - <result column="consult_id" jdbcType="INTEGER" property="consultId" /> | |
7 | - <result column="column_name" jdbcType="VARCHAR" property="columnName" /> | |
8 | - <result column="column_url" jdbcType="VARCHAR" property="columnUrl" /> | |
9 | - <result column="sort" jdbcType="INTEGER" property="sort" /> | |
10 | - </resultMap> | |
11 | - <sql id="Base_Column_List"> | |
12 | - id, consult_id, column_name, column_url, sort | |
13 | - </sql> | |
14 | - <select id="selectByConsult" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
15 | - select | |
16 | - <include refid="Base_Column_List" /> | |
17 | - from university_consult_detail | |
18 | - where consult_id = #{id,jdbcType=INTEGER} | |
19 | - order by sort | |
20 | - </select> | |
21 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
22 | - delete from university_consult_detail | |
23 | - where consult_id = #{id,jdbcType=INTEGER} | |
24 | - </delete> | |
25 | - <insert id="insert" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
26 | - insert into university_consult_detail ( consult_id, column_name, | |
27 | - column_url, sort) | |
28 | - values ( #{consultId,jdbcType=INTEGER}, #{columnName,jdbcType=VARCHAR}, | |
29 | - #{columnUrl,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}) | |
30 | - </insert> | |
31 | - <insert id="insertSelective" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
32 | - insert into university_consult_detail | |
33 | - <trim prefix="(" suffix=")" suffixOverrides=","> | |
34 | - <if test="id != null"> | |
35 | - id, | |
36 | - </if> | |
37 | - <if test="consultId != null"> | |
38 | - consult_id, | |
39 | - </if> | |
40 | - <if test="columnName != null"> | |
41 | - column_name, | |
42 | - </if> | |
43 | - <if test="columnUrl != null"> | |
44 | - column_url, | |
45 | - </if> | |
46 | - <if test="sort != null"> | |
47 | - sort, | |
48 | - </if> | |
49 | - </trim> | |
50 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | |
51 | - <if test="id != null"> | |
52 | - #{id,jdbcType=INTEGER}, | |
53 | - </if> | |
54 | - <if test="consultId != null"> | |
55 | - #{consultId,jdbcType=INTEGER}, | |
56 | - </if> | |
57 | - <if test="columnName != null"> | |
58 | - #{columnName,jdbcType=VARCHAR}, | |
59 | - </if> | |
60 | - <if test="columnUrl != null"> | |
61 | - #{columnUrl,jdbcType=VARCHAR}, | |
62 | - </if> | |
63 | - <if test="sort != null"> | |
64 | - #{sort,jdbcType=INTEGER}, | |
65 | - </if> | |
66 | - </trim> | |
67 | - </insert> | |
68 | - <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
69 | - update university_consult_detail | |
70 | - <set> | |
71 | - <if test="consultId != null"> | |
72 | - consult_id = #{consultId,jdbcType=INTEGER}, | |
73 | - </if> | |
74 | - <if test="columnName != null"> | |
4 | + <resultMap id="BaseResultMap" type="com.sincere.student.model.UniversityConsultDetail"> | |
5 | + <id column="id" jdbcType="INTEGER" property="id"/> | |
6 | + <result column="consult_id" jdbcType="INTEGER" property="consultId"/> | |
7 | + <result column="column_name" jdbcType="VARCHAR" property="columnName"/> | |
8 | + <result column="column_url" jdbcType="VARCHAR" property="columnUrl"/> | |
9 | + <result column="sort" jdbcType="INTEGER" property="sort"/> | |
10 | + </resultMap> | |
11 | + <sql id="Base_Column_List"> | |
12 | + id, consult_id, column_name, column_url, sort | |
13 | + </sql> | |
14 | + <select id="selectByConsult" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
15 | + select | |
16 | + <include refid="Base_Column_List"/> | |
17 | + from university_consult_detail | |
18 | + where consult_id = #{id,jdbcType=INTEGER} | |
19 | + order by sort | |
20 | + </select> | |
21 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
22 | + delete from university_consult_detail | |
23 | + where consult_id = #{id,jdbcType=INTEGER} | |
24 | + </delete> | |
25 | + <insert id="insert" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
26 | + insert into university_consult_detail ( consult_id, column_name, | |
27 | + column_url, sort) | |
28 | + values ( #{consultId,jdbcType=INTEGER}, #{columnName,jdbcType=VARCHAR}, | |
29 | + #{columnUrl,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}) | |
30 | + </insert> | |
31 | + <insert id="insertSelective" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
32 | + insert into university_consult_detail | |
33 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
34 | + <if test="id != null"> | |
35 | + id, | |
36 | + </if> | |
37 | + <if test="consultId != null"> | |
38 | + consult_id, | |
39 | + </if> | |
40 | + <if test="columnName != null"> | |
41 | + column_name, | |
42 | + </if> | |
43 | + <if test="columnUrl != null"> | |
44 | + column_url, | |
45 | + </if> | |
46 | + <if test="sort != null"> | |
47 | + sort, | |
48 | + </if> | |
49 | + </trim> | |
50 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
51 | + <if test="id != null"> | |
52 | + #{id,jdbcType=INTEGER}, | |
53 | + </if> | |
54 | + <if test="consultId != null"> | |
55 | + #{consultId,jdbcType=INTEGER}, | |
56 | + </if> | |
57 | + <if test="columnName != null"> | |
58 | + #{columnName,jdbcType=VARCHAR}, | |
59 | + </if> | |
60 | + <if test="columnUrl != null"> | |
61 | + #{columnUrl,jdbcType=VARCHAR}, | |
62 | + </if> | |
63 | + <if test="sort != null"> | |
64 | + #{sort,jdbcType=INTEGER}, | |
65 | + </if> | |
66 | + </trim> | |
67 | + </insert> | |
68 | + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
69 | + update university_consult_detail | |
70 | + <set> | |
71 | + <if test="consultId != null"> | |
72 | + consult_id = #{consultId,jdbcType=INTEGER}, | |
73 | + </if> | |
74 | + <if test="columnName != null"> | |
75 | + column_name = #{columnName,jdbcType=VARCHAR}, | |
76 | + </if> | |
77 | + <if test="columnUrl != null"> | |
78 | + column_url = #{columnUrl,jdbcType=VARCHAR}, | |
79 | + </if> | |
80 | + <if test="sort != null"> | |
81 | + sort = #{sort,jdbcType=INTEGER}, | |
82 | + </if> | |
83 | + </set> | |
84 | + where id = #{id,jdbcType=INTEGER} | |
85 | + </update> | |
86 | + <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
87 | + update university_consult_detail | |
88 | + set consult_id = #{consultId,jdbcType=INTEGER}, | |
75 | 89 | column_name = #{columnName,jdbcType=VARCHAR}, |
76 | - </if> | |
77 | - <if test="columnUrl != null"> | |
78 | 90 | column_url = #{columnUrl,jdbcType=VARCHAR}, |
79 | - </if> | |
80 | - <if test="sort != null"> | |
81 | - sort = #{sort,jdbcType=INTEGER}, | |
82 | - </if> | |
83 | - </set> | |
84 | - where id = #{id,jdbcType=INTEGER} | |
85 | - </update> | |
86 | - <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.UniversityConsultDetail"> | |
87 | - update university_consult_detail | |
88 | - set consult_id = #{consultId,jdbcType=INTEGER}, | |
89 | - column_name = #{columnName,jdbcType=VARCHAR}, | |
90 | - column_url = #{columnUrl,jdbcType=VARCHAR}, | |
91 | - sort = #{sort,jdbcType=INTEGER} | |
92 | - where id = #{id,jdbcType=INTEGER} | |
93 | - </update> | |
91 | + sort = #{sort,jdbcType=INTEGER} | |
92 | + where id = #{id,jdbcType=INTEGER} | |
93 | + </update> | |
94 | 94 | </mapper> |
95 | 95 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/UniversityConsultMapper.xml
... | ... | @@ -2,179 +2,212 @@ |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 | <mapper namespace="com.sincere.student.mapper.UniversityConsultMapper"> |
4 | 4 | |
5 | - <resultMap id="ListMap" type="com.sincere.student.model.Consult"> | |
6 | - <result column="id" property="id" /> | |
7 | - <result column="column_type" property="columnType" /> | |
8 | - <result column="universityId" property="universityId" /> | |
9 | - <result column="name" property="name" /> | |
10 | - <result column="code" property="code" /> | |
11 | - <result column="sort" property="sort" /> | |
12 | - <result column="img_url" property="imgUrl" /> | |
13 | - <result column="status" property="status" /> | |
14 | - <result column="read_number" property="readNumber" /> | |
15 | - <result column="columnTypeString" property="columnTypeString" /> | |
16 | - </resultMap> | |
5 | + <resultMap id="ListMap" type="com.sincere.student.model.Consult"> | |
6 | + <result column="id" property="id"/> | |
7 | + <result column="column_type" property="columnType"/> | |
8 | + <result column="universityId" property="universityId"/> | |
9 | + <result column="name" property="name"/> | |
10 | + <result column="code" property="code"/> | |
11 | + <result column="sort" property="sort"/> | |
12 | + <result column="img_url" property="imgUrl"/> | |
13 | + <result column="status" property="status"/> | |
14 | + <result column="read_number" property="readNumber"/> | |
15 | + <result column="columnTypeString" property="columnTypeString"/> | |
16 | + <result column="background" property="background"/> | |
17 | + <result column="model_list" property="modelList"/> | |
18 | + </resultMap> | |
17 | 19 | |
18 | - <select id="getListCount" parameterType="com.sincere.student.dto.ConsultSearchDto" resultType="java.lang.Integer"> | |
19 | - select count(DISTINCT c.id) from university_consult c | |
20 | - join university_info info on c.university_id = info.id | |
21 | - left join university_relate_major r on info.id = r.university_id | |
22 | - left join university_major m on m.id = r.major_id | |
23 | - <where> | |
24 | - <if test="columnType > 0"> | |
25 | - and c.column_type = #{columnType} | |
26 | - </if> | |
27 | - <if test="columnType == 0"> | |
28 | - and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort) | |
29 | - </if> | |
30 | - <if test="columnType == -1"> | |
31 | - and 1=1 | |
32 | - </if> | |
33 | - <if test="province != null and province != '' "> | |
34 | - and info.province = #{province} | |
35 | - </if> | |
36 | - <if test="city != null and city != '' "> | |
37 | - and info.city = #{city} | |
38 | - </if> | |
39 | - <if test="universityName != null and universityName != ''"> | |
40 | - and info.name like #{universityName} | |
41 | - </if> | |
42 | - <if test="majorName != null and majorName != ''"> | |
43 | - and m.major like #{majorName} | |
44 | - </if> | |
45 | - <if test="status == 1"> | |
46 | - and c.status = 1 | |
47 | - </if> | |
48 | - <if test="status != 1"> | |
49 | - and 1 = 1 | |
50 | - </if> | |
51 | - </where> | |
52 | - </select> | |
20 | + <select id="getListCount" parameterType="com.sincere.student.dto.ConsultSearchDto" resultType="java.lang.Integer"> | |
21 | + select count(DISTINCT c.id) from university_consult c | |
22 | + join university_info info on c.university_id = info.id | |
23 | + left join university_relate_major r on info.id = r.university_id | |
24 | + left join university_major m on m.id = r.major_id | |
25 | + <where> | |
26 | + <if test="columnType > 0"> | |
27 | + and c.column_type = #{columnType} | |
28 | + </if> | |
29 | + <if test="columnType == 0"> | |
30 | + and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort) | |
31 | + </if> | |
32 | + <if test="columnType == -1"> | |
33 | + and 1=1 | |
34 | + </if> | |
35 | + <if test="province != null and province != '' "> | |
36 | + and info.province = #{province} | |
37 | + </if> | |
38 | + <if test="city != null and city != '' "> | |
39 | + and info.city = #{city} | |
40 | + </if> | |
41 | + <if test="universityName != null and universityName != ''"> | |
42 | + and info.name like #{universityName} | |
43 | + </if> | |
44 | + <if test="majorName != null and majorName != ''"> | |
45 | + and m.major like #{majorName} | |
46 | + </if> | |
47 | + <if test="status == 1"> | |
48 | + and c.status = 1 | |
49 | + </if> | |
50 | + <if test="status != 1"> | |
51 | + and 1 = 1 | |
52 | + </if> | |
53 | + </where> | |
54 | + </select> | |
53 | 55 | |
54 | - <select id="getList" parameterType="com.sincere.student.dto.ConsultSearchDto" resultMap="ListMap"> | |
55 | - select DISTINCT c.id , c.column_type , info.id as universityId ,c.read_number , c.img_url ,c.sort , info.name , info.code ,c.status from university_consult c | |
56 | - join university_info info on c.university_id = info.id | |
57 | - left join university_relate_major r on info.id = r.university_id | |
58 | - left join university_major m on m.id = r.major_id | |
59 | - <where> | |
60 | - <if test="columnType > 0"> | |
61 | - and c.column_type = #{columnType} | |
62 | - </if> | |
63 | - <if test="columnType == 0"> | |
64 | - and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort) | |
65 | - </if> | |
66 | - <if test="columnType == -1"> | |
67 | - and 1=1 | |
68 | - </if> | |
69 | - <if test="province != null and province != '' "> | |
70 | - and info.province = #{province} | |
71 | - </if> | |
72 | - <if test="city != null and city != '' "> | |
73 | - and info.city = #{city} | |
74 | - </if> | |
75 | - <if test="universityName != null and universityName != ''"> | |
76 | - and info.name like #{universityName} | |
77 | - </if> | |
78 | - <if test="majorName != null and majorName != ''"> | |
79 | - and m.major like #{majorName} | |
80 | - </if> | |
81 | - <if test="status == 1"> | |
82 | - and c.status = 1 | |
83 | - </if> | |
84 | - <if test="status != 1"> | |
85 | - and 1 = 1 | |
86 | - </if> | |
87 | - </where> | |
88 | - order by c.sort | |
89 | - </select> | |
56 | + <select id="getList" parameterType="com.sincere.student.dto.ConsultSearchDto" resultMap="ListMap"> | |
57 | + select DISTINCT c.id , c.column_type , info.id as universityId ,c.read_number , c.img_url ,c.sort , info.name , | |
58 | + info.code ,c.status | |
59 | + ,c.background from university_consult c | |
60 | + join university_info info on c.university_id = info.id | |
61 | + left join university_relate_major r on info.id = r.university_id | |
62 | + left join university_major m on m.id = r.major_id | |
63 | + <where> | |
64 | + <if test="columnType > 0"> | |
65 | + and c.column_type = #{columnType} | |
66 | + </if> | |
67 | + <if test="columnType == 0"> | |
68 | + and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort) | |
69 | + </if> | |
70 | + <if test="columnType == -1"> | |
71 | + and 1=1 | |
72 | + </if> | |
73 | + <if test="province != null and province != '' "> | |
74 | + and info.province = #{province} | |
75 | + </if> | |
76 | + <if test="city != null and city != '' "> | |
77 | + and info.city = #{city} | |
78 | + </if> | |
79 | + <if test="universityName != null and universityName != ''"> | |
80 | + and info.name like #{universityName} | |
81 | + </if> | |
82 | + <if test="majorName != null and majorName != ''"> | |
83 | + and m.major like #{majorName} | |
84 | + </if> | |
85 | + <if test="status == 1"> | |
86 | + and c.status = 1 | |
87 | + </if> | |
88 | + <if test="status != 1"> | |
89 | + and 1 = 1 | |
90 | + </if> | |
91 | + </where> | |
92 | + order by c.sort | |
93 | + </select> | |
90 | 94 | |
91 | - <select id="selectByUniversityIdAndColumnType" parameterType="com.sincere.student.model.UniversityConsult" resultMap="DetailMap"> | |
92 | - select * from university_consult | |
93 | - where university_id =#{universityId} and column_type = #{columnType} | |
94 | - </select> | |
95 | + <select id="selectByUniversityIdAndColumnType" parameterType="com.sincere.student.model.UniversityConsult" | |
96 | + resultMap="DetailMap"> | |
97 | + select * from university_consult | |
98 | + where university_id =#{universityId} and column_type = #{columnType} | |
99 | + </select> | |
95 | 100 | |
96 | - <select id="getColumnListCount" parameterType="java.lang.Integer" resultType="java.lang.Integer"> | |
97 | - select count(DISTINCT c.id) from university_consult c | |
98 | - join university_info info on c.university_id = info.id | |
99 | - where c.column_type = #{columnType} and c.status = 1 | |
100 | - </select> | |
101 | + <select id="getColumnListCount" parameterType="java.lang.Integer" resultType="java.lang.Integer"> | |
102 | + select count(DISTINCT c.id) from university_consult c | |
103 | + join university_info info on c.university_id = info.id | |
104 | + where c.column_type = #{columnType} and c.status = 1 | |
105 | + </select> | |
101 | 106 | |
102 | - <select id="getColumnList" parameterType="java.lang.Integer" resultMap="ListMap"> | |
103 | - select DISTINCT c.id , info.id as universityId , c.img_url ,c.read_number ,c.sort , info.name , info.code ,university_column_type.name as columnTypeString from university_consult c | |
104 | - join university_info info on c.university_id = info.id | |
105 | - left join university_column_type on c.column_type = university_column_type.id | |
106 | - where c.column_type = #{columnType} and c.status = 1 | |
107 | - order by c.sort | |
108 | - </select> | |
107 | + <select id="getColumnList" parameterType="java.lang.Integer" resultMap="ListMap"> | |
108 | + select DISTINCT c.id , info.id as universityId , c.img_url ,c.read_number ,c.sort , info.name , info.code | |
109 | + ,university_column_type.name as columnTypeString from university_consult c | |
110 | + join university_info info on c.university_id = info.id | |
111 | + left join university_column_type on c.column_type = university_column_type.id | |
112 | + where c.column_type = #{columnType} and c.status = 1 | |
113 | + order by c.sort | |
114 | + </select> | |
109 | 115 | |
110 | - <resultMap id="DetailMap" type="com.sincere.student.model.Consult"> | |
111 | - <result column="id" property="id" /> | |
112 | - <result column="universityId" property="universityId" /> | |
113 | - <result column="name" property="name" /> | |
114 | - <result column="code" property="code" /> | |
115 | - <result column="sort" property="sort" /> | |
116 | - <result column="img_url" property="imgUrl" /> | |
117 | - <result column="column_type" property="columnType" /> | |
118 | - <result column="video_url" property="videoUrl" /> | |
119 | - <result column="context" property="context" /> | |
120 | - <result column="phone" property="phone" /> | |
121 | - <result column="read_number" property="readNumber"/> | |
122 | - </resultMap> | |
123 | - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="DetailMap"> | |
124 | - select * from university_consult c | |
125 | - join university_info info on c.university_id = info.id | |
126 | - where c.id =#{id} | |
127 | - </select> | |
116 | + <resultMap id="DetailMap" type="com.sincere.student.model.Consult"> | |
117 | + <result column="id" property="id"/> | |
118 | + <result column="universityId" property="universityId"/> | |
119 | + <result column="name" property="name"/> | |
120 | + <result column="code" property="code"/> | |
121 | + <result column="sort" property="sort"/> | |
122 | + <result column="img_url" property="imgUrl"/> | |
123 | + <result column="column_type" property="columnType"/> | |
124 | + <result column="video_url" property="videoUrl"/> | |
125 | + <result column="context" property="context"/> | |
126 | + <result column="phone" property="phone"/> | |
127 | + <result column="read_number" property="readNumber"/> | |
128 | + <result column="background" property="background"/> | |
129 | + <result column="model_list" property="modelList"/> | |
130 | + </resultMap> | |
128 | 131 | |
129 | - <update id="updateRead" parameterType="java.lang.Integer"> | |
130 | - update university_consult set read_number = read_number+1 where id=#{id} | |
131 | - </update> | |
132 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="DetailMap"> | |
133 | + select * from university_consult c | |
134 | + join university_info info on c.university_id = info.id | |
135 | + where c.id =#{id} | |
136 | + </select> | |
132 | 137 | |
133 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
134 | - delete from university_consult | |
135 | - where id = #{id,jdbcType=INTEGER} | |
136 | - </delete> | |
137 | - <insert id="insert" parameterType="com.sincere.student.model.UniversityConsult" useGeneratedKeys="true" keyProperty="id"> | |
138 | - insert into university_consult (university_id, column_type, | |
139 | - video_url, context, img_url, | |
140 | - create_time, sort,status,read_number) | |
141 | - values (#{universityId,jdbcType=INTEGER}, #{columnType,jdbcType=INTEGER}, | |
142 | - #{videoUrl,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, | |
143 | - GETDATE(), #{sort,jdbcType=INTEGER},#{status},#{readNumber}) | |
144 | - </insert> | |
138 | + <select id="countSort" resultMap="DetailMap"> | |
139 | + select * from university_consult where | |
140 | + <choose> | |
141 | + <when test="flag ==1"> | |
142 | + sort >= #{sort} | |
143 | + </when> | |
144 | + <when test="flag ==2"> | |
145 | + sort >= #{sort} and id != #{id} | |
146 | + </when> | |
147 | + </choose> | |
148 | + order by sort asc | |
149 | + </select> | |
145 | 150 | |
146 | - <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsult"> | |
147 | - update university_consult | |
148 | - <set> | |
149 | - <if test="universityId != null"> | |
150 | - university_id = #{universityId,jdbcType=INTEGER}, | |
151 | - </if> | |
152 | - <if test="columnType != null"> | |
153 | - column_type = #{columnType,jdbcType=INTEGER}, | |
154 | - </if> | |
155 | - <if test="videoUrl != null"> | |
156 | - video_url = #{videoUrl,jdbcType=VARCHAR}, | |
157 | - </if> | |
158 | - <if test="context != null"> | |
159 | - context = #{context,jdbcType=VARCHAR}, | |
160 | - </if> | |
161 | - <if test="imgUrl != null"> | |
162 | - img_url = #{imgUrl,jdbcType=VARCHAR}, | |
163 | - </if> | |
164 | - <if test="createTime != null"> | |
165 | - create_time = #{createTime,jdbcType=TIMESTAMP}, | |
166 | - </if> | |
167 | - <if test="sort != null"> | |
168 | - sort = #{sort,jdbcType=INTEGER}, | |
169 | - </if> | |
170 | - <if test="status != null"> | |
171 | - status = #{status}, | |
172 | - </if> | |
173 | - <if test="readNumber != 0"> | |
174 | - read_number = #{readNumber}, | |
175 | - </if> | |
176 | - </set> | |
177 | - where id = #{id,jdbcType=INTEGER} | |
178 | - </update> | |
151 | + <update id="updateRead" parameterType="java.lang.Integer"> | |
152 | + update university_consult set read_number = read_number+1 where id=#{id} | |
153 | + </update> | |
154 | + | |
155 | + <update id="updateSort" parameterType="com.sincere.student.model.Consult"> | |
156 | + update university_consult set sort = #{sort} where id=#{id} | |
157 | + </update> | |
158 | + | |
159 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
160 | + delete from university_consult | |
161 | + where id = #{id,jdbcType=INTEGER} | |
162 | + </delete> | |
163 | + <insert id="insert" parameterType="com.sincere.student.model.UniversityConsult" useGeneratedKeys="true" | |
164 | + keyProperty="id"> | |
165 | + insert into university_consult (university_id, column_type, | |
166 | + video_url, context, img_url,create_time, sort,status,read_number,background,model_list) | |
167 | + values (#{universityId,jdbcType=INTEGER}, #{columnType,jdbcType=INTEGER}, | |
168 | + #{videoUrl,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, | |
169 | + GETDATE(), | |
170 | + #{sort,jdbcType=INTEGER},#{status},#{readNumber},#{background,jdbcType=VARCHAR},#{modelList,jdbcType=VARCHAR}) | |
171 | + </insert> | |
172 | + | |
173 | + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsult"> | |
174 | + update university_consult | |
175 | + <set> | |
176 | + <if test="universityId != null"> | |
177 | + university_id = #{universityId,jdbcType=INTEGER}, | |
178 | + </if> | |
179 | + <if test="columnType != null"> | |
180 | + column_type = #{columnType,jdbcType=INTEGER}, | |
181 | + </if> | |
182 | + <if test="videoUrl != null"> | |
183 | + video_url = #{videoUrl,jdbcType=VARCHAR}, | |
184 | + </if> | |
185 | + <if test="context != null"> | |
186 | + context = #{context,jdbcType=VARCHAR}, | |
187 | + </if> | |
188 | + <if test="imgUrl != null"> | |
189 | + img_url = #{imgUrl,jdbcType=VARCHAR}, | |
190 | + </if> | |
191 | + <if test="createTime != null"> | |
192 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | |
193 | + </if> | |
194 | + <if test="sort != null"> | |
195 | + sort = #{sort,jdbcType=INTEGER}, | |
196 | + </if> | |
197 | + <if test="status != null"> | |
198 | + status = #{status}, | |
199 | + </if> | |
200 | + <if test="readNumber != 0"> | |
201 | + read_number = #{readNumber}, | |
202 | + </if> | |
203 | + <if test="background != null"> | |
204 | + background = #{background}, | |
205 | + </if> | |
206 | + <if test="readNumber != 0"> | |
207 | + model_list = #{modelList} | |
208 | + </if> | |
209 | + </set> | |
210 | + where id = #{id,jdbcType=INTEGER} | |
211 | + </update> | |
179 | 212 | |
180 | 213 | </mapper> |
181 | 214 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/UniversityMajorMapper.xml
... | ... | @@ -28,14 +28,14 @@ |
28 | 28 | delete university_relate_major where university_id = #{universityId} |
29 | 29 | </delete> |
30 | 30 | |
31 | - <select id="selectUniversityMajor" parameterType="java.lang.Integer" resultMap="MajorMap" > | |
32 | - select f.id as f_id , f.major as f_major , s.id as s_id , s.major as s_major from | |
33 | - university_major s | |
34 | - join university_major f on f.id = s.p_id | |
35 | - join university_relate_major r on s.id = r.major_id | |
31 | + <select id="selectUniversityMajor" parameterType="java.lang.Integer" resultMap="MajorMap"> | |
32 | + select f.id as f_id , f.major as f_major , s.id as s_id , s.major as s_major from | |
33 | + university_major s | |
34 | + join university_major f on f.id = s.p_id | |
35 | + join university_relate_major r on s.id = r.major_id | |
36 | 36 | where r.university_id = #{id} |
37 | 37 | </select> |
38 | - | |
38 | + | |
39 | 39 | <select id="selectIdByMajor" parameterType="java.util.Map" resultType="java.lang.Integer"> |
40 | 40 | select m.id from university_info info join university_relate_major rm on info.id=rm.university_id |
41 | 41 | join university_major m on rm.major_id = m.id | ... | ... |
src/main/resources/mapper/UniversityMapper.xml
... | ... | @@ -16,7 +16,8 @@ |
16 | 16 | <result column="logo_url" property="logoUrl"/> |
17 | 17 | </resultMap> |
18 | 18 | |
19 | - <select id="getListCount" parameterType="com.sincere.student.dto.UniversitySearchDto" resultType="java.lang.Integer"> | |
19 | + <select id="getListCount" parameterType="com.sincere.student.dto.UniversitySearchDto" | |
20 | + resultType="java.lang.Integer"> | |
20 | 21 | select count(0) from university_info |
21 | 22 | <where> |
22 | 23 | <if test="search != null and search != ''"> |
... | ... | @@ -39,9 +40,11 @@ |
39 | 40 | select * from university_info where id = #{id} |
40 | 41 | </select> |
41 | 42 | |
42 | - <insert id="create" parameterType="com.sincere.student.model.University" > | |
43 | - insert into university_info (name,code,university_type,department,province,city,level,create_time,phone,logo_url) | |
44 | - values (#{name},#{code},#{universityType},#{department},#{province},#{city},#{level},GETDATE(),#{phone},#{logoUrl}) | |
43 | + <insert id="create" parameterType="com.sincere.student.model.University"> | |
44 | + insert into university_info | |
45 | + (name,code,university_type,department,province,city,level,create_time,phone,logo_url) | |
46 | + values | |
47 | + (#{name},#{code},#{universityType},#{department},#{province},#{city},#{level},GETDATE(),#{phone},#{logoUrl}) | |
45 | 48 | </insert> |
46 | 49 | |
47 | 50 | <delete id="delete" parameterType="java.lang.Integer"> | ... | ... |
src/main/resources/mapper/UniversityMessageMapper.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 | <mapper namespace="com.sincere.student.mapper.UniversityMessageMapper"> |
4 | - <resultMap id="BaseResultMap" type="com.sincere.student.model.Message"> | |
5 | - <result column="id" jdbcType="INTEGER" property="id" /> | |
6 | - <result column="title" jdbcType="VARCHAR" property="title" /> | |
7 | - <result column="context" jdbcType="VARCHAR" property="context" /> | |
8 | - <result column="phone" jdbcType="VARCHAR" property="phone" /> | |
9 | - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |
10 | - </resultMap> | |
4 | + <resultMap id="BaseResultMap" type="com.sincere.student.model.Message"> | |
5 | + <result column="id" jdbcType="INTEGER" property="id"/> | |
6 | + <result column="title" jdbcType="VARCHAR" property="title"/> | |
7 | + <result column="context" jdbcType="VARCHAR" property="context"/> | |
8 | + <result column="phone" jdbcType="VARCHAR" property="phone"/> | |
9 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |
10 | + </resultMap> | |
11 | 11 | |
12 | - <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer"> | |
13 | - select count(0) from university_message | |
14 | - <where> | |
15 | - <if test="search != null and search != ''"> | |
16 | - and title like #{search} | |
17 | - </if> | |
18 | - </where> | |
19 | - </select> | |
12 | + <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer"> | |
13 | + select count(0) from university_message | |
14 | + <where> | |
15 | + <if test="search != null and search != ''"> | |
16 | + and title like #{search} | |
17 | + </if> | |
18 | + </where> | |
19 | + </select> | |
20 | 20 | |
21 | - <select id="getList" parameterType="com.sincere.student.dto.MessageSearchDto" resultMap="BaseResultMap"> | |
22 | - select * from university_message | |
23 | - <where> | |
24 | - <if test="search != null and search != ''"> | |
25 | - and title like #{search} | |
26 | - </if> | |
27 | - </where> | |
28 | - </select> | |
21 | + <select id="getList" parameterType="com.sincere.student.dto.MessageSearchDto" resultMap="BaseResultMap"> | |
22 | + select * from university_message | |
23 | + <where> | |
24 | + <if test="search != null and search != ''"> | |
25 | + and title like #{search} | |
26 | + </if> | |
27 | + </where> | |
28 | + </select> | |
29 | 29 | |
30 | - <select id="getDetail" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
31 | - select * from university_message m | |
32 | - where m.id=#{id} | |
33 | - </select> | |
30 | + <select id="getDetail" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
31 | + select * from university_message m | |
32 | + where m.id=#{id} | |
33 | + </select> | |
34 | 34 | |
35 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
36 | - delete from university_message | |
37 | - where id = #{id,jdbcType=INTEGER} | |
38 | - </delete> | |
35 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
36 | + delete from university_message | |
37 | + where id = #{id,jdbcType=INTEGER} | |
38 | + </delete> | |
39 | 39 | |
40 | - <insert id="insert" parameterType="com.sincere.student.model.Message"> | |
41 | - insert into university_message (title, context, | |
42 | - phone, create_time) | |
43 | - values (#{title,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, | |
44 | - #{phone,jdbcType=VARCHAR}, GETDATE()) | |
45 | - </insert> | |
46 | - <insert id="insertSelective" parameterType="com.sincere.student.model.Message"> | |
47 | - insert into university_message | |
48 | - <trim prefix="(" suffix=")" suffixOverrides=","> | |
49 | - <if test="id != null"> | |
50 | - id, | |
51 | - </if> | |
52 | - <if test="title != null"> | |
53 | - title, | |
54 | - </if> | |
55 | - <if test="context != null"> | |
56 | - context, | |
57 | - </if> | |
58 | - <if test="phone != null"> | |
59 | - phone, | |
60 | - </if> | |
61 | - <if test="createTime != null"> | |
62 | - create_time, | |
63 | - </if> | |
64 | - </trim> | |
65 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | |
66 | - <if test="id != null"> | |
67 | - #{id,jdbcType=INTEGER}, | |
68 | - </if> | |
69 | - <if test="title != null"> | |
70 | - #{title,jdbcType=VARCHAR}, | |
71 | - </if> | |
72 | - <if test="context != null"> | |
73 | - #{context,jdbcType=VARCHAR}, | |
74 | - </if> | |
75 | - <if test="phone != null"> | |
76 | - #{phone,jdbcType=VARCHAR}, | |
77 | - </if> | |
78 | - <if test="createTime != null"> | |
79 | - #{createTime,jdbcType=TIMESTAMP}, | |
80 | - </if> | |
81 | - </trim> | |
82 | - </insert> | |
40 | + <insert id="insert" parameterType="com.sincere.student.model.Message"> | |
41 | + insert into university_message (title, context, | |
42 | + phone, create_time) | |
43 | + values (#{title,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, | |
44 | + #{phone,jdbcType=VARCHAR}, GETDATE()) | |
45 | + </insert> | |
46 | + <insert id="insertSelective" parameterType="com.sincere.student.model.Message"> | |
47 | + insert into university_message | |
48 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
49 | + <if test="id != null"> | |
50 | + id, | |
51 | + </if> | |
52 | + <if test="title != null"> | |
53 | + title, | |
54 | + </if> | |
55 | + <if test="context != null"> | |
56 | + context, | |
57 | + </if> | |
58 | + <if test="phone != null"> | |
59 | + phone, | |
60 | + </if> | |
61 | + <if test="createTime != null"> | |
62 | + create_time, | |
63 | + </if> | |
64 | + </trim> | |
65 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
66 | + <if test="id != null"> | |
67 | + #{id,jdbcType=INTEGER}, | |
68 | + </if> | |
69 | + <if test="title != null"> | |
70 | + #{title,jdbcType=VARCHAR}, | |
71 | + </if> | |
72 | + <if test="context != null"> | |
73 | + #{context,jdbcType=VARCHAR}, | |
74 | + </if> | |
75 | + <if test="phone != null"> | |
76 | + #{phone,jdbcType=VARCHAR}, | |
77 | + </if> | |
78 | + <if test="createTime != null"> | |
79 | + #{createTime,jdbcType=TIMESTAMP}, | |
80 | + </if> | |
81 | + </trim> | |
82 | + </insert> | |
83 | 83 | </mapper> |
84 | 84 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/UniversityPointMapper.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 | <mapper namespace="com.sincere.student.mapper.UniversityPointMapper"> |
4 | - <resultMap id="BaseResultMap" type="com.sincere.student.model.Point"> | |
5 | - <id column="id" jdbcType="INTEGER" property="id" /> | |
6 | - <result column="submit_id" jdbcType="INTEGER" property="submitId" /> | |
7 | - <result column="university" jdbcType="VARCHAR" property="universityName" /> | |
8 | - <result column="major" jdbcType="VARCHAR" property="major" /> | |
9 | - <result column="grade" jdbcType="VARCHAR" property="grade" /> | |
10 | - <result column="enroll_number" jdbcType="INTEGER" property="enrollNumber" /> | |
11 | - <result column="rank" jdbcType="INTEGER" property="rank" /> | |
12 | - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |
13 | - <result column="province" jdbcType="VARCHAR" property="province" /> | |
14 | - <result column="city" jdbcType="VARCHAR" property="city" /> | |
15 | - </resultMap> | |
4 | + <resultMap id="BaseResultMap" type="com.sincere.student.model.Point"> | |
5 | + <id column="id" jdbcType="INTEGER" property="id"/> | |
6 | + <result column="submit_id" jdbcType="INTEGER" property="submitId"/> | |
7 | + <result column="university" jdbcType="VARCHAR" property="universityName"/> | |
8 | + <result column="major" jdbcType="VARCHAR" property="major"/> | |
9 | + <result column="grade" jdbcType="VARCHAR" property="grade"/> | |
10 | + <result column="enroll_number" jdbcType="INTEGER" property="enrollNumber"/> | |
11 | + <result column="rank" jdbcType="INTEGER" property="rank"/> | |
12 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |
13 | + <result column="province" jdbcType="VARCHAR" property="province"/> | |
14 | + <result column="city" jdbcType="VARCHAR" property="city"/> | |
15 | + </resultMap> | |
16 | 16 | |
17 | - <insert id="insertBatch" parameterType="java.util.List"> | |
18 | - insert into university_point (submit_id, university , major ,grade ,enroll_number ,rank,create_time,province,city) | |
19 | - values | |
20 | - <foreach collection="list" item="emp" separator=","> | |
21 | - (#{emp.submitId}, #{emp.universityName}, #{emp.major}, #{emp.grade}, #{emp.enrollNumber}, #{emp.rank},GETDATE(),#{emp.province},#{emp.city}) | |
22 | - </foreach> | |
23 | - </insert> | |
17 | + <insert id="insertBatch" parameterType="java.util.List"> | |
18 | + insert into university_point (submit_id, university , major ,grade ,enroll_number | |
19 | + ,rank,create_time,province,city) | |
20 | + values | |
21 | + <foreach collection="list" item="emp" separator=","> | |
22 | + (#{emp.submitId}, #{emp.universityName}, #{emp.major}, #{emp.grade}, #{emp.enrollNumber}, | |
23 | + #{emp.rank},GETDATE(),#{emp.province},#{emp.city}) | |
24 | + </foreach> | |
25 | + </insert> | |
24 | 26 | |
25 | - <delete id="deleteBySubmit" parameterType="java.lang.Integer"> | |
26 | - delete from university_point | |
27 | - where submit_id = #{id,jdbcType=INTEGER} | |
28 | - </delete> | |
27 | + <delete id="deleteBySubmit" parameterType="java.lang.Integer"> | |
28 | + delete from university_point | |
29 | + where submit_id = #{id,jdbcType=INTEGER} | |
30 | + </delete> | |
29 | 31 | |
30 | 32 | </mapper> |
31 | 33 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/UniversityReplyMapper.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 | <mapper namespace="com.sincere.student.mapper.UniversityReplyMapper"> |
4 | - <resultMap id="BaseResultMap" type="com.sincere.student.model.Reply"> | |
5 | - <id column="id" jdbcType="INTEGER" property="id" /> | |
6 | - <result column="message_id" jdbcType="INTEGER" property="messageId" /> | |
7 | - <result column="context" jdbcType="VARCHAR" property="context" /> | |
8 | - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |
9 | - </resultMap> | |
10 | - <sql id="Base_Column_List"> | |
11 | - id, message_id, context, create_time | |
12 | - </sql> | |
13 | - <select id="selectByMessageId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
14 | - select | |
15 | - <include refid="Base_Column_List" /> | |
16 | - from university_reply | |
17 | - where message_id = #{id,jdbcType=INTEGER} | |
18 | - order by create_time desc | |
19 | - </select> | |
20 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
21 | - delete from university_reply | |
22 | - where id = #{id,jdbcType=INTEGER} | |
23 | - </delete> | |
4 | + <resultMap id="BaseResultMap" type="com.sincere.student.model.Reply"> | |
5 | + <id column="id" jdbcType="INTEGER" property="id"/> | |
6 | + <result column="message_id" jdbcType="INTEGER" property="messageId"/> | |
7 | + <result column="context" jdbcType="VARCHAR" property="context"/> | |
8 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |
9 | + </resultMap> | |
10 | + <sql id="Base_Column_List"> | |
11 | + id, message_id, context, create_time | |
12 | + </sql> | |
13 | + <select id="selectByMessageId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
14 | + select | |
15 | + <include refid="Base_Column_List"/> | |
16 | + from university_reply | |
17 | + where message_id = #{id,jdbcType=INTEGER} | |
18 | + order by create_time desc | |
19 | + </select> | |
20 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
21 | + delete from university_reply | |
22 | + where id = #{id,jdbcType=INTEGER} | |
23 | + </delete> | |
24 | 24 | |
25 | - <delete id="deleteByMessageId" parameterType="java.lang.Integer"> | |
26 | - delete from university_reply | |
27 | - where message_id = #{id,jdbcType=INTEGER} | |
28 | - </delete> | |
29 | - <insert id="insert" parameterType="com.sincere.student.model.Reply"> | |
30 | - insert into university_reply (message_id, context, | |
31 | - create_time) | |
32 | - values (#{messageId,jdbcType=INTEGER}, #{context,jdbcType=VARCHAR}, | |
33 | - GETDATE()) | |
34 | - </insert> | |
35 | - <insert id="insertSelective" parameterType="com.sincere.student.model.Reply"> | |
36 | - insert into university_reply | |
37 | - <trim prefix="(" suffix=")" suffixOverrides=","> | |
38 | - <if test="id != null"> | |
39 | - id, | |
40 | - </if> | |
41 | - <if test="messageId != null"> | |
42 | - message_id, | |
43 | - </if> | |
44 | - <if test="context != null"> | |
45 | - context, | |
46 | - </if> | |
47 | - <if test="createTime != null"> | |
48 | - create_time, | |
49 | - </if> | |
50 | - </trim> | |
51 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | |
52 | - <if test="id != null"> | |
53 | - #{id,jdbcType=INTEGER}, | |
54 | - </if> | |
55 | - <if test="messageId != null"> | |
56 | - #{messageId,jdbcType=INTEGER}, | |
57 | - </if> | |
58 | - <if test="context != null"> | |
59 | - #{context,jdbcType=VARCHAR}, | |
60 | - </if> | |
61 | - <if test="createTime != null"> | |
62 | - #{createTime,jdbcType=TIMESTAMP}, | |
63 | - </if> | |
64 | - </trim> | |
65 | - </insert> | |
66 | - <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.Reply"> | |
67 | - update university_reply | |
68 | - <set> | |
69 | - <if test="messageId != null"> | |
70 | - message_id = #{messageId,jdbcType=INTEGER}, | |
71 | - </if> | |
72 | - <if test="context != null"> | |
25 | + <delete id="deleteByMessageId" parameterType="java.lang.Integer"> | |
26 | + delete from university_reply | |
27 | + where message_id = #{id,jdbcType=INTEGER} | |
28 | + </delete> | |
29 | + <insert id="insert" parameterType="com.sincere.student.model.Reply"> | |
30 | + insert into university_reply (message_id, context, | |
31 | + create_time) | |
32 | + values (#{messageId,jdbcType=INTEGER}, #{context,jdbcType=VARCHAR}, | |
33 | + GETDATE()) | |
34 | + </insert> | |
35 | + <insert id="insertSelective" parameterType="com.sincere.student.model.Reply"> | |
36 | + insert into university_reply | |
37 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
38 | + <if test="id != null"> | |
39 | + id, | |
40 | + </if> | |
41 | + <if test="messageId != null"> | |
42 | + message_id, | |
43 | + </if> | |
44 | + <if test="context != null"> | |
45 | + context, | |
46 | + </if> | |
47 | + <if test="createTime != null"> | |
48 | + create_time, | |
49 | + </if> | |
50 | + </trim> | |
51 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
52 | + <if test="id != null"> | |
53 | + #{id,jdbcType=INTEGER}, | |
54 | + </if> | |
55 | + <if test="messageId != null"> | |
56 | + #{messageId,jdbcType=INTEGER}, | |
57 | + </if> | |
58 | + <if test="context != null"> | |
59 | + #{context,jdbcType=VARCHAR}, | |
60 | + </if> | |
61 | + <if test="createTime != null"> | |
62 | + #{createTime,jdbcType=TIMESTAMP}, | |
63 | + </if> | |
64 | + </trim> | |
65 | + </insert> | |
66 | + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.Reply"> | |
67 | + update university_reply | |
68 | + <set> | |
69 | + <if test="messageId != null"> | |
70 | + message_id = #{messageId,jdbcType=INTEGER}, | |
71 | + </if> | |
72 | + <if test="context != null"> | |
73 | + context = #{context,jdbcType=VARCHAR}, | |
74 | + </if> | |
75 | + <if test="createTime != null"> | |
76 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | |
77 | + </if> | |
78 | + </set> | |
79 | + where id = #{id,jdbcType=INTEGER} | |
80 | + </update> | |
81 | + <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.Reply"> | |
82 | + update university_reply | |
83 | + set message_id = #{messageId,jdbcType=INTEGER}, | |
73 | 84 | context = #{context,jdbcType=VARCHAR}, |
74 | - </if> | |
75 | - <if test="createTime != null"> | |
76 | - create_time = #{createTime,jdbcType=TIMESTAMP}, | |
77 | - </if> | |
78 | - </set> | |
79 | - where id = #{id,jdbcType=INTEGER} | |
80 | - </update> | |
81 | - <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.Reply"> | |
82 | - update university_reply | |
83 | - set message_id = #{messageId,jdbcType=INTEGER}, | |
84 | - context = #{context,jdbcType=VARCHAR}, | |
85 | - create_time = #{createTime,jdbcType=TIMESTAMP} | |
86 | - where id = #{id,jdbcType=INTEGER} | |
87 | - </update> | |
85 | + create_time = #{createTime,jdbcType=TIMESTAMP} | |
86 | + where id = #{id,jdbcType=INTEGER} | |
87 | + </update> | |
88 | 88 | </mapper> |
89 | 89 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/UniversitySubmitFileMapper.xml
... | ... | @@ -2,181 +2,181 @@ |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | 3 | <mapper namespace="com.sincere.student.mapper.UniversitySubmitFileMapper"> |
4 | 4 | |
5 | - <resultMap id="LineMap" type="com.sincere.student.dto.submit.SubmitLine"> | |
6 | - <result column="id" property="id" /> | |
7 | - <result column="title" property="title" /> | |
8 | - <collection property="universityList" ofType="com.sincere.student.dto.submit.SubmitUniv"> | |
9 | - <result column="universityId" property="universityId" /> | |
10 | - <result column="name" property="universityName" /> | |
11 | - <result column="major" property="major" /> | |
12 | - <result column="grade" property="grade" /> | |
13 | - <result column="enroll_number" property="enrollNumber" /> | |
14 | - <result column="rank" property="rank" /> | |
15 | - </collection> | |
16 | - </resultMap> | |
5 | + <resultMap id="LineMap" type="com.sincere.student.dto.submit.SubmitLine"> | |
6 | + <result column="id" property="id"/> | |
7 | + <result column="title" property="title"/> | |
8 | + <collection property="universityList" ofType="com.sincere.student.dto.submit.SubmitUniv"> | |
9 | + <result column="universityId" property="universityId"/> | |
10 | + <result column="name" property="universityName"/> | |
11 | + <result column="major" property="major"/> | |
12 | + <result column="grade" property="grade"/> | |
13 | + <result column="enroll_number" property="enrollNumber"/> | |
14 | + <result column="rank" property="rank"/> | |
15 | + </collection> | |
16 | + </resultMap> | |
17 | 17 | |
18 | - <select id="getAppListCount" parameterType="com.sincere.student.dto.PointSearchDto" resultType="java.lang.Integer"> | |
19 | - select count(DISTINCT(sf.id)) | |
20 | - from university_submit_file sf join university_point p on sf.id = p.submit_id | |
21 | - <where> | |
22 | - <if test="submitId != 0"> | |
23 | - and sf.id = #{submitId} | |
24 | - </if> | |
25 | - <if test="majorName != null and majorName != '' "> | |
26 | - and p.major like #{majorName} | |
27 | - </if> | |
28 | - <if test="universityName != null and universityName != '' "> | |
29 | - and p.university like #{universityName} | |
30 | - </if> | |
31 | - <if test="province != null and province != '' "> | |
32 | - and p.province = #{province} | |
33 | - </if> | |
34 | - <if test="city != null and city != '' "> | |
35 | - and p.city = #{city} | |
36 | - </if> | |
37 | - <if test="point != 0 "> | |
38 | - <![CDATA[ and p.grade > #{point}-5 and p.grade < #{point} +5 ]]> | |
39 | - </if> | |
40 | - <if test="rank != 0 "> | |
41 | - <![CDATA[ and p.rank > #{rank}-100 and p.rank < #{rank} +100 ]]> | |
42 | - </if> | |
43 | - </where> | |
44 | - </select> | |
18 | + <select id="getAppListCount" parameterType="com.sincere.student.dto.PointSearchDto" resultType="java.lang.Integer"> | |
19 | + select count(DISTINCT(sf.id)) | |
20 | + from university_submit_file sf join university_point p on sf.id = p.submit_id | |
21 | + <where> | |
22 | + <if test="submitId != 0"> | |
23 | + and sf.id = #{submitId} | |
24 | + </if> | |
25 | + <if test="majorName != null and majorName != '' "> | |
26 | + and p.major like #{majorName} | |
27 | + </if> | |
28 | + <if test="universityName != null and universityName != '' "> | |
29 | + and p.university like #{universityName} | |
30 | + </if> | |
31 | + <if test="province != null and province != '' "> | |
32 | + and p.province = #{province} | |
33 | + </if> | |
34 | + <if test="city != null and city != '' "> | |
35 | + and p.city = #{city} | |
36 | + </if> | |
37 | + <if test="point != 0 "> | |
38 | + <![CDATA[ and p.grade > #{point}-5 and p.grade < #{point} +5 ]]> | |
39 | + </if> | |
40 | + <if test="rank != 0 "> | |
41 | + <![CDATA[ and p.rank > #{rank}-100 and p.rank < #{rank} +100 ]]> | |
42 | + </if> | |
43 | + </where> | |
44 | + </select> | |
45 | 45 | |
46 | - <select id="getAppList" parameterType="com.sincere.student.dto.PointSearchDto" resultMap="LineMap"> | |
47 | - select sf.id , sf.title , p.university as name , p.major , p.enroll_number , p.rank , p.grade | |
48 | - from university_submit_file sf join university_point p on sf.id = p.submit_id | |
49 | - <where> | |
50 | - <if test="submitId != 0"> | |
51 | - and sf.id = #{submitId} | |
52 | - </if> | |
53 | - <if test="majorName != null and majorName != '' "> | |
54 | - and p.major like #{majorName} | |
55 | - </if> | |
56 | - <if test="universityName != null and universityName != '' "> | |
57 | - and p.university like #{universityName} | |
58 | - </if> | |
59 | - <if test="province != null and province != '' "> | |
60 | - and p.province = #{province} | |
61 | - </if> | |
62 | - <if test="city != null and city != '' "> | |
63 | - and p.city = #{city} | |
64 | - </if> | |
65 | - <if test="point != 0 "> | |
66 | - <![CDATA[ and p.grade >= #{point}-5 and p.grade <= #{point} +5 ]]> | |
67 | - </if> | |
68 | - <if test="rank != 0 "> | |
69 | - <![CDATA[ and p.rank >= #{rank}-100 and p.rank <= #{rank} +100 ]]> | |
70 | - </if> | |
71 | - </where> | |
72 | - order by sf.id | |
73 | - </select> | |
46 | + <select id="getAppList" parameterType="com.sincere.student.dto.PointSearchDto" resultMap="LineMap"> | |
47 | + select sf.id , sf.title , p.university as name , p.major , p.enroll_number , p.rank , p.grade | |
48 | + from university_submit_file sf join university_point p on sf.id = p.submit_id | |
49 | + <where> | |
50 | + <if test="submitId != 0"> | |
51 | + and sf.id = #{submitId} | |
52 | + </if> | |
53 | + <if test="majorName != null and majorName != '' "> | |
54 | + and p.major like #{majorName} | |
55 | + </if> | |
56 | + <if test="universityName != null and universityName != '' "> | |
57 | + and p.university like #{universityName} | |
58 | + </if> | |
59 | + <if test="province != null and province != '' "> | |
60 | + and p.province = #{province} | |
61 | + </if> | |
62 | + <if test="city != null and city != '' "> | |
63 | + and p.city = #{city} | |
64 | + </if> | |
65 | + <if test="point != 0 "> | |
66 | + <![CDATA[ and p.grade >= #{point}-5 and p.grade <= #{point} +5 ]]> | |
67 | + </if> | |
68 | + <if test="rank != 0 "> | |
69 | + <![CDATA[ and p.rank >= #{rank}-100 and p.rank <= #{rank} +100 ]]> | |
70 | + </if> | |
71 | + </where> | |
72 | + order by sf.id | |
73 | + </select> | |
74 | 74 | |
75 | - <resultMap id="BaseResultMap" type="com.sincere.student.model.SubmitFile"> | |
76 | - <id column="id" jdbcType="INTEGER" property="id" /> | |
77 | - <result column="title" jdbcType="VARCHAR" property="title" /> | |
78 | - <result column="file_url" jdbcType="VARCHAR" property="fileUrl" /> | |
79 | - <result column="year" jdbcType="VARCHAR" property="year" /> | |
80 | - <result column="sort" jdbcType="INTEGER" property="sort" /> | |
81 | - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |
82 | - </resultMap> | |
75 | + <resultMap id="BaseResultMap" type="com.sincere.student.model.SubmitFile"> | |
76 | + <id column="id" jdbcType="INTEGER" property="id"/> | |
77 | + <result column="title" jdbcType="VARCHAR" property="title"/> | |
78 | + <result column="file_url" jdbcType="VARCHAR" property="fileUrl"/> | |
79 | + <result column="year" jdbcType="VARCHAR" property="year"/> | |
80 | + <result column="sort" jdbcType="INTEGER" property="sort"/> | |
81 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |
82 | + </resultMap> | |
83 | 83 | |
84 | - <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer"> | |
85 | - select count(0) from university_submit_file | |
86 | - <where> | |
87 | - <if test="search != null and search != '' "> | |
88 | - title like #{search} | |
89 | - </if> | |
90 | - </where> | |
91 | - </select> | |
84 | + <select id="getListCount" parameterType="com.sincere.student.dto.MessageSearchDto" resultType="java.lang.Integer"> | |
85 | + select count(0) from university_submit_file | |
86 | + <where> | |
87 | + <if test="search != null and search != '' "> | |
88 | + title like #{search} | |
89 | + </if> | |
90 | + </where> | |
91 | + </select> | |
92 | 92 | |
93 | - <select id="getList" parameterType="com.sincere.student.dto.MessageSearchDto" resultMap="BaseResultMap"> | |
94 | - select * from university_submit_file | |
95 | - <where> | |
96 | - <if test="search != null and search != '' "> | |
97 | - title like #{search} | |
98 | - </if> | |
99 | - </where> | |
100 | - order by sort | |
101 | - </select> | |
93 | + <select id="getList" parameterType="com.sincere.student.dto.MessageSearchDto" resultMap="BaseResultMap"> | |
94 | + select * from university_submit_file | |
95 | + <where> | |
96 | + <if test="search != null and search != '' "> | |
97 | + title like #{search} | |
98 | + </if> | |
99 | + </where> | |
100 | + order by sort | |
101 | + </select> | |
102 | 102 | |
103 | 103 | |
104 | - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
105 | - select * | |
106 | - from university_submit_file | |
107 | - where id = #{id,jdbcType=INTEGER} | |
108 | - </select> | |
109 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
110 | - delete from university_submit_file | |
111 | - where id = #{id,jdbcType=INTEGER} | |
112 | - </delete> | |
113 | - <insert id="insert" parameterType="com.sincere.student.model.SubmitFile" useGeneratedKeys="true" keyProperty="id"> | |
114 | - insert into university_submit_file (title, year, | |
115 | - sort, create_time,file_url) | |
116 | - values (#{title,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR}, | |
117 | - #{sort,jdbcType=INTEGER}, GETDATE(),#{fileUrl}) | |
118 | - </insert> | |
119 | - <insert id="insertSelective" parameterType="com.sincere.student.model.SubmitFile"> | |
120 | - insert into university_submit_file | |
121 | - <trim prefix="(" suffix=")" suffixOverrides=","> | |
122 | - <if test="id != null"> | |
123 | - id, | |
124 | - </if> | |
125 | - <if test="title != null"> | |
126 | - title, | |
127 | - </if> | |
128 | - <if test="year != null"> | |
129 | - year, | |
130 | - </if> | |
131 | - <if test="sort != null"> | |
132 | - sort, | |
133 | - </if> | |
134 | - <if test="createTime != null"> | |
135 | - create_time, | |
136 | - </if> | |
137 | - </trim> | |
138 | - <trim prefix="values (" suffix=")" suffixOverrides=","> | |
139 | - <if test="id != null"> | |
140 | - #{id,jdbcType=INTEGER}, | |
141 | - </if> | |
142 | - <if test="title != null"> | |
143 | - #{title,jdbcType=VARCHAR}, | |
144 | - </if> | |
145 | - <if test="year != null"> | |
146 | - #{year,jdbcType=VARCHAR}, | |
147 | - </if> | |
148 | - <if test="sort != null"> | |
149 | - #{sort,jdbcType=INTEGER}, | |
150 | - </if> | |
151 | - <if test="createTime != null"> | |
152 | - #{createTime,jdbcType=TIMESTAMP}, | |
153 | - </if> | |
154 | - </trim> | |
155 | - </insert> | |
156 | - <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.SubmitFile"> | |
157 | - update university_submit_file | |
158 | - <set> | |
159 | - <if test="title != null and title != ''"> | |
160 | - title = #{title,jdbcType=VARCHAR}, | |
161 | - </if> | |
162 | - <if test="year != null and year != ''"> | |
104 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
105 | + select * | |
106 | + from university_submit_file | |
107 | + where id = #{id,jdbcType=INTEGER} | |
108 | + </select> | |
109 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
110 | + delete from university_submit_file | |
111 | + where id = #{id,jdbcType=INTEGER} | |
112 | + </delete> | |
113 | + <insert id="insert" parameterType="com.sincere.student.model.SubmitFile" useGeneratedKeys="true" keyProperty="id"> | |
114 | + insert into university_submit_file (title, year, | |
115 | + sort, create_time,file_url) | |
116 | + values (#{title,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR}, | |
117 | + #{sort,jdbcType=INTEGER}, GETDATE(),#{fileUrl}) | |
118 | + </insert> | |
119 | + <insert id="insertSelective" parameterType="com.sincere.student.model.SubmitFile"> | |
120 | + insert into university_submit_file | |
121 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
122 | + <if test="id != null"> | |
123 | + id, | |
124 | + </if> | |
125 | + <if test="title != null"> | |
126 | + title, | |
127 | + </if> | |
128 | + <if test="year != null"> | |
129 | + year, | |
130 | + </if> | |
131 | + <if test="sort != null"> | |
132 | + sort, | |
133 | + </if> | |
134 | + <if test="createTime != null"> | |
135 | + create_time, | |
136 | + </if> | |
137 | + </trim> | |
138 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
139 | + <if test="id != null"> | |
140 | + #{id,jdbcType=INTEGER}, | |
141 | + </if> | |
142 | + <if test="title != null"> | |
143 | + #{title,jdbcType=VARCHAR}, | |
144 | + </if> | |
145 | + <if test="year != null"> | |
146 | + #{year,jdbcType=VARCHAR}, | |
147 | + </if> | |
148 | + <if test="sort != null"> | |
149 | + #{sort,jdbcType=INTEGER}, | |
150 | + </if> | |
151 | + <if test="createTime != null"> | |
152 | + #{createTime,jdbcType=TIMESTAMP}, | |
153 | + </if> | |
154 | + </trim> | |
155 | + </insert> | |
156 | + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.SubmitFile"> | |
157 | + update university_submit_file | |
158 | + <set> | |
159 | + <if test="title != null and title != ''"> | |
160 | + title = #{title,jdbcType=VARCHAR}, | |
161 | + </if> | |
162 | + <if test="year != null and year != ''"> | |
163 | + year = #{year,jdbcType=VARCHAR}, | |
164 | + </if> | |
165 | + <if test="sort != 0"> | |
166 | + sort = #{sort,jdbcType=INTEGER}, | |
167 | + </if> | |
168 | + <if test="fileUrl != null and fileUrl != ''"> | |
169 | + file_url = #{fileUrl,jdbcType=VARCHAR}, | |
170 | + </if> | |
171 | + </set> | |
172 | + where id = #{id,jdbcType=INTEGER} | |
173 | + </update> | |
174 | + <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.SubmitFile"> | |
175 | + update university_submit_file | |
176 | + set title = #{title,jdbcType=VARCHAR}, | |
163 | 177 | year = #{year,jdbcType=VARCHAR}, |
164 | - </if> | |
165 | - <if test="sort != 0"> | |
166 | 178 | sort = #{sort,jdbcType=INTEGER}, |
167 | - </if> | |
168 | - <if test="fileUrl != null and fileUrl != ''"> | |
169 | - file_url = #{fileUrl,jdbcType=VARCHAR}, | |
170 | - </if> | |
171 | - </set> | |
172 | - where id = #{id,jdbcType=INTEGER} | |
173 | - </update> | |
174 | - <update id="updateByPrimaryKey" parameterType="com.sincere.student.model.SubmitFile"> | |
175 | - update university_submit_file | |
176 | - set title = #{title,jdbcType=VARCHAR}, | |
177 | - year = #{year,jdbcType=VARCHAR}, | |
178 | - sort = #{sort,jdbcType=INTEGER}, | |
179 | - create_time = #{createTime,jdbcType=TIMESTAMP} | |
180 | - where id = #{id,jdbcType=INTEGER} | |
181 | - </update> | |
179 | + create_time = #{createTime,jdbcType=TIMESTAMP} | |
180 | + where id = #{id,jdbcType=INTEGER} | |
181 | + </update> | |
182 | 182 | </mapper> |
183 | 183 | \ No newline at end of file | ... | ... |
src/main/resources/mapper/VideoMapper.xml
... | ... | @@ -11,13 +11,13 @@ |
11 | 11 | <result column="create_time" property="createTime"/> |
12 | 12 | <result column="name" property="name"/> |
13 | 13 | <result column="code" property="code"/> |
14 | - <result column="status" property="status" /> | |
15 | - <result column="logo_url" property="imgUrl" /> | |
16 | - <result column="duration" property="duration" /> | |
17 | - <result column="cover_url" property="coverUrl" /> | |
18 | - <result column="video_name" property="videoName" /> | |
19 | - <result column="read_number" property="readNumber" /> | |
20 | - <result column="columnTypeString" property="columnTypeString" /> | |
14 | + <result column="status" property="status"/> | |
15 | + <result column="logo_url" property="imgUrl"/> | |
16 | + <result column="duration" property="duration"/> | |
17 | + <result column="cover_url" property="coverUrl"/> | |
18 | + <result column="video_name" property="videoName"/> | |
19 | + <result column="read_number" property="readNumber"/> | |
20 | + <result column="columnTypeString" property="columnTypeString"/> | |
21 | 21 | |
22 | 22 | </resultMap> |
23 | 23 | |
... | ... | @@ -29,9 +29,23 @@ |
29 | 29 | select * from university_video where id = #{id} |
30 | 30 | </select> |
31 | 31 | |
32 | + <select id="countSort" resultMap="VideoMap"> | |
33 | + select * from university_video where | |
34 | + <choose> | |
35 | + <when test="flag ==1"> | |
36 | + sort >= #{sort} | |
37 | + </when> | |
38 | + <when test="flag ==2"> | |
39 | + sort >= #{sort} and id != #{id} | |
40 | + </when> | |
41 | + </choose> | |
42 | + order by sort asc | |
43 | + </select> | |
32 | 44 | |
33 | - <select id="getUniversityListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer"> | |
34 | - select count( distinct (v.university_id)) from university_video v join university_info info on v.university_id = info.id | |
45 | + <select id="getUniversityListCount" parameterType="com.sincere.student.dto.VideoSearchDto" | |
46 | + resultType="java.lang.Integer"> | |
47 | + select count( distinct (v.university_id)) from university_video v join university_info info on v.university_id = | |
48 | + info.id | |
35 | 49 | <where> |
36 | 50 | <if test="columnType != 0"> |
37 | 51 | and v.column_type = #{columnType} |
... | ... | @@ -52,7 +66,8 @@ |
52 | 66 | </select> |
53 | 67 | |
54 | 68 | <select id="getUniversityList" parameterType="com.sincere.student.dto.VideoSearchDto" resultMap="VideoMap"> |
55 | - select distinct v.university_id , info.name,info.code ,info.logo_url from university_video v join university_info info on v.university_id = info.id | |
69 | + select distinct v.university_id , info.name,info.code ,info.logo_url from university_video v join | |
70 | + university_info info on v.university_id = info.id | |
56 | 71 | <where> |
57 | 72 | <if test="columnType != 0"> |
58 | 73 | and v.column_type = #{columnType} |
... | ... | @@ -95,7 +110,8 @@ |
95 | 110 | </select> |
96 | 111 | |
97 | 112 | <select id="getList" parameterType="com.sincere.student.dto.VideoSearchDto" resultMap="VideoMap"> |
98 | - select v.*,info.name,info.code ,info.logo_url , university_column_type.name as columnTypeString from university_video v join university_info info on v.university_id = info.id | |
113 | + select v.*,info.name,info.code ,info.logo_url , university_column_type.name as columnTypeString from | |
114 | + university_video v join university_info info on v.university_id = info.id | |
99 | 115 | left join university_column_type on v.column_type = university_column_type.id |
100 | 116 | <where> |
101 | 117 | <if test="columnType != 0"> |
... | ... | @@ -114,12 +130,14 @@ |
114 | 130 | and 1 = 1 |
115 | 131 | </if> |
116 | 132 | </where> |
117 | - order by v.sort | |
133 | + order by v.sort | |
118 | 134 | </select> |
119 | 135 | |
120 | - <insert id="create" parameterType="com.sincere.student.model.Video" useGeneratedKeys="true" keyProperty="id"> | |
121 | - insert into university_video (column_type,university_id,sort,video_url,create_time,status,duration,cover_url,video_name,read_number) | |
122 | - values (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE(),#{status},#{duration},#{coverUrl},#{videoName},#{readNumber}) | |
136 | + <insert id="create" parameterType="com.sincere.student.model.Video" useGeneratedKeys="true" keyProperty="id"> | |
137 | + insert into university_video | |
138 | + (column_type,university_id,sort,video_url,create_time,status,duration,cover_url,video_name,read_number) | |
139 | + values | |
140 | + (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE(),#{status},#{duration},#{coverUrl},#{videoName},#{readNumber}) | |
123 | 141 | </insert> |
124 | 142 | |
125 | 143 | <delete id="delete" parameterType="java.lang.Integer"> |
... | ... | @@ -157,6 +175,6 @@ |
157 | 175 | read_number=#{readNumber}, |
158 | 176 | </if> |
159 | 177 | </trim> |
160 | - where id = #{id} | |
178 | + where id = #{id} | |
161 | 179 | </update> |
162 | 180 | </mapper> | ... | ... |