视频模块2

jpz
fjj 2024-01-11 16:57:37 +08:00
parent d8e4d39d92
commit 1fb6eda59f
18 changed files with 84 additions and 63 deletions

View File

@ -3,6 +3,7 @@ package doctor.controller;
import doctor.common.core.domain.R; import doctor.common.core.domain.R;
import doctor.domain.entity.UserVideoBuy; import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection; import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import doctor.service.UserVideoService; import doctor.service.UserVideoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -28,7 +29,7 @@ public class UserVideoController {
return R.ok(userVideoCollectionList); return R.ok(userVideoCollectionList);
} }
//用户取消视频收藏 //用户取消视频收藏
@GetMapping("/cancelVideoCollection") @GetMapping("/cancelVideoCollection/{id}")
public R cancelVideoCollection(@PathVariable Integer id){ public R cancelVideoCollection(@PathVariable Integer id){
userVideoService.cancelVideoCollection(id); userVideoService.cancelVideoCollection(id);
return R.ok(); return R.ok();
@ -40,10 +41,18 @@ public class UserVideoController {
return R.ok(userVideoBuys); return R.ok(userVideoBuys);
} }
//用户删除购买的视频 //用户删除购买的视频
@DeleteMapping("/deleteVideoBuy") @DeleteMapping("/deleteVideoBuy/{id}")
public R deleteVideoBuy(@PathVariable Integer id){ public R deleteVideoBuy(@PathVariable Integer id){
userVideoService.deleteVideoBuy(id); userVideoService.deleteVideoBuy(id);
return R.ok(); return R.ok();
} }
//我的钱包
@GetMapping("/findUserWallet")
public R<List<UserWallet>> findUserWallet(){
List<UserWallet> userWallets = userVideoService.findUserWallet();
return R.ok(userWallets);
}
} }

View File

@ -1,16 +1,12 @@
package doctor.controller; package doctor.controller;
import doctor.common.core.domain.R; import doctor.common.core.domain.R;
import doctor.domain.entity.UserVideoBuy; import doctor.domain.entity.*;
import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.Video;
import doctor.domain.entity.VideoCount;
import doctor.service.VideoService; import doctor.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.List;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @ClassName : VideoController * @ClassName : VideoController
@ -36,6 +32,10 @@ public class VideoController {
return R.ok(); return R.ok();
} }
//视频评论列表 //视频评论列表
@GetMapping("/v1/findVideoCommentList")
public R<List<VideoComment>> findVideoCommentList(){
List<VideoComment> videoCommentList = videoService.findVideoCommentList();
return R.ok(videoCommentList);
}
} }

View File

