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