修改:

1.添加大哥信息查询筛选接口
This commit is contained in:
2025-06-25 20:26:29 +08:00
parent 6819b6c1d4
commit 43ddab223c
9 changed files with 683 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
package com.yupi.springbootinit.controller;
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.ServerBigBrotherDTO;
import com.yupi.springbootinit.model.vo.bigbrother.ServerBigBrotherVO;
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
import com.yupi.springbootinit.service.HostInfoService;
import com.yupi.springbootinit.service.ServerBigBrotherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/*
* @author: ziin
* @date: 2025/6/25 19:22
*/
@RestController
@RequestMapping("/big-brother")
@Slf4j
@CrossOrigin
public class BigBrotherController {
@Resource
private ServerBigBrotherService bigBrotherService;
@PostMapping("page")
public BaseResponse<Page<ServerBigBrotherVO>> hostsInfo(@RequestBody ServerBigBrotherDTO serverBigBrotherDTO){
Page<ServerBigBrotherVO> conditionHosts = bigBrotherService.getConditionHosts(serverBigBrotherDTO);
return ResultUtils.success(conditionHosts);
}
}

View File

@@ -0,0 +1,19 @@
package com.yupi.springbootinit.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.springbootinit.model.dto.host.ServerBigBrotherDTO;
import com.yupi.springbootinit.model.entity.ServerBigBrother;
import com.yupi.springbootinit.model.vo.bigbrother.ServerBigBrotherVO;
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
import org.apache.ibatis.annotations.Param;
/*
* @author: ziin
* @date: 2025/6/25 19:21
*/
public interface ServerBigBrotherMapper extends BaseMapper<ServerBigBrother> {
Page<ServerBigBrotherVO> selectPageByCondition(Page<ServerBigBrotherVO> page,@Param("dto") ServerBigBrotherDTO dto);
}

View File

@@ -0,0 +1,154 @@
package com.yupi.springbootinit.model.dto.host;
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 com.fasterxml.jackson.annotation.JsonFormat;
import com.yupi.springbootinit.common.PageRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/*
* @author: ziin
* @date: 2025/6/25 19:21
*/
@ApiModel(description="server_big_brother")
@Data
@TableName(value = "server_big_brother")
public class ServerBigBrotherDTO extends PageRequest implements Serializable {
/**
* 大哥的display_id
*/
@TableField(value = "display_id")
@ApiModelProperty(value="大哥的display_id")
private String displayId;
/**
* 大哥的等级
*/
@TableField(value = "`level`")
@ApiModelProperty(value="大哥的等级最小值")
private Integer levelMin;
/**
* 大哥的等级
*/
@TableField(value = "`level`")
@ApiModelProperty(value="大哥的等级最大值")
private Integer levelMax;
/**
* 大哥打赏的金币
*/
@TableField(value = "hostcoins")
@ApiModelProperty(value="大哥打赏的金币最小值")
private Integer hostcoinsMin;
/**
* 大哥打赏的金币
*/
@TableField(value = "hostcoins")
@ApiModelProperty(value="大哥打赏的金币最大值")
private Integer hostcoinsMax;
/**
* 大哥所在的地区
*/
@TableField(value = "region")
@ApiModelProperty(value="大哥所在的地区")
private String region;
/**
* 大哥打赏的历史最高金币
*/
@TableField(value = "historic_high_coins")
@ApiModelProperty(value="大哥打赏的历史最高金币最小值")
private Integer historicHighCoinsMin;
/**
* 大哥打赏的历史最高金币
*/
@TableField(value = "historic_high_coins")
@ApiModelProperty(value="大哥打赏的历史最高金币最大值")
private Integer historicHighCoinsMax;
/**
* 大哥历史打赏金币总和
*/
@TableField(value = "total_gift_coins")
@ApiModelProperty(value="大哥历史打赏金币总和")
private Integer totalGiftCoinsMin;
/**
* 大哥历史打赏金币总和
*/
@TableField(value = "total_gift_coins")
@ApiModelProperty(value="大哥历史打赏金币总和")
private Integer totalGiftCoinsMax;
/**
* 租户 Id
*/
@TableField(value = "tenant_id")
@ApiModelProperty(value="租户 Id")
private Long tenantId;
/**
* 数据插入时间
*/
@ApiModelProperty(value = "创建时间开始(yyyy-MM-dd)", example = "2023-01-01")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTimeStart;
/**
* 数据插入时间
*/
@ApiModelProperty(value = "创建时间结束(yyyy-MM-dd)", example = "2023-01-01")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTimeEnd;
/**
* 排序规则
*/
@ApiModelProperty(value = "排序方式(asc/desc)", example = "desc")
private String sort;
/**
* 按照何种业务排序
*/
@ApiModelProperty(value = "排序字段(createTime/hostsCoins/fans等)", example = "hostsCoins")
private String sortName;
/**
* 大哥的等级
*/
@TableField(value = "`level`")
@ApiModelProperty(value="大哥的等级")
private Integer level;
/**
* 大哥打赏的历史最高金币
*/
@TableField(value = "historic_high_coins")
@ApiModelProperty(value="大哥打赏的历史最高金币")
private Integer historicHighCoins;
/**
* 大哥历史打赏金币总和
*/
@TableField(value = "total_gift_coins")
@ApiModelProperty(value="大哥历史打赏金币总和")
private Integer totalGiftCoins;
}

