zmy03
parent
b6f482f009
commit
c21ad2de7c
|
@ -3,6 +3,7 @@ package doctor.controller;
|
|||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.domain.entity.*;
|
||||
import doctor.domain.vo.VideoCommentVo;
|
||||
import doctor.service.VideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -32,11 +33,11 @@ public class VideoController {
|
|||
videoService.videoBuy(videoId,price);
|
||||
return HealthR.ok();
|
||||
}
|
||||
// //视频评论列表
|
||||
// @GetMapping("/v1/findVideoCommentList")
|
||||
// public R<List<VideoCommentEntity>> findVideoCommentList(){
|
||||
// List<VideoCommentEntity> videoCommentList = videoService.findVideoCommentList();
|
||||
// return R.ok(videoCommentList);
|
||||
// }
|
||||
|
||||
@GetMapping("/v1/findVideoCommentList")
|
||||
public HealthR<List<VideoCommentVo>> findVideoCommentList(@RequestParam Integer videoId) {
|
||||
List<VideoCommentVo> videoCommentVoList = videoService.findVideoCommentList(videoId);
|
||||
return HealthR.ok(videoCommentVoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package doctor.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class VideoCommentVo {
|
||||
private Integer id;
|
||||
private String content;
|
||||
}
|
|
@ -16,7 +16,7 @@ public interface HealthUserVideoMapper {
|
|||
|
||||
List<VideoEntity> findVideoVoList(@Param("categoryId") Integer categoryId);
|
||||
|
||||
UserVideoCollectionEntity selectWhetherCollectionByUserIdAndVideoId(@Param("userId") Integer userId, @Param("id") Integer id);
|
||||
UserVideoCollectionEntity selectWhetherCollectionByUserIdAndVideoId(@Param("userId") Long userId, @Param("id") Integer id);
|
||||
|
||||
UserVideoBuyEntity selectWhetherBuyByUserIdAndVideoId(@Param("userId") Integer userId, @Param("id") Integer id);
|
||||
UserVideoBuyEntity selectWhetherBuyByUserIdAndVideoId(@Param("userId") Long userId, @Param("id") Integer id);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface VideoMapper {
|
|||
|
||||
void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id);
|
||||
|
||||
|
||||
List<VideoCommentEntity> findVideoCommentList(@Param("videoId") Integer videoId);
|
||||
|
||||
|
||||
// UserWalletEntity FindById(@Param("userId") Integer userId);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.*;
|
||||
import doctor.domain.vo.VideoCommentVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -18,4 +19,5 @@ public interface VideoService {
|
|||
void videoBuy(Integer videoId,Integer price);
|
||||
|
||||
|
||||
List<VideoCommentVo> findVideoCommentList(Integer videoId);
|
||||
}
|
||||
|
|
|
@ -45,8 +45,7 @@ public class HealthUserVideoServiceImpl implements HealthUserVideoService {
|
|||
public List<VideoVo> findVideoVoList(Integer categoryId) {
|
||||
List<VideoEntity> videoVoList = healthUserVideoMapper.findVideoVoList(categoryId);
|
||||
List<VideoVo> videoVos = ConvertUtil.entityToVoList(videoVoList, VideoVo.class);
|
||||
String header = request.getHeader("token");
|
||||
Integer userId = Integer.valueOf(JwtUtils.getUserId(header));
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
videoVos.forEach(video -> {
|
||||
UserVideoCollectionEntity userVideoCollection = healthUserVideoMapper.selectWhetherCollectionByUserIdAndVideoId(userId,video.getId());
|
||||
if(userVideoCollection!=null){
|
||||
|
|
|
@ -2,8 +2,10 @@ package doctor.service.impl;
|
|||
|
||||
import doctor.common.core.utils.JwtUtils;
|
||||
import doctor.domain.entity.*;
|
||||
import doctor.domain.vo.VideoCommentVo;
|
||||
import doctor.mapper.VideoMapper;
|
||||
import doctor.service.VideoService;
|
||||
import doctor.util.ConvertUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -53,5 +55,12 @@ public class VideoServiceImpl implements VideoService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VideoCommentVo> findVideoCommentList(Integer videoId) {
|
||||
List<VideoCommentEntity> videoCommentEntityList = videoMapper.findVideoCommentList(videoId);
|
||||
List<VideoCommentVo> videoCommentVoList = ConvertUtil.entityToVoList(videoCommentEntityList, VideoCommentVo.class);
|
||||
return videoCommentVoList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9204
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: doctor-health
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -47,6 +47,9 @@
|
|||
LEFT JOIN user ON user.id = user_wallet.user_id
|
||||
WHERE user_wallet.user_id==#{id}
|
||||
</select>
|
||||
<select id="findVideoCommentList" resultType="doctor.domain.entity.VideoCommentEntity">
|
||||
select * from video_comment where video_id=#{videoId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue