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