1.批量修改员工主播状态

This commit is contained in:
2025-07-03 20:37:09 +08:00
parent 4f7e0e4576
commit 7bf4b80281
9 changed files with 657 additions and 7 deletions

View File

@@ -0,0 +1,41 @@
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.ServerEmployeeHostsDTO;
import com.yupi.springbootinit.model.entity.ServerEmployeeHosts;
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
import com.yupi.springbootinit.model.vo.hosts.ServerEmployeeHostsVO;
import com.yupi.springbootinit.service.HostInfoService;
import com.yupi.springbootinit.service.ServerEmployeeHostsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/*
* @author: ziin
* @date: 2025/6/10 17:09
*/
@RestController
@RequestMapping("/emp_host")
@Slf4j
@CrossOrigin
public class EmployeeHostInfoController {
@Resource
private HostInfoService hostInfoService;
@Resource
private ServerEmployeeHostsService service;
@PostMapping("update")
public BaseResponse<Boolean> updateEmployeeHost(@RequestBody ServerEmployeeHostsDTO hostInfoDTO){
service.updateEmployeeHost(hostInfoDTO);
return ResultUtils.success(true);
}
}

View File

@@ -35,11 +35,4 @@ public class HostInfoController {
return ResultUtils.success(conditionHosts);
}
// @PostMapping("7days_data")
// public BaseResponse<List<SevenDaysData>> sevenDaysData(@RequestBody HistoryDataDTO historyDataDTO){
// Object loginId = StpUtil.getLoginId();
// historyDataDTO.setUserId(Long.valueOf(loginId.toString()));
// List<SevenDaysData> data = hostInfoService.getSevenDaysData(historyDataDTO);
// return ResultUtils.success(data);
// }
}

View File

@@ -0,0 +1,17 @@
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.HostInfoDTO;
import com.yupi.springbootinit.model.entity.ServerEmployeeHosts;
import com.yupi.springbootinit.model.vo.hosts.ServerEmployeeHostsVO;
import org.apache.ibatis.annotations.Param;
/*
* @author: ziin
* @date: 2025/7/3 19:12
*/
public interface ServerEmployeeHostsMapper extends BaseMapper<ServerEmployeeHosts> {
Page<ServerEmployeeHostsVO> selectPageByCondition(@Param("page") Page<ServerEmployeeHostsVO> page,@Param("hostInfoDTO") HostInfoDTO hostInfoDTO);
}

View File

@@ -0,0 +1,66 @@
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/*
* @author: ziin
* @date: 2025/7/3 19:12
*/
/**
* 员工分配主播表结构和主播表相同多了user_id 字段来区分所属员工
*/
@ApiModel(description="员工分配主播表结构和主播表相同多了user_id 字段来区分所属员工")
@Data
@TableName(value = "server_employee_hosts")
public class ServerEmployeeHostsDTO {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value="主键")
private Long id;
/**
* 主播id
*/
@TableField(value = "hosts_id")
@ApiModelProperty(value="主播id")
private String hostsId;
/**
* 用户 Id
*/
@TableField(value = "user_id")
@ApiModelProperty(value="用户 Id")
private Long userId;
/**
* 操作状态
*/
@TableField(value = "operation_status")
@ApiModelProperty(value="操作状态")
private Integer operationStatus;
/**
* 租户 Id
*/
@TableField(value = "tenant_id")
@ApiModelProperty(value="租户 Id")
private Long tenantId;
}

View File

