视频列表接口优化

This commit is contained in:
xiezhijun 2021-06-15 18:28:34 +08:00
parent f0ebfc9992
commit 5bb89cbcc8
2 changed files with 46 additions and 2 deletions

View File

@ -1,10 +1,12 @@
package com.stdiet.custom.dto.response;
import com.stdiet.common.utils.AliyunVideoUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.oss.AliyunOSSUtils;
import lombok.Data;
import java.io.Serializable;
@Data
public class VideoResponse implements Serializable {
private static final long serialVersionUID = 1L;
@ -14,4 +16,46 @@ public class VideoResponse implements Serializable {
//视频标题
private String title;
//视频封面
private String coverUrl;
//播放次数
private Integer playNum;
public String getVideoId() {
return videoId;
}
public void setVideoId(String videoId) {
this.videoId = videoId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCoverUrl() {
if (StringUtils.isNotEmpty(this.coverUrl)) {
return AliyunOSSUtils.generatePresignedUrl(this.coverUrl);
} else {
return AliyunVideoUtils.getVideoCoverUrl(this.videoId);
}
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public Integer getPlayNum() {
return playNum;
}
public void setPlayNum(Integer playNum) {
this.playNum = playNum;
}
}

View File

@ -146,7 +146,7 @@
</select>
<select id="getAllVideoByClassify" resultType="com.stdiet.custom.dto.response.VideoResponse">
select snv.video_id as videoId, snv.title
select snv.video_id as videoId, snv.title, snv.cover_url as coverUrl,snv.play_num as playNum
from sys_nutritional_video snv where cate_id = #{id} and del_flag = 0 and show_flag = 1
<if test="userType != null">
<if test="userType == 0">