Commit a79c5a75ece6ee0288025d0dd5d27b0be2c3558e
1 parent
2f3069be
Exists in
master
bug 修复
Showing
9 changed files
with
119 additions
and
72 deletions
Show diff stats
src/main/java/com/sincere/student/controller/AdminController.java
... | ... | @@ -229,6 +229,7 @@ public class AdminController { |
229 | 229 | public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ |
230 | 230 | BaseDto<Page<Consult>> result = new BaseDto<>() ; |
231 | 231 | consultSearchDto.setStatus(0); |
232 | + consultSearchDto.setColumnType(-1); | |
232 | 233 | Page<Consult> page = consultService.getList(consultSearchDto); |
233 | 234 | result.setData(page); |
234 | 235 | return result ; |
... | ... | @@ -469,7 +470,12 @@ public class AdminController { |
469 | 470 | @RequestMapping(value = "/article/createArticle" , method = RequestMethod.POST) |
470 | 471 | public BaseDto createArticle(@RequestBody Article article){ |
471 | 472 | BaseDto result = new BaseDto() ; |
472 | - articleService.create(article); | |
473 | + if(StringUtils.isBlank(article.getImageUrl())){ | |
474 | + result.setSuccess(false); | |
475 | + result.setMessage("请上传封面图片"); | |
476 | + }else { | |
477 | + articleService.create(article); | |
478 | + } | |
473 | 479 | return result ; |
474 | 480 | } |
475 | 481 | ... | ... |
src/main/java/com/sincere/student/controller/AppController.java
... | ... | @@ -301,4 +301,27 @@ public class AppController { |
301 | 301 | result.setData(submitService.getAppList(pointSearchDto)); |
302 | 302 | return result ; |
303 | 303 | } |
304 | + | |
305 | + @ApiOperation("投档线首页列表接口") | |
306 | + @RequestMapping(value = "/submit/getSubmitList" , method = RequestMethod.POST) | |
307 | + public BaseDto<Page<SubmitLine>> getSubmitList(@RequestBody PageDto pageDto){ | |
308 | + BaseDto<Page<SubmitLine>> result = new BaseDto<>(); | |
309 | + PointSearchDto pointSearchDto = new PointSearchDto(); | |
310 | + pointSearchDto.setPage(pageDto.getPage()); | |
311 | + pointSearchDto.setPageSize(pageDto.getPageSize()); | |
312 | + result.setData(submitService.getAppList(pointSearchDto)); | |
313 | + return result ; | |
314 | + } | |
315 | + | |
316 | + @ApiOperation("具体某个投档线详情接口") | |
317 | + @RequestMapping(value = "/submit/getDetail" , method = RequestMethod.POST) | |
318 | + public BaseDto<SubmitLine> getSubmitDetail(@RequestBody IdDto idDto){ | |
319 | + BaseDto<SubmitLine> result = new BaseDto<>(); | |
320 | + PointSearchDto pointSearchDto = new PointSearchDto(); | |
321 | + pointSearchDto.setPage(1); | |
322 | + pointSearchDto.setPageSize(1); | |
323 | + pointSearchDto.setSubmitId(idDto.getId()); | |
324 | + result.setData(submitService.getAppList(pointSearchDto).getList().get(0)); | |
325 | + return result ; | |
326 | + } | |
304 | 327 | } | ... | ... |
src/main/java/com/sincere/student/dto/submit/SubmitMajor.java
... | ... | @@ -1,49 +0,0 @@ |
1 | -package com.sincere.student.dto.submit; | |
2 | - | |
3 | -import io.swagger.annotations.ApiModel; | |
4 | -import io.swagger.annotations.ApiModelProperty; | |
5 | - | |
6 | -@ApiModel | |
7 | -public class SubmitMajor { | |
8 | - | |
9 | - @ApiModelProperty(value = "专业") | |
10 | - private String major ; | |
11 | - @ApiModelProperty(value = "分数") | |
12 | - private int grade ; | |
13 | - @ApiModelProperty(value = "招收数量") | |
14 | - private int enrollNumber ; | |
15 | - @ApiModelProperty(value = "位次号") | |
16 | - private int rank ; | |
17 | - | |
18 | - public String getMajor() { | |
19 | - return major; | |
20 | - } | |
21 | - | |
22 | - public void setMajor(String major) { | |
23 | - this.major = major; | |
24 | - } | |
25 | - | |
26 | - public int getGrade() { | |
27 | - return grade; | |
28 | - } | |
29 | - | |
30 | - public void setGrade(int grade) { | |
31 | - this.grade = grade; | |
32 | - } | |
33 | - | |
34 | - public int getEnrollNumber() { | |
35 | - return enrollNumber; | |
36 | - } | |
37 | - | |
38 | - public void setEnrollNumber(int enrollNumber) { | |
39 | - this.enrollNumber = enrollNumber; | |
40 | - } | |
41 | - | |
42 | - public int getRank() { | |
43 | - return rank; | |
44 | - } | |
45 | - | |
46 | - public void setRank(int rank) { | |
47 | - this.rank = rank; | |
48 | - } | |
49 | -} |
src/main/java/com/sincere/student/dto/submit/SubmitUniv.java
... | ... | @@ -12,8 +12,46 @@ public class SubmitUniv { |
12 | 12 | private int universityId ; |
13 | 13 | @ApiModelProperty(value = "学校名称") |
14 | 14 | private String universityName ; |
15 | - @ApiModelProperty(value = "专业列表") | |
16 | - private List<SubmitMajor> majorList ; | |
15 | + @ApiModelProperty(value = "专业") | |
16 | + private String major ; | |
17 | + @ApiModelProperty(value = "分数") | |
18 | + private int grade ; | |
19 | + @ApiModelProperty(value = "招收数量") | |
20 | + private int enrollNumber ; | |
21 | + @ApiModelProperty(value = "位次号") | |
22 | + private int rank ; | |
23 | + | |
24 | + public String getMajor() { | |
25 | + return major; | |
26 | + } | |
27 | + | |
28 | + public void setMajor(String major) { | |
29 | + this.major = major; | |
30 | + } | |
31 | + | |
32 | + public int getGrade() { | |
33 | + return grade; | |
34 | + } | |
35 | + | |
36 | + public void setGrade(int grade) { | |
37 | + this.grade = grade; | |
38 | + } | |
39 | + | |
40 | + public int getEnrollNumber() { | |
41 | + return enrollNumber; | |
42 | + } | |
43 | + | |
44 | + public void setEnrollNumber(int enrollNumber) { | |
45 | + this.enrollNumber = enrollNumber; | |
46 | + } | |
47 | + | |
48 | + public int getRank() { | |
49 | + return rank; | |
50 | + } | |
51 | + | |
52 | + public void setRank(int rank) { | |
53 | + this.rank = rank; | |
54 | + } | |
17 | 55 | |
18 | 56 | public int getUniversityId() { |
19 | 57 | return universityId; |
... | ... | @@ -31,11 +69,4 @@ public class SubmitUniv { |
31 | 69 | this.universityName = universityName; |
32 | 70 | } |
33 | 71 | |
34 | - public List<SubmitMajor> getMajorList() { | |
35 | - return majorList; | |
36 | - } | |
37 | - | |
38 | - public void setMajorList(List<SubmitMajor> majorList) { | |
39 | - this.majorList = majorList; | |
40 | - } | |
41 | 72 | } | ... | ... |
src/main/java/com/sincere/student/model/Article.java
... | ... | @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; |
4 | 4 | import io.swagger.annotations.ApiModelProperty; |
5 | 5 | |
6 | 6 | import java.util.Date; |
7 | +import java.util.List; | |
7 | 8 | |
8 | 9 | @ApiModel |
9 | 10 | public class Article { |
... | ... | @@ -24,6 +25,10 @@ public class Article { |
24 | 25 | private String author ; |
25 | 26 | @ApiModelProperty(value = "封面图片") |
26 | 27 | private String imageUrl ; |
28 | + @ApiModelProperty(value = "封面图片 展示用") | |
29 | + private List<String> imageUrlList ; | |
30 | + @ApiModelProperty(value = "封面图片数量 展示用") | |
31 | + private int imageCount ; | |
27 | 32 | @ApiModelProperty(value = "视频链接") |
28 | 33 | private String videoUrl ; |
29 | 34 | @ApiModelProperty(value = "外链") |
... | ... | @@ -39,6 +44,22 @@ public class Article { |
39 | 44 | @ApiModelProperty(value = "状态 0预览1发布") |
40 | 45 | private int status ; |
41 | 46 | |
47 | + public List<String> getImageUrlList() { | |
48 | + return imageUrlList; | |
49 | + } | |
50 | + | |
51 | + public void setImageUrlList(List<String> imageUrlList) { | |
52 | + this.imageUrlList = imageUrlList; | |
53 | + } | |
54 | + | |
55 | + public int getImageCount() { | |
56 | + return imageCount; | |
57 | + } | |
58 | + | |
59 | + public void setImageCount(int imageCount) { | |
60 | + this.imageCount = imageCount; | |
61 | + } | |
62 | + | |
42 | 63 | public int getStatus() { |
43 | 64 | return status; |
44 | 65 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/ArticleServiceImpl.java
... | ... | @@ -10,6 +10,8 @@ import org.apache.commons.lang3.StringUtils; |
10 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 11 | import org.springframework.stereotype.Service; |
12 | 12 | |
13 | +import java.util.ArrayList; | |
14 | +import java.util.Arrays; | |
13 | 15 | import java.util.List; |
14 | 16 | |
15 | 17 | @Service |
... | ... | @@ -21,11 +23,16 @@ public class ArticleServiceImpl implements ArticleService { |
21 | 23 | @Override |
22 | 24 | public Page<Article> getList(ArticleSearchDto articleSearchDto) { |
23 | 25 | Page<Article> result = new Page<>(articleSearchDto.getPage(),articleSearchDto.getPageSize()); |
24 | - PageHelper.startPage(articleSearchDto.getPage(),articleSearchDto.getPageSize()); | |
25 | 26 | if(StringUtils.isNotBlank(articleSearchDto.getTitle())){ |
26 | 27 | articleSearchDto.setTitle("%"+articleSearchDto.getTitle()+"%"); |
27 | 28 | } |
29 | + PageHelper.startPage(articleSearchDto.getPage(),articleSearchDto.getPageSize()); | |
28 | 30 | List<Article> list = articleMapper.getList(articleSearchDto) ; |
31 | + for(Article article : list){ | |
32 | + String[] urlList = article.getImageUrl().split(","); | |
33 | + article.setImageUrlList(Arrays.asList(urlList)); | |
34 | + article.setImageCount(urlList.length); | |
35 | + } | |
29 | 36 | result.setList(list); |
30 | 37 | result.setCount(articleMapper.getListCount(articleSearchDto)); |
31 | 38 | return result; |
... | ... | @@ -38,7 +45,11 @@ public class ArticleServiceImpl implements ArticleService { |
38 | 45 | |
39 | 46 | @Override |
40 | 47 | public Article selectById(int id) { |
41 | - return articleMapper.selectById(id); | |
48 | + Article article = articleMapper.selectById(id); | |
49 | + String[] urlList = article.getImageUrl().split(","); | |
50 | + article.setImageUrlList(Arrays.asList(urlList)); | |
51 | + article.setImageCount(urlList.length); | |
52 | + return article ; | |
42 | 53 | } |
43 | 54 | |
44 | 55 | @Override | ... | ... |
src/main/resources/logback.xml
src/main/resources/mapper/UniversityConsultMapper.xml
... | ... | @@ -18,12 +18,15 @@ |
18 | 18 | join university_relate_major r on info.id = r.university_id |
19 | 19 | join university_major m on m.id = r.major_id |
20 | 20 | <where> |
21 | - <if test="columnType != 0"> | |
21 | + <if test="columnType > 0"> | |
22 | 22 | and c.column_type = #{columnType} |
23 | 23 | </if> |
24 | 24 | <if test="columnType == 0"> |
25 | 25 | and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort) |
26 | 26 | </if> |
27 | + <if test="columnType == -1"> | |
28 | + and 1=1 | |
29 | + </if> | |
27 | 30 | <if test="province != null and province != '' "> |
28 | 31 | and info.province = #{province} |
29 | 32 | </if> |
... | ... | @@ -51,12 +54,15 @@ |
51 | 54 | join university_relate_major r on info.id = r.university_id |
52 | 55 | join university_major m on m.id = r.major_id |
53 | 56 | <where> |
54 | - <if test="columnType != 0"> | |
57 | + <if test="columnType > 0"> | |
55 | 58 | and c.column_type = #{columnType} |
56 | 59 | </if> |
57 | 60 | <if test="columnType == 0"> |
58 | 61 | and c.column_type = (select top 1 id from university_column_type where type = 2 order by sort) |
59 | 62 | </if> |
63 | + <if test="columnType == -1"> | |
64 | + and 1=1 | |
65 | + </if> | |
60 | 66 | <if test="province != null and province != '' "> |
61 | 67 | and info.province = #{province} |
62 | 68 | </if> |
... | ... | @@ -117,10 +123,10 @@ |
117 | 123 | <insert id="insert" parameterType="com.sincere.student.model.UniversityConsult" useGeneratedKeys="true" keyProperty="id"> |
118 | 124 | insert into university_consult (university_id, column_type, |
119 | 125 | video_url, context, img_url, |
120 | - create_time, sort) | |
126 | + create_time, sort,status) | |
121 | 127 | values (#{universityId,jdbcType=INTEGER}, #{columnType,jdbcType=INTEGER}, |
122 | 128 | #{videoUrl,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, |
123 | - GETDATE(), #{sort,jdbcType=INTEGER}) | |
129 | + GETDATE(), #{sort,jdbcType=INTEGER},#{status}) | |
124 | 130 | </insert> |
125 | 131 | |
126 | 132 | <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.UniversityConsult"> | ... | ... |
src/main/resources/mapper/UniversitySubmitFileMapper.xml
... | ... | @@ -8,12 +8,10 @@ |
8 | 8 | <collection property="universityList" ofType="com.sincere.student.dto.submit.SubmitUniv"> |
9 | 9 | <result column="universityId" property="universityId" /> |
10 | 10 | <result column="name" property="universityName" /> |
11 | - <collection property="majorList" ofType="com.sincere.student.dto.submit.SubmitMajor"> | |
12 | - <result column="major" property="major" /> | |
13 | - <result column="grade" property="grade" /> | |
14 | - <result column="enroll_number" property="enrollNumber" /> | |
15 | - <result column="rank" property="rank" /> | |
16 | - </collection> | |
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" /> | |
17 | 15 | </collection> |
18 | 16 | </resultMap> |
19 | 17 | ... | ... |