@@ -0,0 +1,170 @@
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/7/3 19:12
*/
/**
* 员工分配主播表结构和主播表相同多了user_id 字段来区分所属员工
*/
@ApiModel(description="员工分配主播表结构和主播表相同多了user_id 字段来区分所属员工")
@Data
@TableName(value = "server_employee_hosts")
public class ServerEmployeeHosts {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value="主键")
private Long id;
/**
* 主播id
*/
@TableField(value = "hosts_id")
@ApiModelProperty(value="主播id")
private String hostsId;
/**
* 用户 Id
*/
@TableField(value = "user_id")
@ApiModelProperty(value="用户 Id")
private Long userId;
/**
* 主播等级
*/
@TableField(value = "hosts_level")
@ApiModelProperty(value="主播等级")
private String hostsLevel;
/**
* 主播金币
*/
@TableField(value = "hosts_coins")
@ApiModelProperty(value="主播金币")
private Integer hostsCoins;
/**
* 邀请类型
*/
@TableField(value = "Invitation_type")
@ApiModelProperty(value="邀请类型")
private Integer invitationType;
/**
* 在线人数
*/
@TableField(value = "online_fans")
@ApiModelProperty(value="在线人数")
private Integer onlineFans;
/**
* 粉丝数量
*/
@TableField(value = "fans")
@ApiModelProperty(value="粉丝数量")
private Integer fans;
/**
* 关注数量
*/
@TableField(value = "fllowernum")
@ApiModelProperty(value="关注数量")
private Integer fllowernum;
/**
* 昨日金币
*/
@TableField(value = "yesterday_coins")
@ApiModelProperty(value="昨日金币")
private Integer yesterdayCoins;
/**
* 主播国家
*/
@TableField(value = "country")
@ApiModelProperty(value="主播国家")
private String country;
/**
* 操作状态
*/
@TableField(value = "operation_status")
@ApiModelProperty(value="操作状态")
private Integer operationStatus;
/**
* 直播类型 娱乐,游戏
*/
@TableField(value = "hosts_kind")
@ApiModelProperty(value="直播类型 娱乐,游戏 ")
private String hostsKind;
/**
* 租户 Id
*/
@TableField(value = "tenant_id")
@ApiModelProperty(value="租户 Id")
private Long tenantId;
/**
* 入库人
*/
@TableField(value = "creator")
@ApiModelProperty(value="入库人")
private Long creator;
/**
* 数据插入时间
*/
@TableField(value = "create_time")
@ApiModelProperty(value="数据插入时间")
private Date createTime;
/**
* 更新人
*/
@TableField(value = "updater")
@ApiModelProperty(value="更新人")
private String updater;
/**
* 更新时间
*/
@TableField(value = "update_time")
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
* 是否删除
*/
@TableField(value = "deleted")
@ApiModelProperty(value="是否删除")
private Byte deleted;
/**
* 备注
*/
@TableField(value = "remake")
@ApiModelProperty(value="备注")
private String remake;
/**
* uid
*/
@TableField(value = "`uid`")
@ApiModelProperty(value="uid")
private String uid;
}

View File

@@ -0,0 +1,171 @@
package com.yupi.springbootinit.model.vo.hosts;
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/7/3 19:12
*/
/**
* 员工分配主播表结构和主播表相同多了user_id 字段来区分所属员工
*/
@ApiModel(description="员工分配主播表结构和主播表相同多了user_id 字段来区分所属员工")
@Data
@TableName(value = "server_employee_hosts")
public class ServerEmployeeHostsVO {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value="主键")
private Long id;
/**
* 主播id
*/
@TableField(value = "hosts_id")
@ApiModelProperty(value="主播id")
private String hostsId;
/**
* 用户 Id
*/
@TableField(value = "user_id")
@ApiModelProperty(value="用户 Id")
private Long userId;
/**
* 主播等级
*/
@TableField(value = "hosts_level")
@ApiModelProperty(value="主播等级")
private String hostsLevel;
/**
* 主播金币
*/
@TableField(value = "hosts_coins")
@ApiModelProperty(value="主播金币")
private Integer hostsCoins;
/**
* 邀请类型
*/
@TableField(value = "Invitation_type")
@ApiModelProperty(value="邀请类型")
private Integer invitationType;
/**
* 在线人数
*/
@TableField(value = "online_fans")
@ApiModelProperty(value="在线人数")
private Integer onlineFans;
/**
* 粉丝数量
*/
@TableField(value = "fans")
@ApiModelProperty(value="粉丝数量")
private Integer fans;
/**
* 关注数量
*/
@TableField(value = "fllowernum")
@ApiModelProperty(value="关注数量")
private Integer fllowernum;
/**
* 昨日金币
*/
@TableField(value = "yesterday_coins")
@ApiModelProperty(value="昨日金币")
private Integer yesterdayCoins;
/**
* 主播国家
*/
@TableField(value = "country")
@ApiModelProperty(value="主播国家")
private String country;
/**
* 操作状态
*/
@TableField(value = "operation_status")
@ApiModelProperty(value="操作状态")
private Integer operationStatus;
/**
* 直播类型 娱乐,游戏
*/
@TableField(value = "hosts_kind")
@ApiModelProperty(value="直播类型 娱乐,游戏 ")
private String hostsKind;
/**
* 租户 Id
*/
@TableField(value = "tenant_id")
@ApiModelProperty(value="租户 Id")
private Long tenantId;
/**
* 入库人
*/
@TableField(value = "creator")
@ApiModelProperty(value="入库人")
private Long creator;
/**
* 数据插入时间
*/
@TableField(value = "create_time")
@ApiModelProperty(value="数据插入时间")
private Date createTime;
/**
* 更新人
*/
@TableField(value = "updater")
@ApiModelProperty(value="更新人")
private String updater;
/**
* 更新时间
*/
@TableField(value = "update_time")
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
* 是否删除
*/
@TableField(value = "deleted")
@ApiModelProperty(value="是否删除")
private Byte deleted;
/**
* 备注
*/
@TableField(value = "remake")
@ApiModelProperty(value="备注")
private String remake;
/**
* uid
*/
@TableField(value = "`uid`")
@ApiModelProperty(value="uid")
private String uid;
}

