Commit cdb1817bd3ce631c83390f7563fcae64c957ce2c
1 parent
54d6c33f
Exists in
master
bug 修复
Showing
8 changed files
with
36 additions
and
5 deletions
Show diff stats
src/main/java/com/sincere/student/mapper/UniversityConsultMapper.java
... | ... | @@ -22,6 +22,8 @@ public interface UniversityConsultMapper { |
22 | 22 | |
23 | 23 | Consult selectByPrimaryKey(Integer id); |
24 | 24 | |
25 | + int updateRead(int id); | |
26 | + | |
25 | 27 | int updateByPrimaryKeySelective(UniversityConsult record); |
26 | 28 | |
27 | 29 | List<Consult> selectByUniversityIdAndColumnType(UniversityConsult consult); | ... | ... |
src/main/java/com/sincere/student/mapper/VideoMapper.java
src/main/java/com/sincere/student/model/Consult.java
... | ... | @@ -25,6 +25,8 @@ public class Consult { |
25 | 25 | private Integer columnType; |
26 | 26 | @ApiModelProperty(value = "栏目分类名称") |
27 | 27 | private String columnTypeName; |
28 | + @ApiModelProperty(value = "栏目分类名称") | |
29 | + private String columnTypeString; | |
28 | 30 | @ApiModelProperty(value = "视频地址") |
29 | 31 | private String videoUrl; |
30 | 32 | @ApiModelProperty(value = "视频地址") |
... | ... | @@ -40,6 +42,14 @@ public class Consult { |
40 | 42 | @ApiModelProperty(value = "阅读量") |
41 | 43 | private int readNumber; |
42 | 44 | |
45 | + public String getColumnTypeString() { | |
46 | + return columnTypeString; | |
47 | + } | |
48 | + | |
49 | + public void setColumnTypeString(String columnTypeString) { | |
50 | + this.columnTypeString = columnTypeString; | |
51 | + } | |
52 | + | |
43 | 53 | public int getReadNumber() { |
44 | 54 | return readNumber; |
45 | 55 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/ConsultServiceImpl.java
... | ... | @@ -78,7 +78,12 @@ public class ConsultServiceImpl implements ConsultService { |
78 | 78 | @Override |
79 | 79 | public Consult getDetail(int id) { |
80 | 80 | Consult consult = universityConsultMapper.selectByPrimaryKey(id); |
81 | - consult.setVideoUrlList(Arrays.asList(consult.getVideoUrl().split(","))); | |
81 | + universityConsultMapper.updateRead(id); | |
82 | + try{ | |
83 | + consult.setVideoUrlList(Arrays.asList(consult.getVideoUrl().split(","))); | |
84 | + }catch (Exception e){ | |
85 | + | |
86 | + } | |
82 | 87 | consult.setList(universityConsultDetailMapper.selectByConsult(id)); |
83 | 88 | return consult ; |
84 | 89 | } | ... | ... |
src/main/java/com/sincere/student/service/impl/VideoServiceImpl.java
... | ... | @@ -42,6 +42,9 @@ public class VideoServiceImpl implements VideoService { |
42 | 42 | PageHelper.startPage(dto.getPage(),dto.getPageSize()); |
43 | 43 | List<Video> list = videoMapper.getList(dto); |
44 | 44 | for(Video video : list){ |
45 | + videoMapper.updateRead(video.getId()); | |
46 | + } | |
47 | + for(Video video : list){ | |
45 | 48 | String[] array = video.getVideoUrl().split(","); |
46 | 49 | video.setVideoUrlList(Arrays.asList(array)); |
47 | 50 | } | ... | ... |
src/main/resources/mapper/ArticleMapper.xml
... | ... | @@ -47,16 +47,16 @@ |
47 | 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 | 48 | <where> |
49 | 49 | <if test="title != null and title != ''"> |
50 | - and title like #{title} | |
50 | + and university_article.title like #{title} | |
51 | 51 | </if> |
52 | 52 | <if test="columnType != 0"> |
53 | - and column_type = #{columnType} | |
53 | + and university_article.column_type = #{columnType} | |
54 | 54 | </if> |
55 | 55 | <if test="articleType != 0"> |
56 | - and type = #{articleType} | |
56 | + and university_article.type = #{articleType} | |
57 | 57 | </if> |
58 | 58 | <if test="status == 1"> |
59 | - and status = 1 | |
59 | + and university_article.status = 1 | |
60 | 60 | </if> |
61 | 61 | <if test="status != 1"> |
62 | 62 | and 1 = 1 | ... | ... |
src/main/resources/mapper/UniversityConsultMapper.xml
... | ... | @@ -118,6 +118,7 @@ |
118 | 118 | <result column="video_url" property="videoUrl" /> |
119 | 119 | <result column="context" property="context" /> |
120 | 120 | <result column="phone" property="phone" /> |
121 | + <result column="read_number" property="readNumber"/> | |
121 | 122 | </resultMap> |
122 | 123 | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="DetailMap"> |
123 | 124 | select * from university_consult c |
... | ... | @@ -125,6 +126,10 @@ |
125 | 126 | where c.id =#{id} |
126 | 127 | </select> |
127 | 128 | |
129 | + <update id="updateRead" parameterType="java.lang.Integer"> | |
130 | + update university_consult set read_number = read_number+1 where id=#{id} | |
131 | + </update> | |
132 | + | |
128 | 133 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |
129 | 134 | delete from university_consult |
130 | 135 | where id = #{id,jdbcType=INTEGER} | ... | ... |
src/main/resources/mapper/VideoMapper.xml
... | ... | @@ -21,6 +21,10 @@ |
21 | 21 | |
22 | 22 | </resultMap> |
23 | 23 | |
24 | + <update id="updateRead" parameterType="java.lang.Integer"> | |
25 | + update university_video set read_number = read_number + 1 where id= #{id} | |
26 | + </update> | |
27 | + | |
24 | 28 | <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> |
25 | 29 | select * from university_video where id = #{id} |
26 | 30 | </select> | ... | ... |