348 lines
15 KiB
XML
348 lines
15 KiB
XML
<?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.NewHostsMapper">
|
|
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.NewHosts">
|
|
<!--@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="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
|
<result column="creator" jdbcType="BIGINT" property="creator" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="updater" jdbcType="VARCHAR" property="updater" />
|
|
<result column="online_fans" jdbcType="INTEGER" property="onlineFans"/>
|
|
<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="online_fans" jdbcType="INTEGER" property="onlineFans"/>
|
|
<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,
|
|
country, hosts_kind, tenant_id, creator, create_time, updater, update_time
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
<!--@mbg.generated-->
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from new_hosts
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
|
<!--@mbg.generated-->
|
|
delete from new_hosts
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</delete>
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yupi.springbootinit.model.entity.NewHosts" useGeneratedKeys="true">
|
|
<!--@mbg.generated-->
|
|
insert into new_hosts (hosts_id, hosts_level, hosts_coins,
|
|
Invitation_type, fans, fllowernum,
|
|
yesterday_coins, country, hosts_kind,
|
|
tenant_id, creator
|
|
)
|
|
values (#{hostsId,jdbcType=VARCHAR}, #{hostsLevel,jdbcType=VARCHAR}, #{hostsCoins,jdbcType=INTEGER},
|
|
#{invitationType,jdbcType=INTEGER}, #{fans,jdbcType=INTEGER}, #{fllowernum,jdbcType=INTEGER},
|
|
#{yesterdayCoins,jdbcType=INTEGER}, #{country,jdbcType=VARCHAR}, #{hostsKind,jdbcType=VARCHAR},
|
|
#{tenantId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT})
|
|
</insert>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yupi.springbootinit.model.entity.NewHosts" useGeneratedKeys="true">
|
|
<!--@mbg.generated-->
|
|
insert into new_hosts
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="hostsId != null">
|
|
hosts_id,
|
|
</if>
|
|
<if test="hostsLevel != null">
|
|
hosts_level,
|
|
</if>
|
|
<if test="hostsCoins != null">
|
|
hosts_coins,
|
|
</if>
|
|
<if test="invitationType != null">
|
|
Invitation_type,
|
|
</if>
|
|
<if test="fans != null">
|
|
fans,
|
|
</if>
|
|
<if test="fllowernum != null">
|
|
fllowernum,
|
|
</if>
|
|
<if test="yesterdayCoins != null">
|
|
yesterday_coins,
|
|
</if>
|
|
<if test="country != null">
|
|
country,
|
|
</if>
|
|
<if test="hostsKind != null">
|
|
hosts_kind,
|
|
</if>
|
|
<if test="tenantId != null">
|
|
tenant_id,
|
|
</if>
|
|
<if test="creator != null">
|
|
creator,
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="updater != null">
|
|
updater,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="hostsId != null">
|
|
#{hostsId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="hostsLevel != null">
|
|
#{hostsLevel,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="hostsCoins != null">
|
|
#{hostsCoins,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="invitationType != null">
|
|
#{invitationType,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="fans != null">
|
|
#{fans,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="fllowernum != null">
|
|
#{fllowernum,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="yesterdayCoins != null">
|
|
#{yesterdayCoins,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="country != null">
|
|
#{country,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="hostsKind != null">
|
|
#{hostsKind,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="tenantId != null">
|
|
#{tenantId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="creator != null">
|
|
#{creator,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updater != null">
|
|
#{updater,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.yupi.springbootinit.model.entity.NewHosts">
|
|
<!--@mbg.generated-->
|
|
update new_hosts
|
|
<set>
|
|
<if test="hostsId != null">
|
|
hosts_id = #{hostsId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="hostsLevel != null">
|
|
hosts_level = #{hostsLevel,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="hostsCoins != null">
|
|
hosts_coins = #{hostsCoins,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="invitationType != null">
|
|
Invitation_type = #{invitationType,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="fans != null">
|
|
fans = #{fans,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="fllowernum != null">
|
|
fllowernum = #{fllowernum,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="yesterdayCoins != null">
|
|
yesterday_coins = #{yesterdayCoins,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="country != null">
|
|
country = #{country,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="hostsKind != null">
|
|
hosts_kind = #{hostsKind,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="tenantId != null">
|
|
tenant_id = #{tenantId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="creator != null">
|
|
creator = #{creator,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updater != null">
|
|
updater = #{updater,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.yupi.springbootinit.model.entity.NewHosts">
|
|
<!--@mbg.generated-->
|
|
update new_hosts
|
|
set hosts_id = #{hostsId,jdbcType=VARCHAR},
|
|
hosts_level = #{hostsLevel,jdbcType=VARCHAR},
|
|
hosts_coins = #{hostsCoins,jdbcType=INTEGER},
|
|
Invitation_type = #{invitationType,jdbcType=INTEGER},
|
|
fans = #{fans,jdbcType=INTEGER},
|
|
fllowernum = #{fllowernum,jdbcType=INTEGER},
|
|
yesterday_coins = #{yesterdayCoins,jdbcType=INTEGER},
|
|
country = #{country,jdbcType=VARCHAR},
|
|
hosts_kind = #{hostsKind,jdbcType=VARCHAR},
|
|
tenant_id = #{tenantId,jdbcType=BIGINT},
|
|
creator = #{creator,jdbcType=INTEGER},
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
updater = #{updater,jdbcType=VARCHAR},
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</update>
|
|
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map">
|
|
<!--@mbg.generated-->
|
|
insert into new_hosts
|
|
(hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum, yesterday_coins,
|
|
country, hosts_kind, tenant_id, creator)
|
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.hostsId,jdbcType=VARCHAR}, #{item.hostsLevel,jdbcType=VARCHAR}, #{item.hostsCoins,jdbcType=INTEGER},
|
|
#{item.invitationType,jdbcType=INTEGER}, #{item.fans,jdbcType=INTEGER}, #{item.fllowernum,jdbcType=INTEGER},
|
|
#{item.yesterdayCoins,jdbcType=INTEGER}, #{item.country,jdbcType=VARCHAR}, #{item.hostsKind,jdbcType=VARCHAR},
|
|
#{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, online_fans,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>
|
|
<!-- 主播 Id 模糊搜索 -->
|
|
<if test="hostInfoDTO.hostsId != '' and hostInfoDTO.hostsId != null ">
|
|
and new_hosts.hosts_id like concat(#{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 <=#{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 <=#{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 <=#{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 <=#{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.onlineFansMin != null and hostInfoDTO.onlineFansMax == null ">
|
|
and new_hosts.online_fans >=#{hostInfoDTO.onlineFansMin,jdbcType=INTEGER}
|
|
</if>
|
|
<if test="hostInfoDTO.onlineFansMax != null and hostInfoDTO.onlineFansMin == null ">
|
|
and new_hosts.online_fans <=#{hostInfoDTO.onlineFansMax,jdbcType=INTEGER}
|
|
</if>
|
|
<if test="hostInfoDTO.onlineFansMin != null and hostInfoDTO.onlineFansMax != null " >
|
|
and new_hosts.online_fans between #{hostInfoDTO.onlineFansMin,jdbcType=INTEGER} and #{hostInfoDTO.onlineFansMax,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 == '' and 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.hosts_coins ${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>
|
|
<!-- 主播直播间在线数量排序 -->
|
|
<if test="hostInfoDTO.sortName == 'onlineFans' and hostInfoDTO.sort != null">
|
|
new_hosts.online_fnas ${hostInfoDTO.sort}
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
</select>
|
|
</mapper> |