View File

@@ -0,0 +1,19 @@
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.ServerEmployeeHostsDTO;
import com.yupi.springbootinit.model.entity.ServerEmployeeHosts;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.springbootinit.model.vo.hosts.ServerEmployeeHostsVO;
/*
* @author: ziin
* @date: 2025/7/3 19:12
*/
public interface ServerEmployeeHostsService extends IService<ServerEmployeeHosts>{
void updateEmployeeHost(ServerEmployeeHostsDTO hostInfoDTO);
}

View File

@@ -0,0 +1,29 @@
package com.yupi.springbootinit.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.springbootinit.mapper.ServerEmployeeHostsMapper;
import com.yupi.springbootinit.model.dto.host.ServerEmployeeHostsDTO;
import com.yupi.springbootinit.model.entity.ServerEmployeeHosts;
import com.yupi.springbootinit.service.ServerEmployeeHostsService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
/*
* @author: ziin
* @date: 2025/7/3 19:12
*/
@Service
public class ServerEmployeeHostsServiceImpl extends ServiceImpl<ServerEmployeeHostsMapper, ServerEmployeeHosts> implements ServerEmployeeHostsService{
@Override
public void updateEmployeeHost(ServerEmployeeHostsDTO hostInfoDTO) {
BeanUtils.copyProperties(hostInfoDTO,ServerEmployeeHosts.class);
lambdaUpdate().eq(ServerEmployeeHosts::getHostsId, hostInfoDTO.getHostsId())
.eq(ServerEmployeeHosts::getUserId, hostInfoDTO.getUserId())
.eq(ServerEmployeeHosts::getTenantId, hostInfoDTO.getTenantId())
.set(ServerEmployeeHosts::getOperationStatus, hostInfoDTO.getOperationStatus())
.update();
}
}

View File