@ -1,6 +1,7 @@
package doctor.domain.entity; package doctor.domain.entity;
import java.security.Timestamp; import java.security.Timestamp;
import java.util.Date;
public class DoctorUser { public class DoctorUser {
@ -16,8 +17,8 @@ public class DoctorUser {
private int height; private int height;
private int weight; private int weight;
private String invitationCode; private String invitationCode;
private Timestamp updateTime; private Date updateTime;
private Timestamp createTime; private Date createTime;
public int getId() { public int getId() {
return id; return id;
@ -115,19 +116,19 @@ public class DoctorUser {
this.invitationCode = invitationCode; this.invitationCode = invitationCode;
} }
public Timestamp getUpdateTime() { public Date getUpdateTime() {
return updateTime; return updateTime;
} }
public void setUpdateTime(Timestamp updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public Timestamp getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Timestamp createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

View File

@ -23,10 +23,8 @@ public class User {
private String height; private String height;
private String weight; private String weight;
private String invitationCode; private String invitationCode;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Long createTime;
private Date createTime;
public Integer getId() { public Integer getId() {
return id; return id;
@ -132,11 +130,11 @@ public class User {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public Date getCreateTime() { public Long getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(Long createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

View File

@ -10,7 +10,7 @@ public class UserVideoBuy {
private Integer id; private Integer id;
private Integer userId; private Integer userId;
private Integer videoId; private Integer videoId;
private Integer createTime; private Long createTime;
public Integer getId() { public Integer getId() {
return id; return id;
@ -36,15 +36,15 @@ public class UserVideoBuy {
this.videoId = videoId; this.videoId = videoId;
} }
public Integer getCreateTime() { public Long getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Integer createTime) { public void setCreateTime(Long createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public UserVideoBuy(Integer id, Integer userId, Integer videoId, Integer createTime) { public UserVideoBuy(Integer id, Integer userId, Integer videoId, Long createTime) {
this.id = id; this.id = id;
this.userId = userId; this.userId = userId;
this.videoId = videoId; this.videoId = videoId;

View File

@ -16,8 +16,7 @@ public class UserVideoCollection {
private Integer id; private Integer id;
private Integer userId; private Integer userId;
private Integer videoId; private Integer videoId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Long createTime;
private Date createTime;
public Integer getId() { public Integer getId() {
return id; return id;
@ -43,15 +42,15 @@ public class UserVideoCollection {
this.videoId = videoId; this.videoId = videoId;
} }
public Date getCreateTime() { public Long getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(Long createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public UserVideoCollection(Integer id, Integer userId, Integer videoId, Date createTime) { public UserVideoCollection(Integer id, Integer userId, Integer videoId, Long createTime) {
this.id = id; this.id = id;
this.userId = userId; this.userId = userId;
this.videoId = videoId; this.videoId = videoId;

View File

@ -14,11 +14,9 @@ public class UserWallet {
private Integer id; private Integer id;
private Integer userId; private Integer userId;
private Integer balance; private Integer balance;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Long updateTime;
private Date updateTime;
private Integer version; private Integer version;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Long createTime;
private Date createTime;
public Integer getId() { public Integer getId() {
return id; return id;
@ -44,11 +42,11 @@ public class UserWallet {
this.balance = balance; this.balance = balance;
} }
public Date getUpdateTime() { public Long getUpdateTime() {
return updateTime; return updateTime;
} }
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
@ -60,11 +58,11 @@ public class UserWallet {
this.version = version; this.version = version;
} }
public Date getCreateTime() { public Long getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(Long createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

View File

@ -19,8 +19,7 @@ public class Video {
private String originalUrl; private String originalUrl;
private Integer duration; private Integer duration;
private Integer price; private Integer price;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Long createTime;
private Date createTime;
public Integer getId() { public Integer getId() {
return id; return id;
@ -86,15 +85,15 @@ public class Video {
this.price = price; this.price = price;
} }
public Date getCreateTime() { public Long getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(Long createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public Video(Integer id, String title, Integer categoryId, String shearUrl, String abstracts, String originalUrl, Integer duration, Integer price, Date createTime) { public Video(Integer id, String title, Integer categoryId, String shearUrl, String abstracts, String originalUrl, Integer duration, Integer price, Long createTime) {
this.id = id; this.id = id;
this.title = title; this.title = title;
this.categoryId = categoryId; this.categoryId = categoryId;

View File

@ -16,7 +16,6 @@ public class VideoComment {
private Integer userId; private Integer userId;
private Integer videoId; private Integer videoId;
private String content; private String content;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime; private Date createTime;
public Integer getId() { public Integer getId() {

View File

@ -16,7 +16,6 @@ public class VideoCount {
private Integer buyNum; private Integer buyNum;
private Integer collectionNum; private Integer collectionNum;
private Integer commentNum; private Integer commentNum;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
public Integer getId() { public Integer getId() {
@ -67,16 +66,5 @@ public class VideoCount {
this.createTime = createTime; this.createTime = createTime;
} }
public VideoCount(Integer id, Integer videoId, Integer buyNum, Integer collectionNum, Integer commentNum, Date createTime) {
this.id = id;
this.videoId = videoId;
this.buyNum = buyNum;
this.collectionNum = collectionNum;
this.commentNum = commentNum;
this.createTime = createTime;
}
public VideoCount() {
}
} }

View File

@ -2,6 +2,7 @@ package doctor.mapper;
import doctor.domain.entity.UserVideoBuy; import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection; import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -22,4 +23,6 @@ public interface UserVideoMapper {
List<UserVideoBuy> findUserVideoBuyList(); List<UserVideoBuy> findUserVideoBuyList();
void deleteVideoBuy(@Param("id") Integer id); void deleteVideoBuy(@Param("id") Integer id);
List<UserWallet> findUserWallet();
} }

View File

@ -4,6 +4,8 @@ import doctor.domain.entity.*;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @ClassName : VideoMapper * @ClassName : VideoMapper
* @Description : * @Description :
@ -30,6 +32,8 @@ public interface VideoMapper {
void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id); void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id);
List<VideoComment> findVideoCommentList();
// UserWallet FindById(@Param("userId") Integer userId); // UserWallet FindById(@Param("userId") Integer userId);
} }

View File

@ -2,6 +2,7 @@ package doctor.service;
import doctor.domain.entity.UserVideoBuy; import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection; import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import java.util.List; import java.util.List;
@ -19,4 +20,6 @@ public interface UserVideoService {
List<UserVideoBuy> findUserVideoBuyList(); List<UserVideoBuy> findUserVideoBuyList();
void deleteVideoBuy(Integer id); void deleteVideoBuy(Integer id);
List<UserWallet> findUserWallet();
} }

View File

@ -1,9 +1,8 @@
package doctor.service; package doctor.service;
import doctor.domain.entity.UserVideoBuy; import doctor.domain.entity.*;
import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.Video; import java.util.List;
import doctor.domain.entity.VideoCount;
/** /**
* @ClassName : VideoService * @ClassName : VideoService
@ -17,4 +16,6 @@ public interface VideoService {
void videoBuy(UserVideoBuy userVideoBuy); void videoBuy(UserVideoBuy userVideoBuy);
List<VideoComment> findVideoCommentList();
} }

View File

@ -2,6 +2,7 @@ package doctor.service.impl;
import doctor.domain.entity.UserVideoBuy; import doctor.domain.entity.UserVideoBuy;
import doctor.domain.entity.UserVideoCollection; import doctor.domain.entity.UserVideoCollection;
import doctor.domain.entity.UserWallet;
import doctor.mapper.UserVideoMapper; import doctor.mapper.UserVideoMapper;
import doctor.service.UserVideoService; import doctor.service.UserVideoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -38,4 +39,9 @@ public class UserVideoServiceImpl implements UserVideoService {
public void deleteVideoBuy(Integer id) { public void deleteVideoBuy(Integer id) {
userVideoMapper.deleteVideoBuy(id); userVideoMapper.deleteVideoBuy(id);
} }
@Override
public List<UserWallet> findUserWallet() {
return userVideoMapper.findUserWallet();
}
} }

View File

@ -6,6 +6,8 @@ import doctor.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @ClassName : VideoServiceImpl * @ClassName : VideoServiceImpl
* @Description : * @Description :
@ -46,4 +48,9 @@ public class VideoServiceImpl implements VideoService {
} }
@Override
public List<VideoComment> findVideoCommentList() {
return videoMapper.findVideoCommentList();
}
} }

View File

@ -13,8 +13,6 @@
from user_video_buy from user_video_buy
where id = #{id} where id = #{id}
</delete> </delete>
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollection"> <select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollection">
select * select *
from user_video_collection from user_video_collection
@ -23,4 +21,8 @@
select * select *
from user_video_buy from user_video_buy
</select> </select>
<select id="findUserWallet" resultType="doctor.domain.entity.UserWallet">
select *
from user_wallet
</select>
</mapper> </mapper>

View File

@ -53,5 +53,9 @@
LEFT JOIN video ON video.id = user_video_buy.video_id LEFT JOIN video ON video.id = user_video_buy.video_id
WHERE video.video.id = #{videoId} WHERE video.video.id = #{videoId}
</select> </select>
<select id="findVideoCommentList" resultType="doctor.domain.entity.VideoComment">
select *
from video_comment
</select>
</mapper> </mapper>