Merge remote-tracking branch 'origin/fjj'
# Conflicts: # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/User.java # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/UserVideoBuy.java # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/UserVideoCollection.java # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/UserWallet.java # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/Video.java # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/VideoComment.java # doctor-api/doctor-api-system/src/main/java/doctor/system/api/domain/VideoCount.javajpz
commit
f5fe48a32b
|
@ -1,29 +1,36 @@
|
|||
package doctor.system.api.domain;
|
||||
package doctor.domain.entity;
|
||||
|
||||
import java.security.Timestamp;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : User
|
||||
* @Description : 用户表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 20:46
|
||||
*/
|
||||
public class User {
|
||||
|
||||
private int id;
|
||||
private Integer id;
|
||||
private String phone;
|
||||
private String pwd;
|
||||
private String email;
|
||||
private String nickName;
|
||||
private String userName;
|
||||
private String headPic;
|
||||
private int sex;
|
||||
private int age;
|
||||
private int height;
|
||||
private int weight;
|
||||
private Integer sex;
|
||||
private Integer age;
|
||||
private String height;
|
||||
private String weight;
|
||||
private String invitationCode;
|
||||
private Timestamp updateTime;
|
||||
private Timestamp createTime;
|
||||
private Date updateTime;
|
||||
private Long createTime;
|
||||
|
||||
public int getId() {
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
@ -75,35 +82,35 @@ public class User {
|
|||
this.headPic = headPic;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
public void setSex(Integer sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
public String getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
public void setHeight(String height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(int weight) {
|
||||
public void setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
|
@ -115,19 +122,19 @@ public class User {
|
|||
this.invitationCode = invitationCode;
|
||||
}
|
||||
|
||||
public Timestamp getUpdateTime() {
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Timestamp updateTime) {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Timestamp getCreateTime() {
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Timestamp createTime) {
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoBuy
|
||||
* @Description : 用户购买视频表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 15:20
|
||||
*/
|
||||
public class UserVideoBuy {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
private Long createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getVideoId() {
|
||||
return videoId;
|
||||
}
|
||||
|
||||
public void setVideoId(Integer videoId) {
|
||||
this.videoId = videoId;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoBuy(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.videoId = videoId;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoBuy() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoCollection
|
||||
* @Description : 用户视频收藏表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 14:28
|
||||
*/
|
||||
|
||||
public class UserVideoCollection {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
private Long createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getVideoId() {
|
||||
return videoId;
|
||||
}
|
||||
|
||||
public void setVideoId(Integer videoId) {
|
||||
this.videoId = videoId;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoCollection(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.videoId = videoId;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoCollection() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : UserWallet
|
||||
* @Description : 用户钱包
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 20:30
|
||||
*/
|
||||
public class UserWallet {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer balance;
|
||||
private Long updateTime;
|
||||
private Integer version;
|
||||
private Long createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(Integer balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public Long getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Long updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Integer getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Integer version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : Video
|
||||
* @Description : 健康课堂视频表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 15:59
|
||||
*/
|
||||
public class Video {
|
||||
private Integer id;
|
||||
private String title;
|
||||
private Integer categoryId;
|
||||
private String shearUrl;
|
||||
private String abstracts;
|
||||
private String originalUrl;
|
||||
private Integer duration;
|
||||
private Integer price;
|
||||
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 Integer getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
public void setCategoryId(Integer categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public String getShearUrl() {
|
||||
return shearUrl;
|
||||
}
|
||||
|
||||
public void setShearUrl(String shearUrl) {
|
||||
this.shearUrl = shearUrl;
|
||||
}
|
||||
|
||||
public String getAbstracts() {
|
||||
return abstracts;
|
||||
}
|
||||
|
||||
public void setAbstracts(String abstracts) {
|
||||
this.abstracts = abstracts;
|
||||
}
|
||||
|
||||
public String getOriginalUrl() {
|
||||
return originalUrl;
|
||||
}
|
||||
|
||||
public void setOriginalUrl(String originalUrl) {
|
||||
this.originalUrl = originalUrl;
|
||||
}
|
||||
|
||||
public Integer getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Integer duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Integer price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = 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.title = title;
|
||||
this.categoryId = categoryId;
|
||||
this.shearUrl = shearUrl;
|
||||
this.abstracts = abstracts;
|
||||
this.originalUrl = originalUrl;
|
||||
this.duration = duration;
|
||||
this.price = price;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Video() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoComment
|
||||
* @Description : 评论表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 21:54
|
||||
*/
|
||||
public class VideoComment {
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
private String content;
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getVideoId() {
|
||||
return videoId;
|
||||
}
|
||||
|
||||
public void setVideoId(Integer videoId) {
|
||||
this.videoId = videoId;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoCount
|
||||
* @Description : 视频数
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 16:24
|
||||
*/
|
||||
public class VideoCount {
|
||||
private Integer id;
|
||||
private Integer videoId;
|
||||
private Integer buyNum;
|
||||
private Integer collectionNum;
|
||||
private Integer commentNum;
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getVideoId() {
|
||||
return videoId;
|
||||
}
|
||||
|
||||
public void setVideoId(Integer videoId) {
|
||||
this.videoId = videoId;
|
||||
}
|
||||
|
||||
public Integer getBuyNum() {
|
||||
return buyNum;
|
||||
}
|
||||
|
||||
public void setBuyNum(Integer buyNum) {
|
||||
this.buyNum = buyNum;
|
||||
}
|
||||
|
||||
public Integer getCollectionNum() {
|
||||
return collectionNum;
|
||||
}
|
||||
|
||||
public void setCollectionNum(Integer collectionNum) {
|
||||
this.collectionNum = collectionNum;
|
||||
}
|
||||
|
||||
public Integer getCommentNum() {
|
||||
return commentNum;
|
||||
}
|
||||
|
||||
public void setCommentNum(Integer commentNum) {
|
||||
this.commentNum = commentNum;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.service.UserVideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoController
|
||||
* @Description : 用户视频
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 14:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/verify/v1")
|
||||
public class UserVideoController {
|
||||
@Autowired
|
||||
private UserVideoService userVideoService;
|
||||
|
||||
//用户视频收藏列表
|
||||
@GetMapping("/findVideoCollectionList")
|
||||
public R<List<UserVideoCollection>>findVideoCollectionList(){
|
||||
List<UserVideoCollection> userVideoCollectionList =userVideoService.findVideoCollectionList();
|
||||
return R.ok(userVideoCollectionList);
|
||||
}
|
||||
//用户取消视频收藏
|
||||
@GetMapping("/cancelVideoCollection/{id}")
|
||||
public R cancelVideoCollection(@PathVariable Integer id){
|
||||
userVideoService.cancelVideoCollection(id);
|
||||
return R.ok();
|
||||
}
|
||||
//用户购买视频列表
|
||||
@GetMapping("/findUserVideoBuyList")
|
||||
public R<List<UserVideoBuy>>findUserVideoBuyList(){
|
||||
List<UserVideoBuy> userVideoBuys =userVideoService.findUserVideoBuyList();
|
||||
return R.ok(userVideoBuys);
|
||||
}
|
||||
//用户删除购买的视频
|
||||
@DeleteMapping("/deleteVideoBuy/{id}")
|
||||
public R deleteVideoBuy(@PathVariable Integer id){
|
||||
userVideoService.deleteVideoBuy(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
//我的钱包
|
||||
@GetMapping("/findUserWallet")
|
||||
public R<List<UserWallet>> findUserWallet(){
|
||||
List<UserWallet> userWallets = userVideoService.findUserWallet();
|
||||
return R.ok(userWallets);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.domain.entity.*;
|
||||
import doctor.service.VideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoController
|
||||
* @Description : 健康课堂视频
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 15:58
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/video")
|
||||
public class VideoController {
|
||||
@Autowired
|
||||
private VideoService videoService;
|
||||
//收藏健康讲堂视频列表
|
||||
@PostMapping("/verify/v1/addUserVideoCollection")
|
||||
public R addUserVideoCollection(@RequestBody UserVideoCollection userVideoCollection){
|
||||
videoService.addUserVideoCollection(userVideoCollection);
|
||||
return R.ok();
|
||||
}
|
||||
//购买健康讲堂视频
|
||||
@PostMapping("/verify/v1/videoBuy")
|
||||
public R videoBuy(@RequestBody UserVideoBuy userVideoBuy){
|
||||
videoService.videoBuy(userVideoBuy);
|
||||
return R.ok();
|
||||
}
|
||||
//视频评论列表
|
||||
@GetMapping("/v1/findVideoCommentList")
|
||||
public R<List<VideoComment>> findVideoCommentList(){
|
||||
List<VideoComment> videoCommentList = videoService.findVideoCommentList();
|
||||
return R.ok(videoCommentList);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoMapper
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 14:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserVideoMapper {
|
||||
List<UserVideoCollection> findVideoCollectionList();
|
||||
|
||||
void cancelVideoCollection(@Param("id") Integer id);
|
||||
|
||||
List<UserVideoBuy> findUserVideoBuyList();
|
||||
|
||||
void deleteVideoBuy(@Param("id") Integer id);
|
||||
|
||||
List<UserWallet> findUserWallet();
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoMapper
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 16:03
|
||||
*/
|
||||
@Mapper
|
||||
public interface VideoMapper {
|
||||
|
||||
|
||||
void addUserVideoCollection(UserVideoCollection userVideoCollection);
|
||||
|
||||
Video findById(@Param("videoId") Integer videoId);
|
||||
|
||||
VideoCount FindVideoId(@Param("id") Integer id);
|
||||
|
||||
void updateVideoCount(VideoCount videoCount);
|
||||
|
||||
User FindById(@Param("userId") Integer userId);
|
||||
|
||||
UserWallet FindUserWallet(@Param("id") Integer id);
|
||||
|
||||
Video findByVideoId(@Param("videoId") Integer videoId);
|
||||
|
||||
void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id);
|
||||
|
||||
List<VideoComment> findVideoCommentList();
|
||||
|
||||
|
||||
// UserWallet FindById(@Param("userId") Integer userId);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 14:33
|
||||
*/
|
||||
public interface UserVideoService {
|
||||
List<UserVideoCollection> findVideoCollectionList();
|
||||
|
||||
void cancelVideoCollection(Integer id);
|
||||
|
||||
List<UserVideoBuy> findUserVideoBuyList();
|
||||
|
||||
void deleteVideoBuy(Integer id);
|
||||
|
||||
List<UserWallet> findUserWallet();
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 16:04
|
||||
*/
|
||||
public interface VideoService {
|
||||
|
||||
void addUserVideoCollection(UserVideoCollection userVideoCollection);
|
||||
|
||||
|
||||
void videoBuy(UserVideoBuy userVideoBuy);
|
||||
|
||||
List<VideoComment> findVideoCommentList();
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.mapper.UserVideoMapper;
|
||||
import doctor.service.UserVideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoServiceImpl
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 14:34
|
||||
*/
|
||||
@Service
|
||||
public class UserVideoServiceImpl implements UserVideoService {
|
||||
@Autowired
|
||||
private UserVideoMapper userVideoMapper;
|
||||
@Override
|
||||
public List<UserVideoCollection> findVideoCollectionList() {
|
||||
return userVideoMapper.findVideoCollectionList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelVideoCollection(Integer id) {
|
||||
userVideoMapper.cancelVideoCollection(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserVideoBuy> findUserVideoBuyList() {
|
||||
return userVideoMapper.findUserVideoBuyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVideoBuy(Integer id) {
|
||||
userVideoMapper.deleteVideoBuy(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserWallet> findUserWallet() {
|
||||
return userVideoMapper.findUserWallet();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.domain.entity.*;
|
||||
import doctor.mapper.VideoMapper;
|
||||
import doctor.service.VideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoServiceImpl
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 16:04
|
||||
*/
|
||||
@Service
|
||||
public class VideoServiceImpl implements VideoService {
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
|
||||
@Override
|
||||
public void addUserVideoCollection(UserVideoCollection userVideoCollection) {
|
||||
// 添加收藏
|
||||
videoMapper.addUserVideoCollection(userVideoCollection);
|
||||
// 更新视频收藏数
|
||||
Video video = videoMapper.findById(userVideoCollection.getVideoId());
|
||||
VideoCount videoCount = videoMapper.FindVideoId(video.getId());
|
||||
videoMapper.updateVideoCount(videoCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void videoBuy(UserVideoBuy userVideoBuy) {
|
||||
//查询用户信息
|
||||
User user = videoMapper.FindById(userVideoBuy.getUserId());
|
||||
//查询视频信息
|
||||
Video video = videoMapper.findByVideoId(userVideoBuy.getVideoId());
|
||||
//查询用户钱包
|
||||
UserWallet userWallet = videoMapper.FindUserWallet(user.getId());
|
||||
//判断用户钱包是否足够
|
||||
if (userWallet.getBalance() >= video.getPrice()) {
|
||||
//更新用户钱包
|
||||
int newblance=userWallet.getBalance() - video.getPrice();
|
||||
//更新用户钱包
|
||||
videoMapper.updateUserWallet(newblance,userWallet.getId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VideoComment> findVideoCommentList() {
|
||||
return videoMapper.findVideoCommentList();
|
||||
}
|
||||
|
||||
}
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="doctor.mapper.UserVideoMapper">
|
||||
<delete id="cancelVideoCollection">
|
||||
delete
|
||||
from user_video_collection
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteVideoBuy">
|
||||
delete
|
||||
from user_video_buy
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollection">
|
||||
select *
|
||||
from user_video_collection
|
||||
</select>
|
||||
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuy">
|
||||
select *
|
||||
from user_video_buy
|
||||
</select>
|
||||
<select id="findUserWallet" resultType="doctor.domain.entity.UserWallet">
|
||||
select *
|
||||
from user_wallet
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="doctor.mapper.VideoMapper">
|
||||
|
||||
|
||||
<insert id="addUserVideoCollection">
|
||||
insert into user_video_collection (user_id,
|
||||
video_id,
|
||||
create_time)
|
||||
values (#{userId},
|
||||
#{videoId},
|
||||
now());
|
||||
</insert>
|
||||
<update id="updateVideoCount">
|
||||
update video_count
|
||||
set collection_num=collection_num + 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateUserWallet">
|
||||
update user_wallet
|
||||
set blance==#{newblance}
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<select id="findById" resultType="doctor.domain.entity.Video">
|
||||
SELECT user_video_collection.*
|
||||
FROM user_video_collection
|
||||
LEFT JOIN video ON user_video_collection.video_id = video.id
|
||||
WHERE video.id = #{videoId}
|
||||
</select>
|
||||
<select id="FindVideoId" resultType="doctor.domain.entity.VideoCount">
|
||||
select *
|
||||
from video_count
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="FindById" resultType="doctor.domain.entity.User">
|
||||
SELECT user.*
|
||||
FROM user_video_buy
|
||||
LEFT JOIN user ON user.id = user_video_buy.user_id
|
||||
WHERE user_video_buy.user_id = #{userId}
|
||||
</select>
|
||||
<select id="FindUserWallet" resultType="doctor.domain.entity.UserWallet">
|
||||
SELECT user.*
|
||||
FROM user_wallet
|
||||
LEFT JOIN user ON user.id = user_wallet.user_id
|
||||
WHERE user_wallet.user_id==#{id}
|
||||
</select>
|
||||
<select id="findByVideoId" resultType="doctor.domain.entity.Video">
|
||||
SELECT user_video_buy.*
|
||||
FROM user_video_buy
|
||||
LEFT JOIN video ON video.id = user_video_buy.video_id
|
||||
WHERE video.video.id = #{videoId}
|
||||
</select>
|
||||
<select id="findVideoCommentList" resultType="doctor.domain.entity.VideoComment">
|
||||
select *
|
||||
from video_comment
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue