后台接口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 Integer weight;
private String invitationCode; private String invitationCode;
private Date updateTime; private Date updateTime;
private Long createTime; private long createTime;
public Integer getId() { public Integer getId() {
return id; return id;

View File

@ -2,6 +2,7 @@ package doctor.controller;
import doctor.common.core.domain.HealthR; import doctor.common.core.domain.HealthR;
import doctor.domain.entity.UserWalletEntity; import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo; import doctor.domain.vo.UserVideoBuyVo;
import doctor.domain.vo.UserVideoCollectionVo; import doctor.domain.vo.UserVideoCollectionVo;
import doctor.service.UserVideoService; import doctor.service.UserVideoService;
@ -33,9 +34,9 @@ public class UserVideoController {
return HealthR.ok(userVideoCollectionVos); return HealthR.ok(userVideoCollectionVos);
} }
//用户取消视频收藏 //用户取消视频收藏
@GetMapping("/cancelVideoCollection/{id}") @DeleteMapping("/cancelVideoCollection")
public HealthR cancelVideoCollection(@PathVariable Integer id){ public HealthR cancelVideoCollection(@RequestHeader Integer userId,@RequestHeader String sessionId,@RequestParam Integer videoId ){
userVideoService.cancelVideoCollection(id); userVideoService.cancelVideoCollection(userId,sessionId,videoId);
return HealthR.ok(); return HealthR.ok();
} }
//用户购买视频列表 //用户购买视频列表
@ -46,9 +47,9 @@ public class UserVideoController {
return HealthR.ok(userVideoCollectionVos); return HealthR.ok(userVideoCollectionVos);
} }
//用户删除购买的视频 //用户删除购买的视频
@DeleteMapping("/deleteVideoBuy/{id}") @DeleteMapping("/deleteVideoBuy/{videoId}")
public HealthR deleteVideoBuy(@PathVariable Integer id){ public HealthR deleteVideoBuy(@PathVariable Integer videoId){
userVideoService.deleteVideoBuy(id); userVideoService.deleteVideoBuy(videoId);
return HealthR.ok(); return HealthR.ok();
} }
@ -58,6 +59,13 @@ public class UserVideoController {
List<UserWalletEntity> userWallets = userVideoService.findUserWallet(); List<UserWalletEntity> userWallets = userVideoService.findUserWallet();
return HealthR.ok(userWallets); 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; package doctor.domain.entity;
import java.util.Date;
/** /**
* @ClassName : UserVideoCollectionEntity * @ClassName : UserVideoCollectionEntity
* @Description : * @Description :
@ -11,7 +13,7 @@ public class UserVideoCollectionEntity {
private Integer id; private Integer id;
private Integer userId; private Integer userId;
private Integer videoId; private Integer videoId;
private Long createTime; private Date createTime;
public Integer getId() { public Integer getId() {
return id; return id;
@ -37,21 +39,13 @@ public class UserVideoCollectionEntity {
this.videoId = videoId; this.videoId = videoId;
} }
public Long getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Long createTime) { public void setCreateTime(Date createTime) {
this.createTime = 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; package doctor.mapper;
import doctor.domain.entity.UserConsumptionRecordEntity;
import doctor.domain.entity.UserVideoBuyEntity; import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity; import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.UserWalletEntity; import doctor.domain.entity.UserWalletEntity;
@ -18,11 +19,13 @@ import java.util.List;
public interface UserVideoMapper { public interface UserVideoMapper {
List<UserVideoCollectionEntity> findVideoCollectionList(); List<UserVideoCollectionEntity> findVideoCollectionList();
void cancelVideoCollection(@Param("id") Integer id); void cancelVideoCollection(@Param("videoId") Integer videoId);
List<UserVideoBuyEntity> findUserVideoBuyList(); List<UserVideoBuyEntity> findUserVideoBuyList();
void deleteVideoBuy(@Param("id") Integer id); void deleteVideoBuy(@Param("videoId") Integer videoId);
List<UserWalletEntity> findUserWallet(); List<UserWalletEntity> findUserWallet();
List<UserConsumptionRecordEntity> findUserConsumptionRecordList();
} }

View File

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

View File

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

View File

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