2025-06-17 20:59:52 +08:00
|
|
|
|
<?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="cn.iocoder.yudao.module.tkdata.dal.mysql.employeehosts.EmployeeHostsMapper">
|
|
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
|
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
|
|
|
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
|
|
|
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
|
|
|
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 使用 IGNORE 关键字忽略重复插入 -->
|
2025-09-09 20:31:28 +08:00
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
|
|
id,
|
|
|
|
|
|
hosts_id,
|
|
|
|
|
|
user_id,
|
|
|
|
|
|
hosts_level,
|
|
|
|
|
|
hosts_coins,
|
|
|
|
|
|
invitation_type,
|
|
|
|
|
|
online_fans,
|
|
|
|
|
|
fans,
|
|
|
|
|
|
fllowernum,
|
|
|
|
|
|
yesterday_coins,
|
|
|
|
|
|
country,
|
|
|
|
|
|
hosts_kind,
|
|
|
|
|
|
operation_status,
|
|
|
|
|
|
remake,
|
|
|
|
|
|
`uid`,
|
|
|
|
|
|
tenant_id,
|
|
|
|
|
|
flag,
|
|
|
|
|
|
create_time,
|
|
|
|
|
|
update_time,
|
|
|
|
|
|
creator,
|
|
|
|
|
|
updater,
|
|
|
|
|
|
deleted
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tkdata.dal.dataobject.employeehosts.EmployeeHostsDO">
|
|
|
|
|
|
<result column="id" property="id"/>
|
|
|
|
|
|
<result column="hosts_id" property="hostsId"/>
|
|
|
|
|
|
<result column="user_id" property="userId"/>
|
|
|
|
|
|
<result column="hosts_level" property="hostsLevel"/>
|
|
|
|
|
|
<result column="hosts_coins" property="hostsCoins"/>
|
|
|
|
|
|
<result column="invitation_type" property="invitationType"/>
|
|
|
|
|
|
<result column="online_fans" property="onlineFans"/>
|
|
|
|
|
|
<result column="fans" property="fans"/>
|
|
|
|
|
|
<result column="fllowernum" property="fllowernum"/>
|
|
|
|
|
|
<result column="yesterday_coins" property="yesterdayCoins"/>
|
|
|
|
|
|
<result column="country" property="country"/>
|
|
|
|
|
|
<result column="hosts_kind" property="hostsKind"/>
|
|
|
|
|
|
<result column="operation_status" property="operationStatus"/>
|
|
|
|
|
|
<result column="remake" property="remake"/>
|
|
|
|
|
|
<result column="uid" property="uid"/>
|
|
|
|
|
|
<result column="tenant_id" property="tenantId"/>
|
|
|
|
|
|
<result column="flag" property="flag"/>
|
|
|
|
|
|
<result column="create_time" property="createTime"/>
|
|
|
|
|
|
<result column="update_time" property="updateTime"/>
|
|
|
|
|
|
<result column="creator" property="creator"/>
|
|
|
|
|
|
<result column="updater" property="updater"/>
|
|
|
|
|
|
<result column="deleted" property="deleted"/>
|
|
|
|
|
|
</resultMap>
|
2025-06-17 20:59:52 +08:00
|
|
|
|
<insert id="insertIgnore" parameterType="cn.iocoder.yudao.module.tkdata.dal.dataobject.employeehosts.EmployeeHostsDO">
|
|
|
|
|
|
INSERT IGNORE INTO server_employee_hosts
|
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<if test="hostsId != null">hosts_id,</if>
|
|
|
|
|
|
<if test="userId != null">user_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="onlineFans != null">online_fans,</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="operationStatus != null">operation_status,</if>
|
|
|
|
|
|
<if test="hostsKind != null">hosts_kind</if>
|
|
|
|
|
|
</trim>
|
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<if test="hostsId != null">#{hostsId},</if>
|
|
|
|
|
|
<if test="userId != null">#{userId},</if>
|
|
|
|
|
|
<if test="hostsLevel != null">#{hostsLevel},</if>
|
|
|
|
|
|
<if test="hostsCoins != null">#{hostsCoins},</if>
|
|
|
|
|
|
<if test="invitationType != null">#{invitationType},</if>
|
|
|
|
|
|
<if test="onlineFans != null">#{onlineFans},</if>
|
|
|
|
|
|
<if test="fans != null">#{fans},</if>
|
|
|
|
|
|
<if test="fllowernum != null">#{fllowernum},</if>
|
|
|
|
|
|
<if test="yesterdayCoins != null">#{yesterdayCoins},</if>
|
|
|
|
|
|
<if test="country != null">#{country},</if>
|
|
|
|
|
|
<if test="operationStatus != null">#{operationStatus},</if>
|
|
|
|
|
|
<if test="hostsKind != null">#{hostsKind}</if>
|
|
|
|
|
|
</trim>
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 批量插入忽略重复 -->
|
|
|
|
|
|
<insert id="batchInsertIgnore" parameterType="java.util.List">
|
|
|
|
|
|
INSERT IGNORE INTO server_employee_hosts
|
|
|
|
|
|
(hosts_id, user_id, hosts_level, hosts_coins, Invitation_type,
|
|
|
|
|
|
online_fans, fans, fllowernum, yesterday_coins, country,
|
|
|
|
|
|
operation_status, hosts_kind)
|
|
|
|
|
|
VALUES
|
|
|
|
|
|
<foreach collection="list" item="item" separator=",">
|
|
|
|
|
|
(#{item.hostsId}, #{item.userId}, #{item.hostsLevel}, #{item.hostsCoins}, #{item.invitationType},
|
|
|
|
|
|
#{item.onlineFans}, #{item.fans}, #{item.fllowernum}, #{item.yesterdayCoins}, #{item.country},
|
|
|
|
|
|
#{item.operationStatus}, #{item.hostsKind})
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</insert>
|
2025-06-24 15:20:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-25 14:26:42 +08:00
|
|
|
|
<select id="selectPageWithXMLWithSelf" resultType="cn.iocoder.yudao.module.tkdata.dal.dataobject.employeehosts.EmployeeHostsDO">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
select ns.id,hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum,
|
2025-07-09 16:19:42 +08:00
|
|
|
|
yesterday_coins,ns.create_time, country, online_fans,hosts_kind,remake ,
|
2025-10-13 17:55:49 +08:00
|
|
|
|
operation_status,ns.user_id ,ns.update_time,ns.flag,ns.deleted,ns.country_eng
|
|
|
|
|
|
from server_employee_hosts ns left join server_country_info ci ON ns.country = ci.country_name
|
2025-06-24 15:20:23 +08:00
|
|
|
|
WHERE tenant_id =#{req.tenantId,jdbcType=BIGINT}
|
|
|
|
|
|
and ns.user_id =#{req.userId,jdbcType=BIGINT}
|
|
|
|
|
|
<!-- 主播国家筛选 -->
|
2025-08-05 13:38:02 +08:00
|
|
|
|
<if test="req.region!= '' and req.region != null">
|
2025-08-04 21:57:38 +08:00
|
|
|
|
and ci.country_group_name =#{req.region,jdbcType=VARCHAR}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.country != '' and req.country !=null ">
|
|
|
|
|
|
and ns.country = #{req.country}
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 按照入库时间筛选主播 -->
|
|
|
|
|
|
<if test="req.createTime != null">
|
|
|
|
|
|
and DATE(ns.create_time) =#{req.createTime}
|
|
|
|
|
|
</if>
|
2025-09-05 22:17:18 +08:00
|
|
|
|
<!-- 按照更新时间筛选主播 -->
|
|
|
|
|
|
<if test="req.updateTime != null">
|
|
|
|
|
|
and DATE(ns.update_time) =#{req.updateTime}
|
|
|
|
|
|
</if>
|
2025-06-25 14:26:42 +08:00
|
|
|
|
<if test="req.operationStatus != null">
|
|
|
|
|
|
and operation_status =#{req.operationStatus,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
2025-06-24 15:20:23 +08:00
|
|
|
|
<!-- 主播 Id 模糊搜索 -->
|
2025-08-05 17:00:58 +08:00
|
|
|
|
<if test="req.hostsId != '' and req.hostsId != null ">
|
|
|
|
|
|
and ns.hosts_id like concat(#{req.hostsId,jdbcType=VARCHAR},'%')
|
|
|
|
|
|
</if>
|
2025-08-19 19:25:38 +08:00
|
|
|
|
<!-- 主播旗帜搜索 -->
|
|
|
|
|
|
<if test="req.flag != null">
|
|
|
|
|
|
and ns.flag =#{req.flag}
|
|
|
|
|
|
</if>
|
2025-08-05 17:00:58 +08:00
|
|
|
|
<!-- 主播等级筛选 -->
|
2025-08-01 13:28:19 +08:00
|
|
|
|
<if test="req.hostsLevel != null and req.hostsLevel.size() > 0">
|
|
|
|
|
|
AND ns.hosts_level IN
|
|
|
|
|
|
<foreach collection="req.hostsLevel" item="level" open="(" separator="," close=")">
|
|
|
|
|
|
#{level, jdbcType=VARCHAR}
|
|
|
|
|
|
</foreach>
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
2025-09-15 18:54:39 +08:00
|
|
|
|
and deleted = 0
|
2025-06-25 14:26:42 +08:00
|
|
|
|
<!-- 今日主播金币筛选 -->
|
|
|
|
|
|
<if test="req.hostsCoinsMin != null and req.hostsCoinsMax == null and req.hostsCoinsMax != '' ">
|
|
|
|
|
|
and ns.hosts_coins >=#{req.hostsCoinsMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.hostsCoinsMax != null and req.hostsCoinsMin == null and req.hostsCoinsMin !='' ">
|
|
|
|
|
|
and ns.hosts_coins <=#{req.hostsCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.hostsCoinsMin != null and req.hostsCoinsMax != null " >
|
|
|
|
|
|
and ns.hosts_coins between #{req.hostsCoinsMin,jdbcType=INTEGER} and #{req.hostsCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 昨日主播金币筛选 -->
|
|
|
|
|
|
<if test="req.yesterdayCoinsMin != null and req.yesterdayCoinsMax == null and req.yesterdayCoinsMax != ''">
|
|
|
|
|
|
and ns.yesterday_coins >=#{req.yesterdayCoinsMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.yesterdayCoinsMax != null and req.yesterdayCoinsMin == null and req.yesterdayCoinsMin != '' ">
|
|
|
|
|
|
and ns.yesterday_coins <=#{req.yesterdayCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.yesterdayCoinsMin != null and req.yesterdayCoinsMax != null " >
|
|
|
|
|
|
and ns.yesterday_coins between #{req.yesterdayCoinsMin,jdbcType=INTEGER} and #{req.yesterdayCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播粉丝数筛选-->
|
|
|
|
|
|
<if test="req.fansMin != null and req.fansMax == null and req.fansMax != ''">
|
|
|
|
|
|
and ns.fans >=#{req.fansMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.fansMax != null and req.fansMin == null and req.fansMin != '' ">
|
|
|
|
|
|
and ns.fans <=#{req.fansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.fansMin != null and req.fansMax != null " >
|
|
|
|
|
|
and ns.fans between #{req.fansMin,jdbcType=INTEGER} and #{req.fansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播关注筛选-->
|
|
|
|
|
|
<if test="req.fllowernumMin != null and req.fllowernumMax == null and req.fllowernumMax != ''">
|
|
|
|
|
|
and ns.fllowernum >=#{req.fllowernumMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.fllowernumMax != null and req.fllowernumMin == null and req.fllowernumMin != ''">
|
|
|
|
|
|
and ns.fllowernum <=#{req.fllowernumMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.fllowernumMin != null and req.fllowernumMax != null " >
|
|
|
|
|
|
and ns.fllowernum between #{req.fllowernumMin,jdbcType=INTEGER} and #{req.fllowernumMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播在线人数筛选-->
|
|
|
|
|
|
<if test="req.onlineFansMin != null and req.onlineFansMax == null and req.onlineFansMax != '' ">
|
|
|
|
|
|
and ns.online_fans >=#{req.onlineFansMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.onlineFansMax != null and req.onlineFansMin == null and req.onlineFansMin != ''">
|
|
|
|
|
|
and ns.online_fans <= #{req.onlineFansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.onlineFansMin != null and req.onlineFansMax != null " >
|
|
|
|
|
|
and ns.online_fans between #{req.onlineFansMin,jdbcType=INTEGER} and #{req.onlineFansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 邀请类筛选 -->
|
|
|
|
|
|
<if test="req.invitationType != null">
|
|
|
|
|
|
and ns.Invitation_type =#{req.invitationType,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 排序类型 -->
|
2025-07-03 20:10:31 +08:00
|
|
|
|
group by
|
|
|
|
|
|
ns.hosts_id
|
2025-06-25 14:26:42 +08:00
|
|
|
|
order by
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<!-- 传空和默认的情况下按照时间降序排序 -->
|
2025-07-08 18:23:52 +08:00
|
|
|
|
<when test="req.sortName == '' or req.sortName == null">
|
2025-07-09 14:22:25 +08:00
|
|
|
|
ns.create_time desc,ns.id desc
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</when>
|
|
|
|
|
|
<!-- sortNmae 有值的情况下排序 -->
|
|
|
|
|
|
<when test="req.sortName != null and req.sort != null ">
|
|
|
|
|
|
<if test="req.sortName == 'createTime' and req.sort != null">
|
2025-09-10 16:33:08 +08:00
|
|
|
|
ns.create_time ${req.sort},ns.id ${req.sort}
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 昨日主播金币条件排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'yesterdayCoins' and req.sort != null">
|
2025-09-10 16:33:08 +08:00
|
|
|
|
ns.yesterday_coins ${req.sort},ns.id ${req.sort}
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播金币条件排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'hostsCoins' and req.sort != null">
|
2025-09-10 16:33:08 +08:00
|
|
|
|
ns.hosts_coins ${req.sort},ns.id ${req.sort}
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播粉丝条件排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'fans' and req.sort != null">
|
2025-09-10 16:33:08 +08:00
|
|
|
|
ns.fans ${req.sort},ns.id ${req.sort}
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播关注数量排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'fllowernum' and req.sort != null">
|
2025-09-10 16:33:08 +08:00
|
|
|
|
ns.fllowernum ${req.sort},ns.id ${req.sort}
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播直播间在线数量排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'onlineFans' and req.sort != null">
|
2025-09-10 16:33:08 +08:00
|
|
|
|
ns.online_fans ${req.sort},ns.id ${req.sort}
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</if>
|
2025-08-12 19:36:29 +08:00
|
|
|
|
<if test="req.sortName == 'updateTime' and req.sort != null">
|
2025-09-10 16:33:08 +08:00
|
|
|
|
ns.update_time ${req.sort},ns.id ${req.sort}
|
2025-08-12 19:36:29 +08:00
|
|
|
|
</if>
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
ns.create_time desc
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectPageWithXML" resultType="cn.iocoder.yudao.module.tkdata.dal.dataobject.employeehosts.EmployeeHostsDO">
|
|
|
|
|
|
select ns.id,hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum,
|
2025-10-13 17:55:49 +08:00
|
|
|
|
yesterday_coins,ns.create_time, country, online_fans,hosts_kind,remake ,operation_status,user_id,uid,ns.update_time,ns.flag,ns.country_eng
|
2025-08-19 19:25:38 +08:00
|
|
|
|
from server_employee_hosts ns left join server_country_info ci ON ns.country = ci.country_name
|
2025-06-25 14:26:42 +08:00
|
|
|
|
WHERE tenant_id = #{req.tenantId,jdbcType=BIGINT}
|
2025-12-02 16:31:43 +08:00
|
|
|
|
<if test="req.isDelete == 1">
|
|
|
|
|
|
and deleted = 1
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.isDelete == 0">
|
|
|
|
|
|
and deleted = 0
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.isDelete == 3">
|
|
|
|
|
|
and deleted = 0
|
|
|
|
|
|
or deleted = 1
|
|
|
|
|
|
</if>
|
2025-06-25 14:26:42 +08:00
|
|
|
|
<!-- 筛选员工名下主播 -->
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.userId != null ">
|
2025-06-25 14:26:42 +08:00
|
|
|
|
and user_id = #{req.userId,jdbcType=BIGINT}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播国家筛选 -->
|
2025-08-05 13:38:02 +08:00
|
|
|
|
<if test="req.region!= '' and req.region != null">
|
2025-08-04 21:57:38 +08:00
|
|
|
|
and ci.country_group_name =#{req.region,jdbcType=VARCHAR}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.country != '' and req.country !=null ">
|
|
|
|
|
|
and ns.country = #{req.country}
|
2025-06-25 14:26:42 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 按照入库时间筛选主播 -->
|
|
|
|
|
|
<if test="req.createTime != null">
|
|
|
|
|
|
and DATE(ns.create_time) =#{req.createTime}
|
|
|
|
|
|
</if>
|
2025-09-05 22:17:18 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 按照更新时间筛选主播 -->
|
|
|
|
|
|
<if test="req.updateTime != null">
|
|
|
|
|
|
and DATE(ns.update_time) =#{req.updateTime}
|
|
|
|
|
|
</if>
|
2025-06-25 14:26:42 +08:00
|
|
|
|
<if test="req.operationStatus != null">
|
|
|
|
|
|
and operation_status =#{req.operationStatus,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播 Id 模糊搜索 -->
|
|
|
|
|
|
<if test="req.hostsId != '' and req.hostsId != null ">
|
|
|
|
|
|
and ns.hosts_id like concat(#{req.hostsId,jdbcType=VARCHAR},'%')
|
|
|
|
|
|
</if>
|
2025-08-19 19:25:38 +08:00
|
|
|
|
<!-- 主播旗帜搜索 -->
|
|
|
|
|
|
<if test="req.flag != null">
|
|
|
|
|
|
and ns.flag =#{req.flag}
|
|
|
|
|
|
</if>
|
2025-06-25 14:26:42 +08:00
|
|
|
|
<!-- 主播等级筛选 -->
|
2025-08-01 13:28:19 +08:00
|
|
|
|
<if test="req.hostsLevel != null and req.hostsLevel.size() > 0">
|
|
|
|
|
|
AND ns.hosts_level IN
|
|
|
|
|
|
<foreach collection="req.hostsLevel" item="level" open="(" separator="," close=")">
|
|
|
|
|
|
#{level, jdbcType=VARCHAR}
|
|
|
|
|
|
</foreach>
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 今日主播金币筛选 -->
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.hostsCoinsMin != null and req.hostsCoinsMax == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.hosts_coins >=#{req.hostsCoinsMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.hostsCoinsMax != null and req.hostsCoinsMin == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.hosts_coins <=#{req.hostsCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.hostsCoinsMin != null and req.hostsCoinsMax != null " >
|
|
|
|
|
|
and ns.hosts_coins between #{req.hostsCoinsMin,jdbcType=INTEGER} and #{req.hostsCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 昨日主播金币筛选 -->
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.yesterdayCoinsMin != null and req.yesterdayCoinsMax == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.yesterday_coins >=#{req.yesterdayCoinsMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.yesterdayCoinsMax != null and req.yesterdayCoinsMin == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.yesterday_coins <=#{req.yesterdayCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.yesterdayCoinsMin != null and req.yesterdayCoinsMax != null " >
|
|
|
|
|
|
and ns.yesterday_coins between #{req.yesterdayCoinsMin,jdbcType=INTEGER} and #{req.yesterdayCoinsMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播粉丝数筛选-->
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.fansMin != null and req.fansMax == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.fans >=#{req.fansMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.fansMax != null and req.fansMin == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.fans <=#{req.fansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.fansMin != null and req.fansMax != null " >
|
|
|
|
|
|
and ns.fans between #{req.fansMin,jdbcType=INTEGER} and #{req.fansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播关注筛选-->
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.fllowernumMin != null and req.fllowernumMax == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.fllowernum >=#{req.fllowernumMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.fllowernumMax != null and req.fllowernumMin == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.fllowernum <=#{req.fllowernumMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.fllowernumMin != null and req.fllowernumMax != null " >
|
|
|
|
|
|
and ns.fllowernum between #{req.fllowernumMin,jdbcType=INTEGER} and #{req.fllowernumMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播在线人数筛选-->
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.onlineFansMin != null and req.onlineFansMax == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.online_fans >=#{req.onlineFansMin,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
2025-07-02 14:20:28 +08:00
|
|
|
|
<if test="req.onlineFansMax != null and req.onlineFansMin == null ">
|
2025-06-24 15:20:23 +08:00
|
|
|
|
and ns.online_fans <= #{req.onlineFansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="req.onlineFansMin != null and req.onlineFansMax != null " >
|
|
|
|
|
|
and ns.online_fans between #{req.onlineFansMin,jdbcType=INTEGER} and #{req.onlineFansMax,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 邀请类筛选 -->
|
|
|
|
|
|
<if test="req.invitationType != null">
|
|
|
|
|
|
and ns.Invitation_type =#{req.invitationType,jdbcType=INTEGER}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 排序类型 -->
|
2025-07-03 20:10:31 +08:00
|
|
|
|
group by
|
|
|
|
|
|
ns.hosts_id
|
2025-06-24 15:20:23 +08:00
|
|
|
|
order by
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<!-- 传空和默认的情况下按照时间降序排序 -->
|
2025-07-08 18:23:52 +08:00
|
|
|
|
<when test="req.sortName == '' or req.sortName == null">
|
2025-07-09 14:22:25 +08:00
|
|
|
|
ns.create_time desc,ns.id desc
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</when>
|
|
|
|
|
|
<!-- sortNmae 有值的情况下排序 -->
|
|
|
|
|
|
<when test="req.sortName != null and req.sort != null ">
|
|
|
|
|
|
<if test="req.sortName == 'createTime' and req.sort != null">
|
2025-09-10 15:57:08 +08:00
|
|
|
|
ns.create_time ${req.sort},ns.id ${req.sort}
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 昨日主播金币条件排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'yesterdayCoins' and req.sort != null">
|
2025-09-10 15:57:08 +08:00
|
|
|
|
ns.yesterday_coins ${req.sort},ns.id ${req.sort}
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播金币条件排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'hostsCoins' and req.sort != null">
|
2025-09-10 15:57:08 +08:00
|
|
|
|
ns.hosts_coins ${req.sort},ns.id ${req.sort}
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播粉丝条件排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'fans' and req.sort != null">
|
2025-09-10 15:57:08 +08:00
|
|
|
|
ns.fans ${req.sort},ns.id ${req.sort}
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播关注数量排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'fllowernum' and req.sort != null">
|
2025-09-10 15:57:08 +08:00
|
|
|
|
ns.fllowernum ${req.sort},ns.id ${req.sort}
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<!-- 主播直播间在线数量排序 -->
|
|
|
|
|
|
<if test="req.sortName == 'onlineFans' and req.sort != null">
|
2025-09-10 15:57:08 +08:00
|
|
|
|
ns.online_fans ${req.sort},ns.id ${req.sort}
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</if>
|
2025-08-12 19:36:29 +08:00
|
|
|
|
<if test="req.sortName == 'updateTime' and req.sort != null">
|
2025-09-10 15:57:08 +08:00
|
|
|
|
ns.update_time ${req.sort},ns.id ${req.sort}
|
2025-08-12 19:36:29 +08:00
|
|
|
|
</if>
|
2025-06-24 15:20:23 +08:00
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
ns.create_time desc
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</select>
|
2025-07-28 15:56:21 +08:00
|
|
|
|
|
|
|
|
|
|
<update id="batchUpdate">
|
|
|
|
|
|
<foreach collection="list" item="item" separator=";">
|
|
|
|
|
|
UPDATE server_employee_hosts as seh
|
|
|
|
|
|
SET
|
|
|
|
|
|
user_id = #{item.userId,jdbcType=BIGINT},
|
|
|
|
|
|
operation_status = #{item.operationStatus,jdbcType=INTEGER}
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
seh.id = #{item.id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</update>
|
2025-07-28 16:52:45 +08:00
|
|
|
|
|
2025-08-06 19:53:30 +08:00
|
|
|
|
<select id="selectEmployeeHostsWithOperationStatus"
|
|
|
|
|
|
resultType="cn.iocoder.yudao.module.tkdata.controller.admin.employeehosts.vo.CompletedRateVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
user_id AS userId,
|
|
|
|
|
|
SUM(CASE WHEN operation_status = 1 THEN 1 ELSE 0 END) AS finishedNum,
|
|
|
|
|
|
SUM(CASE WHEN operation_status = 0 THEN 1 ELSE 0 END) AS unfinishedNum,
|
|
|
|
|
|
COUNT(*) AS totalNum
|
|
|
|
|
|
FROM server_employee_hosts
|
|
|
|
|
|
WHERE deleted = 0
|
|
|
|
|
|
<if test="userId != null">
|
|
|
|
|
|
AND user_id = #{userId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
GROUP BY user_id
|
|
|
|
|
|
</select>
|
2025-09-09 20:31:28 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="selectEmployeeHostsCompleteBarChart"
|
|
|
|
|
|
resultType="cn.iocoder.yudao.module.tkdata.controller.admin.employeehosts.vo.CompletedRateVO">
|
|
|
|
|
|
SELECT
|
2025-10-17 15:13:08 +08:00
|
|
|
|
user_id AS userId,
|
2025-09-10 14:34:52 +08:00
|
|
|
|
COUNT(DISTINCT
|
|
|
|
|
|
CASE WHEN operation_status = 1 THEN hosts_id END) AS finishedNum
|
2025-10-17 15:13:08 +08:00
|
|
|
|
FROM server_employee_hosts
|
|
|
|
|
|
WHERE deleted = 0
|
2025-09-09 20:31:28 +08:00
|
|
|
|
AND operation_status = 1
|
2025-10-17 15:13:08 +08:00
|
|
|
|
<!-- 日期范围:今天或过去 7 天(含今天) -->
|
|
|
|
|
|
AND update_time >= DATE_SUB(CURDATE(), INTERVAL #{days,jdbcType=INTEGER} - 1 DAY)
|
|
|
|
|
|
<if test="list != null and list.size() > 0">
|
2025-09-09 20:31:28 +08:00
|
|
|
|
AND user_id IN
|
|
|
|
|
|
<foreach collection="list" item="user_id" open="(" separator="," close=")">
|
|
|
|
|
|
#{user_id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
2025-10-17 15:13:08 +08:00
|
|
|
|
GROUP BY user_id
|
2025-09-09 20:31:28 +08:00
|
|
|
|
</select>
|
2025-06-17 20:59:52 +08:00
|
|
|
|
</mapper>
|