@@ -0,0 +1,144 @@
<?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.ServerEmployeeHostsMapper">
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.ServerEmployeeHosts">
<!--@mbg.generated-->
<!--@Table server_employee_hosts-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="hosts_id" jdbcType="VARCHAR" property="hostsId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<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="online_fans" jdbcType="INTEGER" property="onlineFans" />
<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="operation_status" jdbcType="INTEGER" property="operationStatus" />
<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="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="deleted" jdbcType="TINYINT" property="deleted" />
<result column="remake" jdbcType="VARCHAR" property="remake" />
<result column="uid" jdbcType="VARCHAR" property="uid" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, hosts_id, user_id, hosts_level, hosts_coins, Invitation_type, online_fans, fans,
fllowernum, yesterday_coins, country, operation_status, hosts_kind, tenant_id, creator,
create_time, updater, update_time, deleted, remake, `uid`
</sql>
<select id="selectPageByCondition" resultType="com.yupi.springbootinit.model.vo.hosts.ServerEmployeeHostsVO">
select ns.id,hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum,
yesterday_coins,ns.create_time, country, online_fans,hosts_kind, uid from server_new_hosts ns left join server_country_info ci ON ns.country = ci.country_name
where ns.tenant_id=#{hostInfoDTO.tenantId}
<!-- 主播国家筛选 -->
<if test="hostInfoDTO.country!= '' and hostInfoDTO.country != null">
and ci.country_group_name =#{hostInfoDTO.country,jdbcType=VARCHAR}
</if>
<!-- 按照入库时间筛选主播 -->
<if test="hostInfoDTO.createTime != null">
and DATE(ns.create_time) =#{hostInfoDTO.createTime}
</if>
<!-- 主播 Id 模糊搜索 -->
<if test="hostInfoDTO.hostsId != '' and hostInfoDTO.hostsId != null ">
and ns.hosts_id like concat(#{hostInfoDTO.hostsId,jdbcType=VARCHAR},'%')
</if>
<!-- 今日主播金币筛选 -->
<if test="hostInfoDTO.hostsCoinsMin != null and hostInfoDTO.hostsCoinsMax == null ">
and ns.hosts_coins >=#{hostInfoDTO.hostsCoinsMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.hostsCoinsMax != null and hostInfoDTO.hostsCoinsMin == null ">
and ns.hosts_coins &lt;=#{hostInfoDTO.hostsCoinsMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.hostsCoinsMin != null and hostInfoDTO.hostsCoinsMax != null " >
and ns.hosts_coins between #{hostInfoDTO.hostsCoinsMin,jdbcType=INTEGER} and #{hostInfoDTO.hostsCoinsMax,jdbcType=INTEGER}
</if>
<!-- 昨日主播金币筛选 -->
<if test="hostInfoDTO.yesterdayCoinsMin != null and hostInfoDTO.yesterdayCoinsMax == null ">
and ns.yesterday_coins >=#{hostInfoDTO.yesterdayCoinsMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.yesterdayCoinsMax != null and hostInfoDTO.yesterdayCoinsMin == null ">
and ns.yesterday_coins &lt;=#{hostInfoDTO.yesterdayCoinsMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.yesterdayCoinsMin != null and hostInfoDTO.yesterdayCoinsMax != null " >
and ns.yesterday_coins between #{hostInfoDTO.yesterdayCoinsMin,jdbcType=INTEGER} and #{hostInfoDTO.yesterdayCoinsMax,jdbcType=INTEGER}
</if>
<!-- 主播粉丝数筛选-->
<if test="hostInfoDTO.fansMin != null and hostInfoDTO.fansMax == null ">
and ns.fans >=#{hostInfoDTO.fansMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fansMax != null and hostInfoDTO.fansMin == null ">
and ns.fans &lt;=#{hostInfoDTO.fansMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fansMin != null and hostInfoDTO.fansMax != null " >
and ns.fans between #{hostInfoDTO.fansMin,jdbcType=INTEGER} and #{hostInfoDTO.fansMax,jdbcType=INTEGER}
</if>
<!-- 主播关注筛选-->
<if test="hostInfoDTO.fllowernumMin != null and hostInfoDTO.fllowernumMax == null">
and ns.fllowernum >=#{hostInfoDTO.fllowernumMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fllowernumMax != null and hostInfoDTO.fllowernumMin == null">
and ns.fllowernum &lt;=#{hostInfoDTO.fllowernumMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.fllowernumMin != null and hostInfoDTO.fllowernumMax != null " >
and ns.fllowernum between #{hostInfoDTO.fllowernumMin,jdbcType=INTEGER} and #{hostInfoDTO.fllowernumMax,jdbcType=INTEGER}
</if>
<!-- 主播在线人数筛选-->
<if test="hostInfoDTO.onlineFansMin != null and hostInfoDTO.onlineFansMax == null ">
and ns.online_fans >=#{hostInfoDTO.onlineFansMin,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.onlineFansMax != null and hostInfoDTO.onlineFansMin == null ">
and ns.online_fans &lt;= #{hostInfoDTO.onlineFansMax,jdbcType=INTEGER}
</if>
<if test="hostInfoDTO.onlineFansMin != null and hostInfoDTO.onlineFansMax != null " >
and ns.online_fans between #{hostInfoDTO.onlineFansMin,jdbcType=INTEGER} and #{hostInfoDTO.onlineFansMax,jdbcType=INTEGER}
</if>
<!-- 邀请类筛选 -->
<if test="hostInfoDTO.invitationType != null">
and ns.Invitation_type =#{hostInfoDTO.invitationType,jdbcType=INTEGER}
</if>
<!-- 排序类型 -->
order by
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="hostInfoDTO.sortName == '' and hostInfoDTO.sortName == null">
ns.create_time desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="hostInfoDTO.sortName != null and hostInfoDTO.sort != null ">
<if test="hostInfoDTO.sortName == 'createTime' and hostInfoDTO.sort != null">
ns.create_time ${hostInfoDTO.sort}
</if>
<!-- 昨日主播金币条件排序 -->
<if test="hostInfoDTO.sortName == 'yesterdayCoins' and hostInfoDTO.sort != null">
ns.yesterday_coins ${hostInfoDTO.sort}
</if>
<!-- 主播金币条件排序 -->
<if test="hostInfoDTO.sortName == 'hostsCoins' and hostInfoDTO.sort != null">
ns.hosts_coins ${hostInfoDTO.sort}
</if>
<!-- 主播粉丝条件排序 -->
<if test="hostInfoDTO.sortName == 'fans' and hostInfoDTO.sort != null">
ns.fans ${hostInfoDTO.sort}
</if>
<!-- 主播关注数量排序 -->
<if test="hostInfoDTO.sortName == 'fllowernum' and hostInfoDTO.sort != null">
ns.fllowernum ${hostInfoDTO.sort}
</if>
<!-- 主播直播间在线数量排序 -->
<if test="hostInfoDTO.sortName == 'onlineFans' and hostInfoDTO.sort != null">
ns.online_fans ${hostInfoDTO.sort}
</if>
</when>
<otherwise>
ns.create_time desc
</otherwise>
</choose>
</select>
</mapper>