feat(host): 新增主播直播明细查询接口
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -145,3 +145,5 @@ fabric.properties
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
/CLAUDE.md
|
||||
/API_USAGE.md
|
||||
|
||||
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yupi.springbootinit.common.BaseResponse;
|
||||
import com.yupi.springbootinit.common.ResultUtils;
|
||||
import com.yupi.springbootinit.model.dto.host.HostInfoDTO;
|
||||
import com.yupi.springbootinit.model.dto.host.ServerLiveHostDetailDTO;
|
||||
import com.yupi.springbootinit.model.entity.NewHosts;
|
||||
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
|
||||
import com.yupi.springbootinit.model.vo.hosts.ServerLiveHostDetailVO;
|
||||
import com.yupi.springbootinit.service.HostInfoService;
|
||||
import com.yupi.springbootinit.service.ServerLiveHostDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -27,6 +30,9 @@ public class HostInfoController {
|
||||
@Resource
|
||||
private HostInfoService hostInfoService;
|
||||
|
||||
@Resource
|
||||
private ServerLiveHostDetailService serverLiveHostDetailService;
|
||||
|
||||
@PostMapping("hosts_info")
|
||||
public BaseResponse<Page<NewHostsVO>> hostsInfo(@RequestBody HostInfoDTO hostInfoDTO){
|
||||
Page<NewHostsVO> conditionHosts = hostInfoService.getConditionHosts(hostInfoDTO);
|
||||
@@ -46,4 +52,16 @@ public class HostInfoController {
|
||||
return ResultUtils.success(b);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主播ID和租户ID查询直播明细
|
||||
* @param detailDTO 查询条件(包含hostsId和tenantId)
|
||||
* @return 所有直播明细数据
|
||||
*/
|
||||
@PostMapping("/live_host_detail")
|
||||
public BaseResponse<List<ServerLiveHostDetailVO>> getLiveHostDetail(@RequestBody ServerLiveHostDetailDTO detailDTO){
|
||||
log.info("查询直播明细,hostsId: {}, tenantId: {}", detailDTO.getHostsId(), detailDTO.getTenantId());
|
||||
List<ServerLiveHostDetailVO> result = serverLiveHostDetailService.getLiveHostDetailByHostsIdAndTenantId(detailDTO);
|
||||
return ResultUtils.success(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yupi.springbootinit.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yupi.springbootinit.model.entity.ServerLiveHostDetail;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/18 19:29
|
||||
*/
|
||||
|
||||
public interface ServerLiveHostDetailMapper extends BaseMapper<ServerLiveHostDetail> {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yupi.springbootinit.model.dto.host;
|
||||
|
||||
import com.yupi.springbootinit.common.PageRequest;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/18
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("主播直播明细查询DTO")
|
||||
public class ServerLiveHostDetailDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 主播id
|
||||
*/
|
||||
@ApiModelProperty(value = "主播ID", required = true, example = "host123")
|
||||
private String hostsId;
|
||||
|
||||
/**
|
||||
* 租户 Id
|
||||
*/
|
||||
@ApiModelProperty(value = "租户ID", required = true, example = "1001")
|
||||
private Long tenantId;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.yupi.springbootinit.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/18 19:29
|
||||
*/
|
||||
|
||||
/**
|
||||
* 主播单场直播明细表
|
||||
*/
|
||||
@ApiModel(description="主播单场直播明细表")
|
||||
@Data
|
||||
@TableName(value = "server_live_host_detail")
|
||||
public class ServerLiveHostDetail {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value="主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前用户标识
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
@ApiModelProperty(value="当前用户标识")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 主播名称
|
||||
*/
|
||||
@TableField(value = "hosts_id")
|
||||
@ApiModelProperty(value="主播名称")
|
||||
private String hostsId;
|
||||
|
||||
/**
|
||||
* 粉丝团人数
|
||||
*/
|
||||
@TableField(value = "fans_club_count")
|
||||
@ApiModelProperty(value="粉丝团人数")
|
||||
private Integer fansClubCount;
|
||||
|
||||
/**
|
||||
* 礼物之比
|
||||
*/
|
||||
@TableField(value = "lighted_vs_total_gifts")
|
||||
@ApiModelProperty(value="礼物之比")
|
||||
private String lightedVsTotalGifts;
|
||||
|
||||
/**
|
||||
* 直播开始时间(格式化)
|
||||
*/
|
||||
@TableField(value = "start_time_formatted")
|
||||
@ApiModelProperty(value="直播开始时间(格式化)")
|
||||
private Date startTimeFormatted;
|
||||
|
||||
/**
|
||||
* 直播结束时间(格式化)
|
||||
*/
|
||||
@TableField(value = "end_time_formatted")
|
||||
@ApiModelProperty(value="直播结束时间(格式化)")
|
||||
private Date endTimeFormatted;
|
||||
|
||||
/**
|
||||
* 获得的点赞数量
|
||||
*/
|
||||
@TableField(value = "like_count")
|
||||
@ApiModelProperty(value="获得的点赞数量")
|
||||
private Integer likeCount;
|
||||
|
||||
/**
|
||||
* 持续时间(格式化)
|
||||
*/
|
||||
@TableField(value = "duration_formatted")
|
||||
@ApiModelProperty(value="持续时间(格式化)")
|
||||
private String durationFormatted;
|
||||
|
||||
/**
|
||||
* 记录创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
@ApiModelProperty(value="记录创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 记录更新时间
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
@ApiModelProperty(value="记录更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 租户 Id
|
||||
*/
|
||||
@TableField(value = "tenant_id")
|
||||
@ApiModelProperty(value="租户 Id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableField(value = "deleted")
|
||||
@ApiModelProperty(value="是否删除")
|
||||
private Byte deleted;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(value = "updater")
|
||||
@ApiModelProperty(value="更新人")
|
||||
private String updater;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(value = "creator")
|
||||
@ApiModelProperty(value="创建人")
|
||||
private String creator;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.yupi.springbootinit.model.vo.hosts;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/18
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("主播直播明细VO")
|
||||
public class ServerLiveHostDetailVO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前用户标识
|
||||
*/
|
||||
@ApiModelProperty(value = "当前用户标识")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 主播名称
|
||||
*/
|
||||
@ApiModelProperty(value = "主播ID")
|
||||
private String hostsId;
|
||||
|
||||
/**
|
||||
* 粉丝团人数
|
||||
*/
|
||||
@ApiModelProperty(value = "粉丝团人数")
|
||||
private Integer fansClubCount;
|
||||
|
||||
/**
|
||||
* 礼物之比
|
||||
*/
|
||||
@ApiModelProperty(value = "礼物之比")
|
||||
private String lightedVsTotalGifts;
|
||||
|
||||
/**
|
||||
* 直播开始时间(格式化)
|
||||
*/
|
||||
@ApiModelProperty(value = "直播开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date startTimeFormatted;
|
||||
|
||||
/**
|
||||
* 直播结束时间(格式化)
|
||||
*/
|
||||
@ApiModelProperty(value = "直播结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTimeFormatted;
|
||||
|
||||
/**
|
||||
* 获得的点赞数量
|
||||
*/
|
||||
@ApiModelProperty(value = "获得的点赞数量")
|
||||
private Integer likeCount;
|
||||
|
||||
/**
|
||||
* 持续时间(格式化)
|
||||
*/
|
||||
@ApiModelProperty(value = "持续时间")
|
||||
private String durationFormatted;
|
||||
|
||||
/**
|
||||
* 记录创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "记录创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 租户 Id
|
||||
*/
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yupi.springbootinit.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yupi.springbootinit.model.dto.host.ServerLiveHostDetailDTO;
|
||||
import com.yupi.springbootinit.model.entity.ServerLiveHostDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yupi.springbootinit.model.vo.hosts.ServerLiveHostDetailVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/18 19:29
|
||||
*/
|
||||
|
||||
public interface ServerLiveHostDetailService extends IService<ServerLiveHostDetail>{
|
||||
|
||||
/**
|
||||
* 根据主播ID和租户ID查询直播明细
|
||||
* @param detailDTO 查询条件
|
||||
* @return 所有直播明细数据
|
||||
*/
|
||||
List<ServerLiveHostDetailVO> getLiveHostDetailByHostsIdAndTenantId(ServerLiveHostDetailDTO detailDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.yupi.springbootinit.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yupi.springbootinit.model.dto.host.ServerLiveHostDetailDTO;
|
||||
import com.yupi.springbootinit.model.entity.ServerLiveHostDetail;
|
||||
import com.yupi.springbootinit.mapper.ServerLiveHostDetailMapper;
|
||||
import com.yupi.springbootinit.model.vo.hosts.ServerLiveHostDetailVO;
|
||||
import com.yupi.springbootinit.service.ServerLiveHostDetailService;
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/18 19:29
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class ServerLiveHostDetailServiceImpl extends ServiceImpl<ServerLiveHostDetailMapper, ServerLiveHostDetail> implements ServerLiveHostDetailService{
|
||||
|
||||
@Override
|
||||
public List<ServerLiveHostDetailVO> getLiveHostDetailByHostsIdAndTenantId(ServerLiveHostDetailDTO detailDTO) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<ServerLiveHostDetail> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("hosts_id", detailDTO.getHostsId())
|
||||
.eq("tenant_id", detailDTO.getTenantId())
|
||||
.orderByDesc("start_time_formatted");
|
||||
|
||||
// 查询所有数据
|
||||
List<ServerLiveHostDetail> list = this.list(queryWrapper);
|
||||
|
||||
// 转换为VO
|
||||
return BeanUtil.copyToList(list, ServerLiveHostDetailVO.class);
|
||||
}
|
||||
|
||||
}
|
||||
29
src/main/resources/mapper/ServerLiveHostDetailMapper.xml
Normal file
29
src/main/resources/mapper/ServerLiveHostDetailMapper.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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="com.yupi.springbootinit.mapper.ServerLiveHostDetailMapper">
|
||||
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.ServerLiveHostDetail">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table server_live_host_detail-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="user_id" jdbcType="BIGINT" property="userId" />
|
||||
<result column="hosts_id" jdbcType="VARCHAR" property="hostsId" />
|
||||
<result column="fans_club_count" jdbcType="INTEGER" property="fansClubCount" />
|
||||
<result column="lighted_vs_total_gifts" jdbcType="VARCHAR" property="lightedVsTotalGifts" />
|
||||
<result column="start_time_formatted" jdbcType="TIMESTAMP" property="startTimeFormatted" />
|
||||
<result column="end_time_formatted" jdbcType="TIMESTAMP" property="endTimeFormatted" />
|
||||
<result column="like_count" jdbcType="INTEGER" property="likeCount" />
|
||||
<result column="duration_formatted" jdbcType="VARCHAR" property="durationFormatted" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="deleted" jdbcType="TINYINT" property="deleted" />
|
||||
<result column="updater" jdbcType="VARCHAR" property="updater" />
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, user_id, hosts_id, fans_club_count, lighted_vs_total_gifts, start_time_formatted,
|
||||
end_time_formatted, like_count, duration_formatted, create_time, update_time, tenant_id,
|
||||
deleted, updater, creator
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user