View File

@@ -0,0 +1,153 @@
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/6/25 19:21
*/
@ApiModel(description="server_big_brother")
@Data
@TableName(value = "server_big_brother")
public class ServerBigBrother {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value="主键id")
private Integer id;
/**
* 大哥的display_id
*/
@TableField(value = "display_id")
@ApiModelProperty(value="大哥的display_id")
private String displayId;
/**
* 大哥的用户id
*/
@TableField(value = "user_id_str")
@ApiModelProperty(value="大哥的用户id")
private String userIdStr;
/**
* 大哥的用户昵称
*/
@TableField(value = "nickname")
@ApiModelProperty(value="大哥的用户昵称")
private String nickname;
/**
* 大哥的等级
*/
@TableField(value = "`level`")
@ApiModelProperty(value="大哥的等级")
private Integer level;
/**
* 大哥打赏的金币
*/
@TableField(value = "hostcoins")
@ApiModelProperty(value="大哥打赏的金币")
private Integer hostcoins;
/**
* 大哥的粉丝数
*/
@TableField(value = "follower_count")
@ApiModelProperty(value="大哥的粉丝数")
private Integer followerCount;
/**
* 大哥的关注数
*/
@TableField(value = "following_count")
@ApiModelProperty(value="大哥的关注数")
private Integer followingCount;
/**
* 大哥所在的地区
*/
@TableField(value = "region")
@ApiModelProperty(value="大哥所在的地区")
private String region;
/**
* 大哥打赏的历史最高金币
*/
@TableField(value = "historic_high_coins")
@ApiModelProperty(value="大哥打赏的历史最高金币")
private Integer historicHighCoins;
/**
* 大哥历史打赏金币总和
*/
@TableField(value = "total_gift_coins")
@ApiModelProperty(value="大哥历史打赏金币总和")
private Integer totalGiftCoins;
/**
* 大哥所在的直播间的主播display_id
*/
@TableField(value = "host_display_id")
@ApiModelProperty(value="大哥所在的直播间的主播display_id")
private String hostDisplayId;
/**
* 该数据所属的账号id
*/
@TableField(value = "owner_id")
@ApiModelProperty(value="该数据所属的账号id")
private String ownerId;
/**
* 创建时间
*/
@TableField(value = "create_time")
@ApiModelProperty(value="创建时间")
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time")
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
* 创建人
*/
@TableField(value = "creator")
@ApiModelProperty(value="创建人")
private Long creator;
/**
* 更新人
*/
@TableField(value = "updater")
@ApiModelProperty(value="更新人")
private String updater;
/**
* 逻辑删除标志0-未删除1-已删除
*/
@TableField(value = "deleted")
@ApiModelProperty(value="逻辑删除标志0-未删除1-已删除")
private Boolean deleted;
/**
* 租户 Id
*/
@TableField(value = "tenant_id")
@ApiModelProperty(value="租户 Id")
private Long tenantId;
}

