后台接口4

cbx
fjj 2024-01-14 16:11:22 +08:00
parent 54c88e0c6e
commit 2670eeb00b
8 changed files with 107 additions and 28 deletions

View File

@ -24,7 +24,7 @@ public class User {
private Integer weight;
private String invitationCode;
private Date updateTime;
private Long createTime;
private long createTime;
public Integer getId() {
return id;

View File

@ -2,6 +2,7 @@ package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo;
import doctor.domain.vo.UserVideoCollectionVo;
import doctor.service.UserVideoService;
@ -33,9 +34,9 @@ public class UserVideoController {
return HealthR.ok(userVideoCollectionVos);
}
//用户取消视频收藏
@GetMapping("/cancelVideoCollection/{id}")
public HealthR cancelVideoCollection(@PathVariable Integer id){
userVideoService.cancelVideoCollection(id);
@DeleteMapping("/cancelVideoCollection")
public HealthR cancelVideoCollection(@RequestHeader Integer userId,@RequestHeader String sessionId,@RequestParam Integer videoId ){
userVideoService.cancelVideoCollection(userId,sessionId,videoId);
return HealthR.ok();
}
//用户购买视频列表
@ -46,9 +47,9 @@ public class UserVideoController {
return HealthR.ok(userVideoCollectionVos);
}
//用户删除购买的视频
@DeleteMapping("/deleteVideoBuy/{id}")
public HealthR deleteVideoBuy(@PathVariable Integer id){
userVideoService.deleteVideoBuy(id);
@DeleteMapping("/deleteVideoBuy/{videoId}")
public HealthR deleteVideoBuy(@PathVariable Integer videoId){
userVideoService.deleteVideoBuy(videoId);
return HealthR.ok();
}
@ -58,6 +59,13 @@ public class UserVideoController {
List<UserWalletEntity> userWallets = userVideoService.findUserWallet();
return HealthR.ok(userWallets);
}
//用户消费记录
@GetMapping("/findUserConsumptionRecordList")
public HealthR<List<UserConsumptionRecordVo>> findUserConsumptionRecordList(@RequestParam Integer page,@RequestParam Integer count){
startPage(page,count);
List<UserConsumptionRecordVo> userConsumptionRecordVos = userVideoService.findUserConsumptionRecordList();
return HealthR.ok(userConsumptionRecordVos);
}
}

View File

@ -1,5 +1,7 @@
package doctor.domain.entity;
import java.util.Date;
/**
* @ClassName : UserVideoCollectionEntity
* @Description :
@ -11,7 +13,7 @@ public class UserVideoCollectionEntity {
private Integer id;
private Integer userId;
private Integer videoId;
private Long createTime;
private Date createTime;
public Integer getId() {
return id;
@ -37,21 +39,13 @@ public class UserVideoCollectionEntity {
this.videoId = videoId;
}
public Long getCreateTime() {
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public UserVideoCollectionEntity(Integer id, Integer userId, Integer videoId, Long createTime) {
this.id = id;
this.userId = userId;
this.videoId = videoId;
this.createTime = createTime;
}
public UserVideoCollectionEntity() {
}
}

View File

@ -0,0 +1,55 @@
package doctor.domain.vo;
/**
* @ClassName : UserConsumptionRecordVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-14 15:30
*/
public class UserConsumptionRecordVo {
private Integer direction;
private Integer type;
private Integer changeNum;
private String remark;
private long createTime;
public Integer getDirection() {
return direction;
}
public void setDirection(Integer direction) {
this.direction = direction;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getChangeNum() {
return changeNum;
}
public void setChangeNum(Integer changeNum) {
this.changeNum = changeNum;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
}

View File

@ -1,5 +1,6 @@
package doctor.mapper;
import doctor.domain.entity.UserConsumptionRecordEntity;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.UserWalletEntity;
@ -18,11 +19,13 @@ import java.util.List;
public interface UserVideoMapper {
List<UserVideoCollectionEntity> findVideoCollectionList();
void cancelVideoCollection(@Param("id") Integer id);
void cancelVideoCollection(@Param("videoId") Integer videoId);
List<UserVideoBuyEntity> findUserVideoBuyList();
void deleteVideoBuy(@Param("id") Integer id);
void deleteVideoBuy(@Param("videoId") Integer videoId);
List<UserWalletEntity> findUserWallet();
List<UserConsumptionRecordEntity> findUserConsumptionRecordList();
}

View File

@ -3,6 +3,7 @@ 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;
import doctor.domain.vo.UserVideoCollectionVo;
@ -17,13 +18,17 @@ import java.util.List;
public interface UserVideoService {
void cancelVideoCollection(Integer id);
List<UserVideoBuyVo> findUserVideoBuyList();
void deleteVideoBuy(Integer id);
void deleteVideoBuy(Integer videoId);
List<UserWalletEntity> findUserWallet();
List<UserVideoCollectionVo> findVideoCollectionList();
void cancelVideoCollection(Integer userId, String sessionId, Integer videoId);
List<UserConsumptionRecordVo> findUserConsumptionRecordList();
}

View File

@ -1,8 +1,10 @@
package doctor.service.impl;
import doctor.domain.entity.UserConsumptionRecordEntity;
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;
import doctor.domain.vo.UserVideoCollectionVo;
import doctor.mapper.UserVideoMapper;
@ -33,10 +35,18 @@ public class UserVideoServiceImpl implements UserVideoService {
}
@Override
public void cancelVideoCollection(Integer id) {
userVideoMapper.cancelVideoCollection(id);
public void cancelVideoCollection(Integer userId, String sessionId, Integer videoId) {
userVideoMapper.cancelVideoCollection(videoId);
}
@Override
public List<UserConsumptionRecordVo> findUserConsumptionRecordList() {
List<UserConsumptionRecordEntity> userConsumptionRecordEntityList=userVideoMapper.findUserConsumptionRecordList();
List<UserConsumptionRecordVo> userConsumptionRecordVoList = ConvertUtil.entityToVoList(userConsumptionRecordEntityList, UserConsumptionRecordVo.class);
return userConsumptionRecordVoList;
}
@Override
public List<UserVideoBuyVo> findUserVideoBuyList() {
List<UserVideoBuyEntity> userVideoCollectionEntityList=userVideoMapper.findUserVideoBuyList();
@ -45,8 +55,8 @@ public class UserVideoServiceImpl implements UserVideoService {
}
@Override
public void deleteVideoBuy(Integer id) {
userVideoMapper.deleteVideoBuy(id);
public void deleteVideoBuy(Integer videoId) {
userVideoMapper.deleteVideoBuy(videoId);
}
@Override

View File

@ -6,12 +6,12 @@
<delete id="cancelVideoCollection">
delete
from user_video_collection
where video_id = #{id}
where video_id = #{videoId}
</delete>
<delete id="deleteVideoBuy">
delete
from user_video_buy
where video_id = #{id}
where video_id = #{videoId}
</delete>
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity">
select *
@ -25,4 +25,8 @@
select *
from user_wallet
</select>
<select id="findUserConsumptionRecordList" resultType="doctor.domain.entity.UserConsumptionRecordEntity">
select *
from user_consumption_record
</select>
</mapper>