From 1fb6eda59f6d9d08e3ac249e1ab4bc80249034c2 Mon Sep 17 00:00:00 2001 From: fjj <–1066869486@qq.com> Date: Thu, 11 Jan 2024 16:57:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=A8=A1=E5=9D=972?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../doctor/controller/UserVideoController.java | 13 +++++++++++-- .../doctor/controller/VideoController.java | 18 +++++++++--------- .../java/doctor/domain/entity/DoctorUser.java | 13 +++++++------ .../main/java/doctor/domain/entity/User.java | 8 +++----- .../doctor/domain/entity/UserVideoBuy.java | 8 ++++---- .../domain/entity/UserVideoCollection.java | 9 ++++----- .../java/doctor/domain/entity/UserWallet.java | 14 ++++++-------- .../main/java/doctor/domain/entity/Video.java | 9 ++++----- .../doctor/domain/entity/VideoComment.java | 1 - .../java/doctor/domain/entity/VideoCount.java | 12 ------------ .../java/doctor/mapper/UserVideoMapper.java | 3 +++ .../main/java/doctor/mapper/VideoMapper.java | 4 ++++ .../java/doctor/service/UserVideoService.java | 3 +++ .../main/java/doctor/service/VideoService.java | 9 +++++---- .../service/impl/UserVideoServiceImpl.java | 6 ++++++ .../doctor/service/impl/VideoServiceImpl.java | 7 +++++++ .../mapper/doctor/UserVideoMapper.xml | 6 ++++-- .../resources/mapper/doctor/VideoMapper.xml | 4 ++++ 18 files changed, 84 insertions(+), 63 deletions(-) diff --git a/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java b/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java index eb6899b..410f514 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java @@ -3,6 +3,7 @@ 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.*; @@ -28,7 +29,7 @@ public class UserVideoController { return R.ok(userVideoCollectionList); } //用户取消视频收藏 - @GetMapping("/cancelVideoCollection") + @GetMapping("/cancelVideoCollection/{id}") public R cancelVideoCollection(@PathVariable Integer id){ userVideoService.cancelVideoCollection(id); return R.ok(); @@ -40,10 +41,18 @@ public class UserVideoController { return R.ok(userVideoBuys); } //用户删除购买的视频 - @DeleteMapping("/deleteVideoBuy") + @DeleteMapping("/deleteVideoBuy/{id}") public R deleteVideoBuy(@PathVariable Integer id){ userVideoService.deleteVideoBuy(id); return R.ok(); } + //我的钱包 + @GetMapping("/findUserWallet") + public R> findUserWallet(){ + List userWallets = userVideoService.findUserWallet(); + return R.ok(userWallets); + } + + } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java b/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java index 19f02d5..4cc9573 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java @@ -1,16 +1,12 @@ package doctor.controller; import doctor.common.core.domain.R; -import doctor.domain.entity.UserVideoBuy; -import doctor.domain.entity.UserVideoCollection; -import doctor.domain.entity.Video; -import doctor.domain.entity.VideoCount; +import doctor.domain.entity.*; import doctor.service.VideoService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * @ClassName : VideoController @@ -36,6 +32,10 @@ public class VideoController { return R.ok(); } //视频评论列表 - + @GetMapping("/v1/findVideoCommentList") + public R> findVideoCommentList(){ + List videoCommentList = videoService.findVideoCommentList(); + return R.ok(videoCommentList); + } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/DoctorUser.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/DoctorUser.java index acc8ce3..ee7dfe0 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/DoctorUser.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/DoctorUser.java @@ -1,6 +1,7 @@ package doctor.domain.entity; import java.security.Timestamp; +import java.util.Date; public class DoctorUser { @@ -16,8 +17,8 @@ public class DoctorUser { private int height; private int weight; private String invitationCode; - private Timestamp updateTime; - private Timestamp createTime; + private Date updateTime; + private Date createTime; public int getId() { return id; @@ -115,19 +116,19 @@ public class DoctorUser { 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 Date getCreateTime() { return createTime; } - public void setCreateTime(Timestamp createTime) { + public void setCreateTime(Date createTime) { this.createTime = createTime; } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/User.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/User.java index 0ece141..6f0f2cb 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/User.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/User.java @@ -23,10 +23,8 @@ public class User { private String height; private String weight; private String invitationCode; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; + private Long createTime; public Integer getId() { return id; @@ -132,11 +130,11 @@ public class User { this.updateTime = updateTime; } - public Date getCreateTime() { + public Long getCreateTime() { return createTime; } - public void setCreateTime(Date createTime) { + public void setCreateTime(Long createTime) { this.createTime = createTime; } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoBuy.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoBuy.java index f4d5ff7..5903ee7 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoBuy.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoBuy.java @@ -10,7 +10,7 @@ public class UserVideoBuy { private Integer id; private Integer userId; private Integer videoId; - private Integer createTime; + private Long createTime; public Integer getId() { return id; @@ -36,15 +36,15 @@ public class UserVideoBuy { this.videoId = videoId; } - public Integer getCreateTime() { + public Long getCreateTime() { return createTime; } - public void setCreateTime(Integer createTime) { + public void setCreateTime(Long 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.userId = userId; this.videoId = videoId; diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollection.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollection.java index b086678..b9ab680 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollection.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollection.java @@ -16,8 +16,7 @@ public class UserVideoCollection { private Integer id; private Integer userId; private Integer videoId; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; + private Long createTime; public Integer getId() { return id; @@ -43,15 +42,15 @@ public class UserVideoCollection { this.videoId = videoId; } - public Date getCreateTime() { + public Long getCreateTime() { return createTime; } - public void setCreateTime(Date createTime) { + public void setCreateTime(Long 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.userId = userId; this.videoId = videoId; diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserWallet.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserWallet.java index aa97cd1..1da779d 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserWallet.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserWallet.java @@ -14,11 +14,9 @@ public class UserWallet { private Integer id; private Integer userId; private Integer balance; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; + private Long updateTime; private Integer version; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; + private Long createTime; public Integer getId() { return id; @@ -44,11 +42,11 @@ public class UserWallet { this.balance = balance; } - public Date getUpdateTime() { + public Long getUpdateTime() { return updateTime; } - public void setUpdateTime(Date updateTime) { + public void setUpdateTime(Long updateTime) { this.updateTime = updateTime; } @@ -60,11 +58,11 @@ public class UserWallet { this.version = version; } - public Date getCreateTime() { + public Long getCreateTime() { return createTime; } - public void setCreateTime(Date createTime) { + public void setCreateTime(Long createTime) { this.createTime = createTime; } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/Video.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/Video.java index 5c6ff3f..a09e715 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/Video.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/Video.java @@ -19,8 +19,7 @@ public class Video { private String originalUrl; private Integer duration; private Integer price; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; + private Long createTime; public Integer getId() { return id; @@ -86,15 +85,15 @@ public class Video { this.price = price; } - public Date getCreateTime() { + public Long getCreateTime() { return createTime; } - public void setCreateTime(Date 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, 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.title = title; this.categoryId = categoryId; diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoComment.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoComment.java index 375dab7..84db8bf 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoComment.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoComment.java @@ -16,7 +16,6 @@ public class VideoComment { private Integer userId; private Integer videoId; private String content; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") private Date createTime; public Integer getId() { diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoCount.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoCount.java index 3a7c090..c2e626c 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoCount.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoCount.java @@ -16,7 +16,6 @@ public class VideoCount { private Integer buyNum; private Integer collectionNum; private Integer commentNum; - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; public Integer getId() { @@ -67,16 +66,5 @@ public class VideoCount { 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() { - } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java b/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java index 6ac8701..32bb5d3 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java @@ -2,6 +2,7 @@ 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; @@ -22,4 +23,6 @@ public interface UserVideoMapper { List findUserVideoBuyList(); void deleteVideoBuy(@Param("id") Integer id); + + List findUserWallet(); } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/mapper/VideoMapper.java b/doctor-modules/doctor-health/src/main/java/doctor/mapper/VideoMapper.java index 6c1f0a3..6c886cb 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/mapper/VideoMapper.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/mapper/VideoMapper.java @@ -4,6 +4,8 @@ import doctor.domain.entity.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * @ClassName : VideoMapper * @Description : @@ -30,6 +32,8 @@ public interface VideoMapper { void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id); + List findVideoCommentList(); + // UserWallet FindById(@Param("userId") Integer userId); } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java b/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java index 910e84b..b024c7e 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java @@ -2,6 +2,7 @@ package doctor.service; import doctor.domain.entity.UserVideoBuy; import doctor.domain.entity.UserVideoCollection; +import doctor.domain.entity.UserWallet; import java.util.List; @@ -19,4 +20,6 @@ public interface UserVideoService { List findUserVideoBuyList(); void deleteVideoBuy(Integer id); + + List findUserWallet(); } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java b/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java index 204dbbb..bab5ee1 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java @@ -1,9 +1,8 @@ package doctor.service; -import doctor.domain.entity.UserVideoBuy; -import doctor.domain.entity.UserVideoCollection; -import doctor.domain.entity.Video; -import doctor.domain.entity.VideoCount; +import doctor.domain.entity.*; + +import java.util.List; /** * @ClassName : VideoService @@ -17,4 +16,6 @@ public interface VideoService { void videoBuy(UserVideoBuy userVideoBuy); + + List findVideoCommentList(); } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java index fcd3af1..74708ca 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java @@ -2,6 +2,7 @@ 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; @@ -38,4 +39,9 @@ public class UserVideoServiceImpl implements UserVideoService { public void deleteVideoBuy(Integer id) { userVideoMapper.deleteVideoBuy(id); } + + @Override + public List findUserWallet() { + return userVideoMapper.findUserWallet(); + } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java index e380525..1c45fe1 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java @@ -6,6 +6,8 @@ import doctor.service.VideoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * @ClassName : VideoServiceImpl * @Description : @@ -46,4 +48,9 @@ public class VideoServiceImpl implements VideoService { } + @Override + public List findVideoCommentList() { + return videoMapper.findVideoCommentList(); + } + } diff --git a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml index b41fac7..cb586ad 100644 --- a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml +++ b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml @@ -13,8 +13,6 @@ from user_video_buy where id = #{id} - - + diff --git a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/VideoMapper.xml b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/VideoMapper.xml index e07bcce..7903f85 100644 --- a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/VideoMapper.xml +++ b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/VideoMapper.xml @@ -53,5 +53,9 @@ LEFT JOIN video ON video.id = user_video_buy.video_id WHERE video.video.id = #{videoId} +