View File

@@ -0,0 +1,154 @@
package com.yupi.springbootinit.model.vo.bigbrother;
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 lombok.Data;
import java.util.Date;
/*
* @author: ziin
* @date: 2025/6/25 19:21
*/
@ApiModel(description="server_big_brother")
@Data
@TableName(value = "server_big_brother")
public class ServerBigBrotherVO {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value="主键id")
private Integer id;
/**
* 大哥的display_id
*/
@TableField(value = "display_id")
@ApiModelProperty(value="大哥的display_id")
private String displayId;
/**
* 大哥的用户id
*/
@TableField(value = "user_id_str")
@ApiModelProperty(value="大哥的用户id")
private String userIdStr;
/**
* 大哥的用户昵称
*/
@TableField(value = "nickname")
@ApiModelProperty(value="大哥的用户昵称")
private String nickname;
/**
* 大哥的等级
*/
@TableField(value = "`level`")
@ApiModelProperty(value="大哥的等级")
private Integer level;
/**
* 大哥打赏的金币
*/
@TableField(value = "hostcoins")
@ApiModelProperty(value="大哥打赏的金币")
private Integer hostcoins;
/**
* 大哥的粉丝数
*/
@TableField(value = "follower_count")
@ApiModelProperty(value="大哥的粉丝数")
private Integer followerCount;
/**
* 大哥的关注数
*/
@TableField(value = "following_count")
@ApiModelProperty(value="大哥的关注数")
private Integer followingCount;
/**
* 大哥所在的地区
*/
@TableField(value = "region")
@ApiModelProperty(value="大哥所在的地区")
private String region;
/**
* 大哥打赏的历史最高金币
*/
@TableField(value = "historic_high_coins")
@ApiModelProperty(value="大哥打赏的历史最高金币")
private Integer historicHighCoins;
/**
* 大哥历史打赏金币总和
*/
@TableField(value = "total_gift_coins")
@ApiModelProperty(value="大哥历史打赏金币总和")
private Integer totalGiftCoins;
/**
* 大哥所在的直播间的主播display_id
*/
@TableField(value = "host_display_id")
@ApiModelProperty(value="大哥所在的直播间的主播display_id")
private String hostDisplayId;
/**
* 该数据所属的账号id
*/
@TableField(value = "owner_id")
@ApiModelProperty(value="该数据所属的账号id")
private String ownerId;
/**
* 创建时间
*/
@TableField(value = "create_time")
@ApiModelProperty(value="创建时间")
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time")
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
* 创建人
*/
@TableField(value = "creator")
@ApiModelProperty(value="创建人")
private Long creator;
/**
* 更新人
*/
@TableField(value = "updater")
@ApiModelProperty(value="更新人")
private String updater;
/**
* 逻辑删除标志0-未删除1-已删除
*/
@TableField(value = "deleted")
@ApiModelProperty(value="逻辑删除标志0-未删除1-已删除")
private Boolean deleted;
/**
* 租户 Id
*/
@TableField(value = "tenant_id")
@ApiModelProperty(value="租户 Id")
private Long tenantId;
}

View File

@@ -0,0 +1,20 @@
package com.yupi.springbootinit.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.springbootinit.model.dto.host.HostInfoDTO;
import com.yupi.springbootinit.model.dto.host.ServerBigBrotherDTO;
import com.yupi.springbootinit.model.entity.ServerBigBrother;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.springbootinit.model.vo.bigbrother.ServerBigBrotherVO;
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
/*
* @author: ziin
* @date: 2025/6/25 19:21
*/
public interface ServerBigBrotherService extends IService<ServerBigBrother>{
Page<ServerBigBrotherVO> getConditionHosts(ServerBigBrotherDTO serverBigBrotherDTO);
}

View File

@@ -39,7 +39,7 @@ public class HostInfoServiceImpl extends ServiceImpl<NewHostsMapper, NewHosts> i
private NewHostsMapper newHostsMapper;
@Override
public Page<NewHostsVO> getConditionHosts(@RequestBody HostInfoDTO hostInfoDTO) {
public Page<NewHostsVO> getConditionHosts(HostInfoDTO hostInfoDTO) {
Page<NewHostsVO> page = new Page<>(hostInfoDTO.getCurrent(),hostInfoDTO.getPageSize());
return newHostsMapper.selectPageByCondition(page, hostInfoDTO);
}

View File

@@ -0,0 +1,38 @@
package com.yupi.springbootinit.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.springbootinit.model.dto.host.HostInfoDTO;
import com.yupi.springbootinit.model.dto.host.ServerBigBrotherDTO;
import com.yupi.springbootinit.model.vo.bigbrother.ServerBigBrotherVO;
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.springbootinit.mapper.ServerBigBrotherMapper;
import com.yupi.springbootinit.model.entity.ServerBigBrother;
import com.yupi.springbootinit.service.ServerBigBrotherService;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
/*
* @author: ziin
* @date: 2025/6/25 19:21
*/
@Service
public class ServerBigBrotherServiceImpl extends ServiceImpl<ServerBigBrotherMapper, ServerBigBrother> implements ServerBigBrotherService{
@Resource
private ServerBigBrotherMapper serverBigBrotherMapper;
@Override
public Page<ServerBigBrotherVO> getConditionHosts(ServerBigBrotherDTO serverBigBrotherDTO) {
Page<ServerBigBrotherVO> page = new Page<>(serverBigBrotherDTO.getCurrent(),serverBigBrotherDTO.getPageSize());
return serverBigBrotherMapper.selectPageByCondition(page, serverBigBrotherDTO);
}
}

View File

@@ -0,0 +1,108 @@
<?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.ServerBigBrotherMapper">
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.ServerBigBrother">
<!--@mbg.generated-->
<!--@Table server_big_brother-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="display_id" jdbcType="VARCHAR" property="displayId" />
<result column="user_id_str" jdbcType="VARCHAR" property="userIdStr" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="hostcoins" jdbcType="INTEGER" property="hostcoins" />
<result column="follower_count" jdbcType="INTEGER" property="followerCount" />
<result column="following_count" jdbcType="INTEGER" property="followingCount" />
<result column="region" jdbcType="VARCHAR" property="region" />
<result column="historic_high_coins" jdbcType="INTEGER" property="historicHighCoins" />
<result column="total_gift_coins" jdbcType="INTEGER" property="totalGiftCoins" />
<result column="host_display_id" jdbcType="VARCHAR" property="hostDisplayId" />
<result column="owner_id" jdbcType="VARCHAR" property="ownerId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="updater" jdbcType="VARCHAR" property="updater" />
<result column="deleted" jdbcType="BOOLEAN" property="deleted" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, display_id, user_id_str, nickname, `level`, hostcoins, follower_count, following_count,
region, historic_high_coins, total_gift_coins, host_display_id, owner_id, create_time,
update_time, creator, updater, deleted, tenant_id
</sql>
<select id="selectPageByCondition" resultType="com.yupi.springbootinit.model.vo.bigbrother.ServerBigBrotherVO">
select * from
server_big_brother sbr left join server_country_info ci ON sbr.region = ci.country_name
where sbr.tenant_id=#{dto.tenantId}
<!-- 主播国家筛选 -->
<if test="dto.region!= '' and dto.region != null">
and ci.country_group_name =#{dto.region,jdbcType=VARCHAR}
</if>
<!-- 按照入库时间筛选主播 -->
<if test="dto.createTimeStart != null and dto.createTimeEnd != null">
and sbr.create_time BETWEEN #{dto.createTimeStart,jdbcType=TIMESTAMP} and #{dto.createTimeEnd,jdbcType=TIMESTAMP}
</if>
<!-- 主播 Id 模糊搜索 -->
<if test="dto.displayId != null and dto.displayId != '' ">
and sbr.display_id like concat(#{dto.displayId,jdbcType=VARCHAR},'%')
</if>
<!-- 今日主播金币筛选 -->
<if test="dto.hostcoinsMin != null and dto.hostcoinsMax == null and dto.hostcoinsMax != '' ">
and sbr.hostcoins >=#{dto.hostcoinsMin,jdbcType=INTEGER}
</if>
<if test="dto.hostcoinsMax != null and dto.hostcoinsMin == null and dto.hostcoinsMin !='' ">
and sbr.hostcoins &lt;=#{dto.hostcoinsMax,jdbcType=INTEGER}
</if>
<if test="dto.hostcoinsMin != null and dto.hostcoinsMax != null " >
and sbr.hostcoins between #{dto.hostcoinsMin,jdbcType=INTEGER} and #{dto.hostcoinsMax,jdbcType=INTEGER}
</if>
<!-- 昨日主播金币筛选 -->
<if test="dto.totalGiftCoinsMin != null and dto.totalGiftCoinsMax == null and dto.totalGiftCoinsMax != ''">
and sbr.total_gift_coins >=#{dto.totalGiftCoinsMin,jdbcType=INTEGER}
</if>
<if test="dto.totalGiftCoinsMax != null and dto.totalGiftCoinsMin == null and dto.totalGiftCoinsMin != '' ">
and sbr.total_gift_coins &lt;=#{dto.totalGiftCoinsMax,jdbcType=INTEGER}
</if>
<if test="dto.totalGiftCoinsMin != null and dto.totalGiftCoinsMax != null " >
and sbr.total_gift_coins between #{dto.totalGiftCoinsMin,jdbcType=INTEGER} and #{dto.totalGiftCoinsMax,jdbcType=INTEGER}
</if>
<!-- 主播粉丝数筛选-->
<if test="dto.levelMin != null and dto.levelMax == null and dto.levelMax != ''">
and sbr.level >=#{dto.levelMin,jdbcType=INTEGER}
</if>
<if test="dto.levelMax != null and dto.levelMin == null and dto.levelMin != '' ">
and sbr.level &lt;=#{dto.levelMax,jdbcType=INTEGER}
</if>
<if test="dto.levelMin != null and dto.levelMax != null " >
and sbr.level between #{dto.levelMin,jdbcType=INTEGER} and #{dto.levelMax,jdbcType=INTEGER}
</if>
<!-- 排序类型 -->
order by
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="dto.sortName == '' and dto.sortName == null">
sbr.create_time desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="dto.sortName != null and dto.sort != null ">
<if test="dto.sortName == 'createTime' and dto.sort != null">
sbr.create_time ${dto.sort}
</if>
<!-- 昨日主播金币条件排序 -->
<if test="dto.sortName == 'level' and dto.sort != null">
sbr.level ${dto.sort}
</if>
<!-- 主播金币条件排序 -->
<if test="dto.sortName == 'historicHighCoins' and dto.sort != null">
sbr.historic_high_coins ${dto.sort}
</if>
<!-- 主播粉丝条件排序 -->
<if test="dto.sortName == 'totalGiftCoins' and dto.sort != null">
sbr.total_gift_coins ${dto.sort}
</if>
</when>
</choose>
</select>
</mapper>