主播数据查询接口实现

This commit is contained in:
2025-06-12 19:43:16 +08:00
parent 97e1427303
commit c6382e3283
10 changed files with 235 additions and 35 deletions

View File

@@ -20,6 +20,23 @@
<result column="updater" jdbcType="VARCHAR" property="updater" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<resultMap id="HostInfoVo" type="com.yupi.springbootinit.model.vo.hosts.NewHostsVO">
<!--@mbg.generated-->
<!--@Table new_hosts-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="hosts_id" jdbcType="VARCHAR" property="hostsId" />
<result column="hosts_level" jdbcType="VARCHAR" property="hostsLevel" />
<result column="hosts_coins" jdbcType="INTEGER" property="hostsCoins" />
<result column="Invitation_type" jdbcType="INTEGER" property="invitationType" />
<result column="fans" jdbcType="INTEGER" property="fans" />
<result column="fllowernum" jdbcType="INTEGER" property="fllowernum" />
<result column="yesterday_coins" jdbcType="INTEGER" property="yesterdayCoins" />
<result column="country" jdbcType="VARCHAR" property="country" />
<result column="hosts_kind" jdbcType="VARCHAR" property="hostsKind" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum, yesterday_coins,
@@ -222,4 +239,91 @@
#{item.tenantId,jdbcType=BIGINT}, #{item.creator,jdbcType=INTEGER})
</foreach>
</insert>
<select id="selectPageByCondition" resultMap="HostInfoVo">
select id,hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum,
yesterday_coins,create_time, country, hosts_kind from new_hosts where
new_hosts.creator=#{hostInfoDTO.creator}
and new_hosts.tenant_id=#{hostInfoDTO.tenantId}
<if test="hostInfoDTO.country!= '' and hostInfoDTO.country != null">
and new_hosts.country =#{hostInfoDTO.country,jdbcType=VARCHAR}
</if>
<if test="hostInfoDTO.createTime != null">
and DATE(new_hosts.create_time) =#{hostInfoDTO.createTime}
</if>
<if test="hostInfoDTO.hostsId != '' and hostInfoDTO.hostsId != null ">
and new_hosts.hosts_id =#{hostInfoDTO.hostsId,jdbcType=VARCHAR}
</if>
<!-- 今日主播金币筛选 -->
<if test="hostInfoDTO.hostsCoinsMin != null and hostInfoDTO.hostsCoinsMax == null ">
and new_hosts.hosts_coins >=#{hostInfoDTO.hostsCoinsMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.hostsCoinsMax != null and hostInfoDTO.hostsCoinsMin == null ">
and new_hosts.hosts_coins &lt;=#{hostInfoDTO.hostsCoinsMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.hostsCoinsMin != null and hostInfoDTO.hostsCoinsMax != null " >
and new_hosts.hosts_coins between #{hostInfoDTO.hostsCoinsMin,jdbcType=INTEGER} and #{hostInfoDTO.hostsCoinsMax,jdbcType=INTEGER}
</if>
<!-- 昨日主播金币筛选 -->
<if test="hostInfoDTO.yesterdayCoinsMin != null and hostInfoDTO.yesterdayCoinsMax == null ">
and new_hosts.yesterday_coins >=#{hostInfoDTO.yesterdayCoinsMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.yesterdayCoinsMax != null and hostInfoDTO.yesterdayCoinsMin == null ">
and new_hosts.yesterday_coins &lt;=#{hostInfoDTO.yesterdayCoinsMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.yesterdayCoinsMin != null and hostInfoDTO.yesterdayCoinsMax != null " >
and new_hosts.yesterday_coins between #{hostInfoDTO.yesterdayCoinsMin,jdbcType=INTEGER} and #{hostInfoDTO.yesterdayCoinsMax,jdbcType=INTEGER}
</if>
<!-- 主播粉丝数筛选-->
<if test="hostInfoDTO.fansMin != null and hostInfoDTO.fansMax == null ">
and new_hosts.fans >=#{hostInfoDTO.fansMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fansMax != null and hostInfoDTO.fansMin == null ">
and new_hosts.fans &lt;=#{hostInfoDTO.yesterdayCoinsMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fansMin != null and hostInfoDTO.fansMax != null " >
and new_hosts.fans between #{hostInfoDTO.fansMin,jdbcType=INTEGER} and #{hostInfoDTO.fansMax,jdbcType=INTEGER}
</if>
<!-- 主播粉关注筛选-->
<if test="hostInfoDTO.fllowernumMin != null and hostInfoDTO.fllowernumMax == null ">
and new_hosts.fllowernum >=#{hostInfoDTO.fllowernumMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fllowernumMax != null and hostInfoDTO.fllowernumMin == null ">
and new_hosts.fllowernum &lt;=#{hostInfoDTO.fllowernumMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fllowernumMin != null and hostInfoDTO.fllowernumMax != null " >
and new_hosts.fllowernum between #{hostInfoDTO.fllowernumMin,jdbcType=INTEGER} and #{hostInfoDTO.fllowernumMax,jdbcType=INTEGER}
</if>
<!-- 邀请类筛选 -->
<if test="hostInfoDTO.invitationType != null">
and new_hosts.Invitation_type =#{hostInfoDTO.invitationType,jdbcType=INTEGER}
</if>
<!-- 排序类型 -->
order by
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="hostInfoDTO.sortName == '' or hostInfoDTO.sortName == null ">
new_hosts.create_time desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="hostInfoDTO.sortName != null and hostInfoDTO.sort != null ">
<!-- 昨日主播金币条件排序 -->
<if test="hostInfoDTO.sortName == 'yesterdayCoins' and hostInfoDTO.sort != null">
new_hosts.yesterday_coins ${hostInfoDTO.sort}
</if>
<!-- 主播金币条件排序 -->
<if test="hostInfoDTO.sortName == 'hostsCoins' and hostInfoDTO.sort != null">
new_hosts.hostsCoins ${hostInfoDTO.sort}
</if>
<!-- 主播粉丝条件排序 -->
<if test="hostInfoDTO.sortName == 'fans' and hostInfoDTO.sort != null">
new_hosts.fans ${hostInfoDTO.sort}
</if>
<!-- 主播关注数量排序 -->
<if test="hostInfoDTO.sortName == 'fllowernum' and hostInfoDTO.sort != null">
new_hosts.fllowernum ${hostInfoDTO.sort}
</if>
</when>
</choose>
</select>
</mapper>