demo01
parent
0d1707aa56
commit
4b0bd7b167
|
@ -28,9 +28,9 @@ public class UserVideoController {
|
|||
|
||||
//用户视频收藏列表
|
||||
@GetMapping("/findVideoCollectionList")
|
||||
public HealthR<List<UserVideoCollectionVo>> findVideoCollectionList(@RequestParam Integer page, @RequestParam Integer count){
|
||||
public HealthR<List<UserVideoCollectionVo>> findVideoCollectionList(@RequestParam Integer page, @RequestParam Integer count,@RequestHeader Integer userId){
|
||||
startPage(page,count);
|
||||
List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList();
|
||||
List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList(userId);
|
||||
return HealthR.ok(userVideoCollectionVos);
|
||||
}
|
||||
//用户取消视频收藏
|
||||
|
|
|
@ -22,9 +22,9 @@ public class VideoController {
|
|||
@Autowired
|
||||
private VideoService videoService;
|
||||
//收藏健康讲堂视频列表
|
||||
@PostMapping("/verify/v1/addUserVideoCollection/{videoId}")
|
||||
public HealthR addUserVideoCollection(@PathVariable Integer videoId){
|
||||
videoService.addUserVideoCollection(videoId);
|
||||
@PostMapping("/verify/v1/addUserVideoCollection")
|
||||
public HealthR addUserVideoCollection(@RequestParam Integer videoId,@RequestHeader Integer userId){
|
||||
videoService.addUserVideoCollection(videoId,userId);
|
||||
return HealthR.ok();
|
||||
}
|
||||
//购买健康讲堂视频
|
||||
|
|
|
@ -16,6 +16,8 @@ public class UserVideoCollectionEntity {
|
|||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
|
||||
private String original;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
@ -52,5 +54,11 @@ public class UserVideoCollectionEntity {
|
|||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getOriginal() {
|
||||
return original;
|
||||
}
|
||||
|
||||
public void setOriginal(String original) {
|
||||
this.original = original;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
package doctor.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoCollectionVo
|
||||
* @Description : 用户视频收藏表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 16:11
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserVideoCollectionVo {
|
||||
private Integer id;
|
||||
private Integer videoId;
|
||||
private String title;
|
||||
private String shearUrl;
|
||||
private String original;
|
||||
|
@ -16,76 +24,4 @@ public class UserVideoCollectionVo {
|
|||
private Integer whetherBuy;
|
||||
private Integer buyNum;
|
||||
private Long createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getShearUrl() {
|
||||
return shearUrl;
|
||||
}
|
||||
|
||||
public void setShearUrl(String shearUrl) {
|
||||
this.shearUrl = shearUrl;
|
||||
}
|
||||
|
||||
public String getOriginal() {
|
||||
return original;
|
||||
}
|
||||
|
||||
public void setOriginal(String original) {
|
||||
this.original = original;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Integer price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Integer getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Integer duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Integer getWhetherBuy() {
|
||||
return whetherBuy;
|
||||
}
|
||||
|
||||
public void setWhetherBuy(Integer whetherBuy) {
|
||||
this.whetherBuy = whetherBuy;
|
||||
}
|
||||
|
||||
public Integer getBuyNum() {
|
||||
return buyNum;
|
||||
}
|
||||
|
||||
public void setBuyNum(Integer buyNum) {
|
||||
this.buyNum = buyNum;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface UserVideoMapper {
|
||||
List<UserVideoCollectionEntity> findVideoCollectionList();
|
||||
List<UserVideoCollectionEntity> findVideoCollectionList(@Param("userId") Integer userId);
|
||||
|
||||
void cancelVideoCollection(@Param("videoId") Integer videoId);
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import doctor.domain.vo.UserConsumptionRecordVo;
|
||||
import doctor.domain.vo.UserVideoBuyVo;
|
||||
|
@ -26,7 +24,7 @@ public interface UserVideoService {
|
|||
|
||||
List<UserWalletEntity> findUserWallet();
|
||||
|
||||
List<UserVideoCollectionVo> findVideoCollectionList();
|
||||
List<UserVideoCollectionVo> findVideoCollectionList(Integer userId);
|
||||
|
||||
void cancelVideoCollection(Integer userId, String sessionId, Integer videoId);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface VideoService {
|
||||
|
||||
void addUserVideoCollection(Integer videoId);
|
||||
void addUserVideoCollection(Integer videoId,Integer userId);
|
||||
|
||||
|
||||
void videoBuy(Integer videoId,Integer price);
|
||||
|
|
|
@ -28,8 +28,8 @@ public class UserVideoServiceImpl implements UserVideoService {
|
|||
|
||||
|
||||
@Override
|
||||
public List<UserVideoCollectionVo> findVideoCollectionList() {
|
||||
List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList();
|
||||
public List<UserVideoCollectionVo> findVideoCollectionList(Integer userId) {
|
||||
List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList(userId);
|
||||
List<UserVideoCollectionVo> userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoCollectionVo.class);
|
||||
return userVideoCollectionVoList;
|
||||
}
|
||||
|
|
|
@ -25,10 +25,7 @@ public class VideoServiceImpl implements VideoService {
|
|||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
@Override
|
||||
public void addUserVideoCollection(Integer videoId) {
|
||||
//获取用户id
|
||||
String token = request.getHeader("token");
|
||||
Integer userId = Integer.valueOf(JwtUtils.getUserId(token));
|
||||
public void addUserVideoCollection(Integer videoId,Integer userId) {
|
||||
// 添加收藏
|
||||
videoMapper.addUserVideoCollection(userId,videoId);
|
||||
// 更新视频收藏数
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
where video_id = #{videoId}
|
||||
</delete>
|
||||
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity">
|
||||
select *
|
||||
from user_video_collection
|
||||
SELECT user_video_collection.*,video.original_url original FROM user_video_collection LEFT JOIN video ON video.id=user_video_collection.video_id where user_id=#{userId}
|
||||
</select>
|
||||
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuyEntity">
|
||||
select *
|
||||
|
|
Loading…
Reference in New Issue