Commit b246a387b84e8f04941da634e08efad03e1ae87c

Authored by 陈杰
1 parent 3c7f8a2c
Exists in master

bug 修复

@@ -12,6 +12,27 @@ @@ -12,6 +12,27 @@
12 <artifactId>enrollStudent</artifactId> 12 <artifactId>enrollStudent</artifactId>
13 13
14 <dependencies> 14 <dependencies>
  15 +<!-- <dependency>-->
  16 +<!-- <groupId>org.springframework.boot</groupId>-->
  17 +<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
  18 +<!-- <version>2.2.1.RELEASE</version>-->
  19 +<!-- </dependency>-->
  20 +<!-- <dependency>-->
  21 +<!-- <groupId>org.apache.commons</groupId>-->
  22 +<!-- <artifactId>commons-pool2</artifactId>-->
  23 +<!-- <version>2.4.2</version>-->
  24 +<!-- </dependency>-->
  25 + <dependency>
  26 + <groupId>org.springframework.boot</groupId>
  27 + <artifactId>spring-boot-starter-web</artifactId>
  28 + </dependency>
  29 + <dependency>
  30 + <groupId>org.springframework.boot</groupId>
  31 + <artifactId>spring-boot-starter-test</artifactId>
  32 + <scope>test</scope>
  33 + </dependency>
  34 +
  35 +
15 <dependency> 36 <dependency>
16 <groupId>org.mybatis.generator</groupId> 37 <groupId>org.mybatis.generator</groupId>
17 <artifactId>mybatis-generator-core</artifactId> 38 <artifactId>mybatis-generator-core</artifactId>
@@ -47,11 +68,7 @@ @@ -47,11 +68,7 @@
47 <artifactId>nimbus-jose-jwt</artifactId> 68 <artifactId>nimbus-jose-jwt</artifactId>
48 <version>6.0</version> 69 <version>6.0</version>
49 </dependency> 70 </dependency>
50 - <dependency>  
51 - <groupId>org.springframework.boot</groupId>  
52 - <artifactId>spring-boot-starter-test</artifactId>  
53 - <scope>test</scope>  
54 - </dependency> 71 +
55 <dependency> 72 <dependency>
56 <groupId>org.apache.commons</groupId> 73 <groupId>org.apache.commons</groupId>
57 <artifactId>commons-lang3</artifactId> 74 <artifactId>commons-lang3</artifactId>
@@ -67,10 +84,7 @@ @@ -67,10 +84,7 @@
67 <artifactId>mssql-jdbc</artifactId> 84 <artifactId>mssql-jdbc</artifactId>
68 <version>6.4.0.jre8</version> 85 <version>6.4.0.jre8</version>
69 </dependency> 86 </dependency>
70 - <dependency>  
71 - <groupId>org.springframework.boot</groupId>  
72 - <artifactId>spring-boot-starter-web</artifactId>  
73 - </dependency> 87 +
74 <dependency> 88 <dependency>
75 <groupId>org.apache.commons</groupId> 89 <groupId>org.apache.commons</groupId>
76 <artifactId>commons-lang3</artifactId> 90 <artifactId>commons-lang3</artifactId>
src/main/java/com/sincere/student/controller/AdminController.java
@@ -14,6 +14,8 @@ import com.sincere.student.utils.TokenUtils; @@ -14,6 +14,8 @@ import com.sincere.student.utils.TokenUtils;
14 import io.swagger.annotations.ApiOperation; 14 import io.swagger.annotations.ApiOperation;
15 import org.apache.commons.lang3.StringUtils; 15 import org.apache.commons.lang3.StringUtils;
16 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.cache.annotation.CacheEvict;
  18 +import org.springframework.cache.annotation.Cacheable;
17 import org.springframework.web.bind.annotation.*; 19 import org.springframework.web.bind.annotation.*;
18 20
19 import java.util.ArrayList; 21 import java.util.ArrayList;
@@ -544,6 +546,15 @@ public class AdminController { @@ -544,6 +546,15 @@ public class AdminController {
544 } 546 }
545 547
546 @MemberAccess 548 @MemberAccess
  549 + @ApiOperation("获取详情 栏目")
  550 + @RequestMapping(value = "/column/getDetail" , method = RequestMethod.POST)
  551 + public BaseDto createColumn(@RequestBody IdDto idDto){
  552 + BaseDto result = new BaseDto() ;
  553 + ColumnType c = columnService.selectDetail(idDto.getId());
  554 + return result ;
  555 + }
  556 +
  557 + @MemberAccess
547 @ApiOperation("更新栏目(type : 1 文章 2学校 3视频)") 558 @ApiOperation("更新栏目(type : 1 文章 2学校 3视频)")
548 @RequestMapping(value = "/column/update" , method = RequestMethod.POST) 559 @RequestMapping(value = "/column/update" , method = RequestMethod.POST)
549 public BaseDto updateColumn(@RequestBody ColumnType columnType){ 560 public BaseDto updateColumn(@RequestBody ColumnType columnType){
@@ -586,7 +597,7 @@ public class AdminController { @@ -586,7 +597,7 @@ public class AdminController {
586 } 597 }
587 }else if(columnType.getType() == ColumnEnums.video.getType()){ 598 }else if(columnType.getType() == ColumnEnums.video.getType()){
588 VideoSearchDto videoSearchDto = new VideoSearchDto(); 599 VideoSearchDto videoSearchDto = new VideoSearchDto();
589 - videoSearchDto.setColumnTypeId(columnType.getId()); 600 + videoSearchDto.setColumnType(columnType.getId());
590 videoSearchDto.setPage(1); 601 videoSearchDto.setPage(1);
591 videoSearchDto.setPageSize(10); 602 videoSearchDto.setPageSize(10);
592 Page<Video> videoPage = videoService.getList(videoSearchDto); 603 Page<Video> videoPage = videoService.getList(videoSearchDto);
src/main/java/com/sincere/student/controller/AppController.java
@@ -159,10 +159,10 @@ public class AppController { @@ -159,10 +159,10 @@ public class AppController {
159 } 159 }
160 160
161 @ApiOperation("获取招生咨询会详情相关接口") 161 @ApiOperation("获取招生咨询会详情相关接口")
162 - @RequestMapping(value = "/consult/getDetail/{id}" , method = RequestMethod.POST)  
163 - public BaseDto<Consult> getConsultDetail(@PathVariable("id") int id){ 162 + @RequestMapping(value = "/consult/getDetail" , method = RequestMethod.POST)
  163 + public BaseDto<Consult> getConsultDetail(@RequestBody IdDto id){
164 BaseDto<Consult> result = new BaseDto<>() ; 164 BaseDto<Consult> result = new BaseDto<>() ;
165 - result.setData(consultService.getDetail(id)); 165 + result.setData(consultService.getDetail(id.getId()));
166 return result ; 166 return result ;
167 } 167 }
168 168
@@ -170,9 +170,10 @@ public class AppController { @@ -170,9 +170,10 @@ public class AppController {
170 * 栏目相关接口 170 * 栏目相关接口
171 */ 171 */
172 @ApiOperation("获取栏目列表(1 文章 2学校 3视频)") 172 @ApiOperation("获取栏目列表(1 文章 2学校 3视频)")
173 - @RequestMapping(value = "/column/getList/{type}" , method = RequestMethod.POST)  
174 - public BaseDto<List<ColumnType>> getColumnList(@PathVariable("type") int type){ 173 + @RequestMapping(value = "/column/getList" , method = RequestMethod.POST)
  174 + public BaseDto<List<ColumnType>> getColumnList(@RequestBody IdDto idDto){
175 BaseDto<List<ColumnType>> result = new BaseDto<>(); 175 BaseDto<List<ColumnType>> result = new BaseDto<>();
  176 + int type = idDto.getId();
176 ColumnEnums columnEnums = ColumnEnums.getByType(type); 177 ColumnEnums columnEnums = ColumnEnums.getByType(type);
177 if(columnEnums != null){ 178 if(columnEnums != null){
178 ColumnDto columnDto = new ColumnDto() ; 179 ColumnDto columnDto = new ColumnDto() ;
@@ -199,36 +200,36 @@ public class AppController { @@ -199,36 +200,36 @@ public class AppController {
199 return result ; 200 return result ;
200 } 201 }
201 202
202 - @ApiOperation("获取权威解读(文章广告)相关接口")  
203 - @RequestMapping(value = "/article/getDetail/{id}" , method = RequestMethod.POST)  
204 - public BaseDto<Article> getDetail(@PathVariable("id") int id){ 203 + @ApiOperation("获取权威解读(文章广告)详情相关接口")
  204 + @RequestMapping(value = "/article/getDetail" , method = RequestMethod.POST)
  205 + public BaseDto<Article> getDetail(@RequestBody IdDto idDto){
205 BaseDto<Article> result = new BaseDto<>() ; 206 BaseDto<Article> result = new BaseDto<>() ;
206 - Article article = articleService.selectById(id) ; 207 + Article article = articleService.selectById(idDto.getId()) ;
207 result.setData(article); 208 result.setData(article);
208 Article temp = new Article(); 209 Article temp = new Article();
209 - temp.setId(id); 210 + temp.setId(idDto.getId());
210 temp.setLookNumber(article.getLookNumber()+1); 211 temp.setLookNumber(article.getLookNumber()+1);
211 articleService.update(temp); 212 articleService.update(temp);
212 return result ; 213 return result ;
213 } 214 }
214 215
215 @ApiOperation(" 点赞 权威解读(文章广告)相关接口") 216 @ApiOperation(" 点赞 权威解读(文章广告)相关接口")
216 - @RequestMapping(value = "/article/good/{id}" , method = RequestMethod.POST)  
217 - public BaseDto good(@PathVariable("id") int id){ 217 + @RequestMapping(value = "/article/good" , method = RequestMethod.POST)
  218 + public BaseDto good(@RequestBody IdDto idDto){
218 BaseDto result = new BaseDto<>() ; 219 BaseDto result = new BaseDto<>() ;
219 - Article article = articleService.selectById(id) ; 220 + Article article = articleService.selectById(idDto.getId()) ;
220 Article temp = new Article(); 221 Article temp = new Article();
221 - temp.setId(id); 222 + temp.setId(idDto.getId());
222 temp.setGoodNumber(article.getGoodNumber()+1); 223 temp.setGoodNumber(article.getGoodNumber()+1);
223 articleService.update(temp); 224 articleService.update(temp);
224 return result ; 225 return result ;
225 } 226 }
226 227
227 - @ApiOperation("获取权威解读(文章广告) 相关咨询 相关接口")  
228 - @RequestMapping(value = "/article/getRelation/{universityId}" , method = RequestMethod.POST)  
229 - public BaseDto<List<Article>> getRelation(@PathVariable("universityId") int universityId){ 228 + @ApiOperation("获取权威解读(文章广告) 相关咨询 相关接口 传学校id")
  229 + @RequestMapping(value = "/article/getRelation" , method = RequestMethod.POST)
  230 + public BaseDto<List<Article>> getRelation(@RequestBody IdDto idDto){
230 BaseDto<List<Article>> result = new BaseDto<>() ; 231 BaseDto<List<Article>> result = new BaseDto<>() ;
231 - result.setData(articleService.getRelationList(universityId)); 232 + result.setData(articleService.getRelationList(idDto.getId()));
232 return result ; 233 return result ;
233 } 234 }
234 235
@@ -255,10 +256,10 @@ public class AppController { @@ -255,10 +256,10 @@ public class AppController {
255 } 256 }
256 257
257 @ApiOperation("留言板详情,管理回复 接口") 258 @ApiOperation("留言板详情,管理回复 接口")
258 - @RequestMapping(value = "/message/getDetail/{id}" , method = RequestMethod.POST)  
259 - public BaseDto<Message> getMessageDetail(@PathVariable("id") int id){ 259 + @RequestMapping(value = "/message/getDetail" , method = RequestMethod.POST)
  260 + public BaseDto<Message> getMessageDetail(@RequestBody IdDto idDto){
260 BaseDto<Message> result = new BaseDto<>(); 261 BaseDto<Message> result = new BaseDto<>();
261 - result.setData(messageService.getDetail(id)); 262 + result.setData(messageService.getDetail(idDto.getId()));
262 return result ; 263 return result ;
263 } 264 }
264 265
@@ -275,16 +276,18 @@ public class AppController { @@ -275,16 +276,18 @@ public class AppController {
275 public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ 276 public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){
276 BaseDto<Page<Video>> result = new BaseDto<>() ; 277 BaseDto<Page<Video>> result = new BaseDto<>() ;
277 videoSearchDto.setStatus(1); 278 videoSearchDto.setStatus(1);
278 - Page<Video> page = videoService.getList(videoSearchDto); 279 + Page<Video> page = videoService.getUniversityList(videoSearchDto);
279 result.setData(page); 280 result.setData(page);
280 return result ; 281 return result ;
281 } 282 }
282 283
283 @ApiOperation("获取视频相关接口") 284 @ApiOperation("获取视频相关接口")
284 - @RequestMapping(value = "/video/getDetail/{id}" , method = RequestMethod.POST)  
285 - public BaseDto<Video> getVideoDetail(@PathVariable ("id") int id){  
286 - BaseDto<Video> result = new BaseDto<>() ;  
287 - result.setData(videoService.getDetail(id)); 285 + @RequestMapping(value = "/video/getDetail" , method = RequestMethod.POST)
  286 + public BaseDto<Page<Video>> getVideoDetail(@RequestBody VideoSearchDto videoSearchDto){
  287 + BaseDto<Page<Video>> result = new BaseDto<>() ;
  288 + videoSearchDto.setStatus(1);
  289 + Page<Video> page = videoService.getList(videoSearchDto);
  290 + result.setData(page);
288 return result ; 291 return result ;
289 } 292 }
290 293
src/main/java/com/sincere/student/dto/VideoSearchDto.java
@@ -7,13 +7,23 @@ import io.swagger.annotations.ApiModelProperty; @@ -7,13 +7,23 @@ import io.swagger.annotations.ApiModelProperty;
7 public class VideoSearchDto extends PageDto { 7 public class VideoSearchDto extends PageDto {
8 8
9 @ApiModelProperty(value = "视频栏目主键") 9 @ApiModelProperty(value = "视频栏目主键")
10 - private int columnTypeId ; 10 + private int columnType ;
11 11
12 @ApiModelProperty(value = "查询名称") 12 @ApiModelProperty(value = "查询名称")
13 private String universityName ; 13 private String universityName ;
  14 + @ApiModelProperty(value = "学校主键")
  15 + private int universityId ;
14 @ApiModelProperty(value = "状态 0预览1发布 都不用传") 16 @ApiModelProperty(value = "状态 0预览1发布 都不用传")
15 private int status ; 17 private int status ;
16 18
  19 + public int getUniversityId() {
  20 + return universityId;
  21 + }
  22 +
  23 + public void setUniversityId(int universityId) {
  24 + this.universityId = universityId;
  25 + }
  26 +
17 public int getStatus() { 27 public int getStatus() {
18 return status; 28 return status;
19 } 29 }
@@ -21,12 +31,13 @@ public class VideoSearchDto extends PageDto { @@ -21,12 +31,13 @@ public class VideoSearchDto extends PageDto {
21 public void setStatus(int status) { 31 public void setStatus(int status) {
22 this.status = status; 32 this.status = status;
23 } 33 }
24 - public int getColumnTypeId() {  
25 - return columnTypeId; 34 +
  35 + public int getColumnType() {
  36 + return columnType;
26 } 37 }
27 38
28 - public void setColumnTypeId(int columnTypeId) {  
29 - this.columnTypeId = columnTypeId; 39 + public void setColumnType(int columnType) {
  40 + this.columnType = columnType;
30 } 41 }
31 42
32 public String getUniversityName() { 43 public String getUniversityName() {
src/main/java/com/sincere/student/mapper/VideoMapper.java
@@ -11,6 +11,10 @@ public interface VideoMapper { @@ -11,6 +11,10 @@ public interface VideoMapper {
11 11
12 List<Video> getList(VideoSearchDto dto); 12 List<Video> getList(VideoSearchDto dto);
13 13
  14 + int getUniversityListCount(VideoSearchDto dto);
  15 +
  16 + List<Video> getUniversityList(VideoSearchDto dto);
  17 +
14 int create(Video video); 18 int create(Video video);
15 19
16 int update(Video video); 20 int update(Video video);
src/main/java/com/sincere/student/model/Advert.java
@@ -3,11 +3,13 @@ package com.sincere.student.model; @@ -3,11 +3,13 @@ package com.sincere.student.model;
3 import io.swagger.annotations.ApiModel; 3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
5 5
  6 +import java.io.Serializable;
6 import java.util.Date; 7 import java.util.Date;
7 8
8 @ApiModel 9 @ApiModel
9 -public class Advert { 10 +public class Advert implements Serializable {
10 11
  12 + private static final long serialVersionUID = 765348013299664647L;
11 @ApiModelProperty(value = "主键 , 新增接口不用传") 13 @ApiModelProperty(value = "主键 , 新增接口不用传")
12 private int id ; 14 private int id ;
13 @ApiModelProperty(value = "广告类型 1:开屏 2:banner 所有接口不用传") 15 @ApiModelProperty(value = "广告类型 1:开屏 2:banner 所有接口不用传")
@@ -88,4 +90,18 @@ public class Advert { @@ -88,4 +90,18 @@ public class Advert {
88 public void setTitle(String title) { 90 public void setTitle(String title) {
89 this.title = title; 91 this.title = title;
90 } 92 }
  93 +
  94 + @Override
  95 + public String toString() {
  96 + return "Advert{" +
  97 + "id=" + id +
  98 + ", type=" + type +
  99 + ", imgUrl='" + imgUrl + '\'' +
  100 + ", urlLink='" + urlLink + '\'' +
  101 + ", sort=" + sort +
  102 + ", status=" + status +
  103 + ", createTime=" + createTime +
  104 + ", title='" + title + '\'' +
  105 + '}';
  106 + }
91 } 107 }
src/main/java/com/sincere/student/model/ColumnType.java
@@ -3,10 +3,11 @@ package com.sincere.student.model; @@ -3,10 +3,11 @@ package com.sincere.student.model;
3 import io.swagger.annotations.ApiModel; 3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
5 5
  6 +import java.io.Serializable;
6 import java.util.Date; 7 import java.util.Date;
7 8
8 @ApiModel 9 @ApiModel
9 -public class ColumnType { 10 +public class ColumnType implements Serializable {
10 11
11 @ApiModelProperty(value = "主键 , 新增接口不用传") 12 @ApiModelProperty(value = "主键 , 新增接口不用传")
12 private int id ; 13 private int id ;
src/main/java/com/sincere/student/model/Consult.java
@@ -29,9 +29,19 @@ public class Consult { @@ -29,9 +29,19 @@ public class Consult {
29 private String context; 29 private String context;
30 @ApiModelProperty(value = "联系方式") 30 @ApiModelProperty(value = "联系方式")
31 private String phone; 31 private String phone;
  32 + @ApiModelProperty(value = "状态")
  33 + private Integer status;
32 @ApiModelProperty(value = "4个栏目") 34 @ApiModelProperty(value = "4个栏目")
33 private List<UniversityConsultDetail> list ; 35 private List<UniversityConsultDetail> list ;
34 36
  37 + public Integer getStatus() {
  38 + return status;
  39 + }
  40 +
  41 + public void setStatus(Integer status) {
  42 + this.status = status;
  43 + }
  44 +
35 public int getId() { 45 public int getId() {
36 return id; 46 return id;
37 } 47 }
src/main/java/com/sincere/student/model/University.java
@@ -27,11 +27,21 @@ public class University { @@ -27,11 +27,21 @@ public class University {
27 private String level ; 27 private String level ;
28 @ApiModelProperty(value = "联系方式") 28 @ApiModelProperty(value = "联系方式")
29 private String phone ; 29 private String phone ;
  30 + @ApiModelProperty(value = "logo")
  31 + private String logoUrl ;
30 @ApiModelProperty(value = "创建时间") 32 @ApiModelProperty(value = "创建时间")
31 private Date createTime ; 33 private Date createTime ;
32 @ApiModelProperty(value = "专业列表,展示用") 34 @ApiModelProperty(value = "专业列表,展示用")
33 private List<String> majorList ; 35 private List<String> majorList ;
34 36
  37 + public String getLogoUrl() {
  38 + return logoUrl;
  39 + }
  40 +
  41 + public void setLogoUrl(String logoUrl) {
  42 + this.logoUrl = logoUrl;
  43 + }
  44 +
35 public String getPhone() { 45 public String getPhone() {
36 return phone; 46 return phone;
37 } 47 }
src/main/java/com/sincere/student/model/Video.java
@@ -21,11 +21,21 @@ public class Video { @@ -21,11 +21,21 @@ public class Video {
21 @ApiModelProperty(value = "创建时间") 21 @ApiModelProperty(value = "创建时间")
22 private Date createTime ; 22 private Date createTime ;
23 @ApiModelProperty(value = "学校名称 展示用") 23 @ApiModelProperty(value = "学校名称 展示用")
24 - private String universityName; 24 + private String name;
25 @ApiModelProperty(value = "学校编码 展示用") 25 @ApiModelProperty(value = "学校编码 展示用")
26 - private String universityCode; 26 + private String code;
27 @ApiModelProperty(value = "状态 0预览1发布") 27 @ApiModelProperty(value = "状态 0预览1发布")
28 private int status ; 28 private int status ;
  29 + @ApiModelProperty(value = "图片地址")
  30 + private int imgUrl ;
  31 +
  32 + public int getImgUrl() {
  33 + return imgUrl;
  34 + }
  35 +
  36 + public void setImgUrl(int imgUrl) {
  37 + this.imgUrl = imgUrl;
  38 + }
29 39
30 public int getStatus() { 40 public int getStatus() {
31 return status; 41 return status;
@@ -35,20 +45,20 @@ public class Video { @@ -35,20 +45,20 @@ public class Video {
35 this.status = status; 45 this.status = status;
36 } 46 }
37 47
38 - public String getUniversityCode() {  
39 - return universityCode; 48 + public String getName() {
  49 + return name;
40 } 50 }
41 51
42 - public void setUniversityCode(String universityCode) {  
43 - this.universityCode = universityCode; 52 + public void setName(String name) {
  53 + this.name = name;
44 } 54 }
45 55
46 - public String getUniversityName() {  
47 - return universityName; 56 + public String getCode() {
  57 + return code;
48 } 58 }
49 59
50 - public void setUniversityName(String universityName) {  
51 - this.universityName = universityName; 60 + public void setCode(String code) {
  61 + this.code = code;
52 } 62 }
53 63
54 public int getId() { 64 public int getId() {
src/main/java/com/sincere/student/service/AdvertService.java
@@ -12,7 +12,7 @@ public interface AdvertService { @@ -12,7 +12,7 @@ public interface AdvertService {
12 12
13 Advert getDetail(int id); 13 Advert getDetail(int id);
14 14
15 - int create(Advert advert); 15 + Integer create(Advert advert);
16 16
17 int delete(int id); 17 int delete(int id);
18 18
src/main/java/com/sincere/student/service/VideoService.java
@@ -4,8 +4,12 @@ import com.sincere.student.dto.VideoSearchDto; @@ -4,8 +4,12 @@ import com.sincere.student.dto.VideoSearchDto;
4 import com.sincere.student.model.Video; 4 import com.sincere.student.model.Video;
5 import com.sincere.student.utils.Page; 5 import com.sincere.student.utils.Page;
6 6
  7 +import java.util.List;
  8 +
7 public interface VideoService { 9 public interface VideoService {
8 10
  11 + Page<Video> getUniversityList(VideoSearchDto dto);
  12 +
9 Page<Video> getList(VideoSearchDto dto); 13 Page<Video> getList(VideoSearchDto dto);
10 14
11 Video getDetail(int id); 15 Video getDetail(int id);
src/main/java/com/sincere/student/service/impl/AdvertServiceImpl.java
@@ -5,6 +5,8 @@ import com.sincere.student.mapper.AdvertMapper; @@ -5,6 +5,8 @@ import com.sincere.student.mapper.AdvertMapper;
5 import com.sincere.student.model.Advert; 5 import com.sincere.student.model.Advert;
6 import com.sincere.student.service.AdvertService; 6 import com.sincere.student.service.AdvertService;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.cache.annotation.CacheEvict;
  9 +import org.springframework.cache.annotation.Cacheable;
8 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
9 11
10 import java.util.List; 12 import java.util.List;
@@ -36,7 +38,7 @@ public class AdvertServiceImpl implements AdvertService { @@ -36,7 +38,7 @@ public class AdvertServiceImpl implements AdvertService {
36 } 38 }
37 39
38 @Override 40 @Override
39 - public int create(Advert advert) { 41 + public Integer create(Advert advert) {
40 return advertMapper.create(advert); 42 return advertMapper.create(advert);
41 } 43 }
42 44
src/main/java/com/sincere/student/service/impl/VideoServiceImpl.java
@@ -18,6 +18,18 @@ public class VideoServiceImpl implements VideoService { @@ -18,6 +18,18 @@ public class VideoServiceImpl implements VideoService {
18 VideoMapper videoMapper ; 18 VideoMapper videoMapper ;
19 19
20 @Override 20 @Override
  21 + public Page<Video> getUniversityList(VideoSearchDto dto) {
  22 + Page<Video> page = new Page<>(dto.getPage(),dto.getPageSize());
  23 + if(StringUtils.isNotBlank(dto.getUniversityName())){
  24 + dto.setUniversityName("%"+dto.getUniversityName()+"%");
  25 + }
  26 + PageHelper.startPage(dto.getPage(),dto.getPageSize());
  27 + page.setList(videoMapper.getUniversityList(dto));
  28 + page.setCount(videoMapper.getUniversityListCount(dto));
  29 + return page;
  30 + }
  31 +
  32 + @Override
21 public Page<Video> getList(VideoSearchDto dto) { 33 public Page<Video> getList(VideoSearchDto dto) {
22 Page<Video> page = new Page<>(dto.getPage(),dto.getPageSize()); 34 Page<Video> page = new Page<>(dto.getPage(),dto.getPageSize());
23 if(StringUtils.isNotBlank(dto.getUniversityName())){ 35 if(StringUtils.isNotBlank(dto.getUniversityName())){
src/main/java/com/sincere/student/utils/RedisConfig.java 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +//package com.sincere.student.utils;
  2 +//
  3 +//import org.springframework.context.annotation.Bean;
  4 +//import org.springframework.context.annotation.Configuration;
  5 +//import org.springframework.data.redis.connection.RedisConnectionFactory;
  6 +//import org.springframework.data.redis.core.RedisTemplate;
  7 +//import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
  8 +//import org.springframework.data.redis.serializer.RedisSerializer;
  9 +//import org.springframework.data.redis.serializer.StringRedisSerializer;
  10 +//
  11 +//@Configuration
  12 +//public class RedisConfig {
  13 +//
  14 +// @Bean(name = "redisTemplate")
  15 +// public RedisTemplate<String,Object> redisTemplate(RedisConnectionFactory redisConnectionFactory){
  16 +//
  17 +// RedisTemplate<String,Object> redisTemplate = new RedisTemplate<>();
  18 +// //参照StringRedisTemplate内部实现指定序列化器
  19 +// redisTemplate.setConnectionFactory(redisConnectionFactory);
  20 +// redisTemplate.setKeySerializer(keySerializer());
  21 +// redisTemplate.setHashKeySerializer(keySerializer());
  22 +// redisTemplate.setValueSerializer(valueSerializer());
  23 +// redisTemplate.setHashValueSerializer(valueSerializer());
  24 +//
  25 +// return redisTemplate;
  26 +// }
  27 +//
  28 +// private RedisSerializer<String> keySerializer() {
  29 +// return new StringRedisSerializer();
  30 +// }
  31 +//
  32 +// //使用Jackson序列化器
  33 +// private RedisSerializer<Object> valueSerializer() {
  34 +// return new GenericJackson2JsonRedisSerializer();
  35 +// }
  36 +//}
src/main/resources/application.yaml
@@ -9,23 +9,21 @@ spring: @@ -9,23 +9,21 @@ spring:
9 password: xst200919 9 password: xst200919
10 url: jdbc:sqlserver://60.190.202.57:14333;database=consultative 10 url: jdbc:sqlserver://60.190.202.57:14333;database=consultative
11 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 11 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
12 - thymeleaf: #thymelea模板配置  
13 - prefix: classpath:/templates/  
14 - suffix: .html  
15 - mode: HTML5  
16 - encoding: UTF-8  
17 - cache: false  
18 - resources:  
19 - chain:  
20 - strategy:  
21 - content:  
22 - enabled: true  
23 - paths: /** 12 +# cache:
  13 +# type: redis
  14 +# redis:
  15 +# host: 127.0.0.1
  16 +# port: 6379
  17 +# password:
  18 +# lettuce:
  19 +# pool:
  20 +# max-active: 8
  21 +# database: 0
24 ##mybatis 22 ##mybatis
25 mybatis: 23 mybatis:
26 mapper-locations: classpath:mapper/*.xml 24 mapper-locations: classpath:mapper/*.xml
27 type-aliases-package: com.sincere.student.model 25 type-aliases-package: com.sincere.student.model
28 26
29 -Logger: 27 +logging:
30 level: 28 level:
31 - com.sincere.student.mapper: info  
32 \ No newline at end of file 29 \ No newline at end of file
  30 + com.sincere.student.mapper: debug
33 \ No newline at end of file 31 \ No newline at end of file
src/main/resources/logback.xml 0 → 100644
@@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<configuration debug="true">
  3 +     <!-- 项目名称 -->
  4 +    
  5 + <property name="PROJECT_NAME" value="quartz"/>
  6 +
  7 +     <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
  8 + <property name="LOG_HOME" value="C://log"/>
  9 +
  10 +     <!-- 控制台输出 -->
  11 +    
  12 + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
  13 +         <!--<withJansi>true</withJansi>-->
  14 +        
  15 + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  16 +             <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  17 +            
  18 + <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %highlight([%-5level] %logger{50} - %msg%n)</pattern>
  19 +            
  20 + <charset>UTF-8</charset>
  21 +        
  22 + </encoder>
  23 +    
  24 + </appender>
  25 +
  26 +     <!-- 按照每天生成日志文件 -->
  27 +    
  28 + <appender name="SYSTEM_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  29 +         <!-- 过滤器,只打印ERROR级别的日志 -->
  30 +        
  31 + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  32 +             <!--日志文件输出的文件名-->
  33 +            
  34 + <FileNamePattern>${LOG_HOME}/${PROJECT_NAME}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
  35 +             <!--日志文件保留天数-->
  36 +            
  37 + <MaxHistory>30</MaxHistory>
  38 +             <!--日志文件最大的大小-->
  39 +            
  40 + <MaxFileSize>100MB</MaxFileSize>
  41 +        
  42 + </rollingPolicy>
  43 +
  44 +        
  45 + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  46 +             <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  47 +            
  48 + <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n</pattern>
  49 +            
  50 + <charset>UTF-8</charset>
  51 +        
  52 + </encoder>
  53 +    
  54 + </appender>
  55 +    
  56 + <logger name="system_error" additivity="true">
  57 +        
  58 + <appender-ref ref="SYSTEM_FILE"/>
  59 +    
  60 + </logger>
  61 +
  62 +     <!-- 设置Spring&Hibernate日志输出级别 -->
  63 +    
  64 + <logger name="org.springframework" level="WARN"/>
  65 +    
  66 + <logger name="org.mybatis" level="WARN"/>
  67 +    
  68 + <logger name="com.ibatis" level="DEBUG"/>
  69 +    
  70 + <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG"/>
  71 +    
  72 + <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG"/>
  73 +    
  74 + <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG"/>
  75 +
  76 +
  77 +    
  78 + <logger name="java.sql.Connection" level="DEBUG"/>
  79 +    
  80 + <logger name="java.sql.Statement" level="DEBUG"/>
  81 +    
  82 + <logger name="java.sql.PreparedStatement" level="DEBUG"/>
  83 +    
  84 + <logger name="com.sincere.smartSearch.mapper" level="DEBUG"/>
  85 +     <!-- 开发环境下的日志配置 -->
  86 +    
  87 + <root level="INFO">
  88 +        
  89 + <appender-ref ref="CONSOLE"/>
  90 +        
  91 + <appender-ref ref="SYSTEM_FILE"/>
  92 +    
  93 + </root>
  94 +
  95 +</configuration>
src/main/resources/mapper/UniversityConsultMapper.xml
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 </select> 46 </select>
47 47
48 <select id="getList" parameterType="com.sincere.student.dto.ConsultSearchDto" resultMap="ListMap"> 48 <select id="getList" parameterType="com.sincere.student.dto.ConsultSearchDto" resultMap="ListMap">
49 - select DISTINCT c.id , info.id as universityId , c.img_url ,c.sort , info.name , info.code from university_consult c 49 + select DISTINCT c.id , info.id as universityId , c.img_url ,c.sort , info.name , info.code ,c.status from university_consult c
50 join university_info info on c.university_id = info.id 50 join university_info info on c.university_id = info.id
51 join university_relate_major r on info.id = r.university_id 51 join university_relate_major r on info.id = r.university_id
52 join university_major m on m.id = r.major_id 52 join university_major m on m.id = r.major_id
src/main/resources/mapper/UniversityMapper.xml
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 <result column="level" property="level"/> 13 <result column="level" property="level"/>
14 <result column="create_time" property="createTime"/> 14 <result column="create_time" property="createTime"/>
15 <result column="phone" property="phone"/> 15 <result column="phone" property="phone"/>
  16 + <result column="logo_url" property="logoUrl"/>
16 </resultMap> 17 </resultMap>
17 18
18 <select id="getListCount" parameterType="com.sincere.student.dto.UniversitySearchDto" resultType="java.lang.Integer"> 19 <select id="getListCount" parameterType="com.sincere.student.dto.UniversitySearchDto" resultType="java.lang.Integer">
@@ -34,8 +35,8 @@ @@ -34,8 +35,8 @@
34 </select> 35 </select>
35 36
36 <insert id="create" parameterType="com.sincere.student.model.University" > 37 <insert id="create" parameterType="com.sincere.student.model.University" >
37 - insert into university_info (name,code,university_type,department,province,city,level,create_time,phone)  
38 - values (#{name},#{code},#{universityType},#{department},#{province},#{city},#{level},GETDATE(),#{phone}) 38 + insert into university_info (name,code,university_type,department,province,city,level,create_time,phone,logo_url)
  39 + values (#{name},#{code},#{universityType},#{department},#{province},#{city},#{level},GETDATE(),#{phone},#{logoUrl})
39 </insert> 40 </insert>
40 41
41 <delete id="delete" parameterType="java.lang.Integer"> 42 <delete id="delete" parameterType="java.lang.Integer">
@@ -69,6 +70,9 @@ @@ -69,6 +70,9 @@
69 <if test="phone!=null"> 70 <if test="phone!=null">
70 phone=#{phone}, 71 phone=#{phone},
71 </if> 72 </if>
  73 + <if test="logoUrl!=null">
  74 + logo_url=#{logoUrl},
  75 + </if>
72 </trim> 76 </trim>
73 where id = #{id} 77 where id = #{id}
74 </update> 78 </update>
src/main/resources/mapper/VideoMapper.xml
@@ -9,27 +9,71 @@ @@ -9,27 +9,71 @@
9 <result column="video_url" property="videoUrl"/> 9 <result column="video_url" property="videoUrl"/>
10 <result column="sort" property="sort"/> 10 <result column="sort" property="sort"/>
11 <result column="create_time" property="createTime"/> 11 <result column="create_time" property="createTime"/>
12 - <result column="name" property="universityName"/>  
13 - <result column="code" property="universityCode"/> 12 + <result column="name" property="name"/>
  13 + <result column="code" property="code"/>
14 <result column="status" property="status" /> 14 <result column="status" property="status" />
  15 + <result column="logo_url" property="imgUrl" />
15 </resultMap> 16 </resultMap>
16 17
17 <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> 18 <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap">
18 select * from university_video where id = #{id} 19 select * from university_video where id = #{id}
19 </select> 20 </select>
20 21
  22 +
  23 + <select id="getUniversityListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer">
  24 + select count( distinct (v.university_id)) from university_video v join university_info info on v.university_id = info.id
  25 + <where>
  26 + <if test="columnType != 0">
  27 + and v.column_type = #{columnType}
  28 + </if>
  29 + <if test="columnType == 0">
  30 + and 1 = 1
  31 + </if>
  32 + <if test="universityId != 0">
  33 + and info.id = #{universityId}
  34 + </if>
  35 + <if test="status == 1">
  36 + and status = 1
  37 + </if>
  38 + <if test="status != 1">
  39 + and 1 = 1
  40 + </if>
  41 + </where>
  42 + </select>
  43 +
  44 + <select id="getUniversityList" parameterType="com.sincere.student.dto.VideoSearchDto" resultMap="VideoMap">
  45 + 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
  46 + <where>
  47 + <if test="columnType != 0">
  48 + and v.column_type = #{columnType}
  49 + </if>
  50 + <if test="universityId != 0">
  51 + and info.id = #{universityId}
  52 + </if>
  53 + <if test="status == 1">
  54 + and status = 1
  55 + </if>
  56 + <if test="status != 1">
  57 + and 1 = 1
  58 + </if>
  59 + </where>
  60 + </select>
  61 +
21 <select id="getListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer"> 62 <select id="getListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer">
22 select count(0) from university_video v join university_info info on v.university_id = info.id 63 select count(0) from university_video v join university_info info on v.university_id = info.id
23 <where> 64 <where>
24 - <if test="columnTypeId != 0">  
25 - and v.column_type = #{columnTypeId} 65 + <if test="columnType != 0">
  66 + and v.column_type = #{columnType}
26 </if> 67 </if>
27 - <if test="universityName == 0"> 68 + <if test="columnType == 0">
28 and 1 = 1 69 and 1 = 1
29 </if> 70 </if>
30 <if test="universityName != null and universityName != ''"> 71 <if test="universityName != null and universityName != ''">
31 and info.name like #{universityName} 72 and info.name like #{universityName}
32 </if> 73 </if>
  74 + <if test="universityId != 0">
  75 + and info.id = #{universityId}
  76 + </if>
33 <if test="status == 1"> 77 <if test="status == 1">
34 and status = 1 78 and status = 1
35 </if> 79 </if>
@@ -39,11 +83,14 @@ @@ -39,11 +83,14 @@
39 </where> 83 </where>
40 </select> 84 </select>
41 85
42 - <select id="getList" parameterType="com.sincere.student.dto.ArticleSearchDto" resultMap="VideoMap">  
43 - select v.*,info.name,info.code from university_video v join university_info info on v.university_id = info.id 86 + <select id="getList" parameterType="com.sincere.student.dto.VideoSearchDto" resultMap="VideoMap">
  87 + select v.*,info.name,info.code ,info.logo_url from university_video v join university_info info on v.university_id = info.id
44 <where> 88 <where>
45 - <if test="columnTypeId != 0">  
46 - and v.column_type = #{columnTypeId} 89 + <if test="columnType != 0">
  90 + and v.column_type = #{columnType}
  91 + </if>
  92 + <if test="universityId != 0">
  93 + and info.id = #{universityId}
47 </if> 94 </if>
48 <if test="universityName != null and universityName != ''"> 95 <if test="universityName != null and universityName != ''">
49 and info.name like #{universityName} 96 and info.name like #{universityName}