1.大哥员工业务查询自身数据

This commit is contained in:
2025-07-07 13:59:56 +08:00
parent 2d223d2a46
commit 5bd6bd18db
5 changed files with 207 additions and 26 deletions

View File

@@ -49,11 +49,93 @@ public class EmployeeBigBrotherPageReqVO extends PageParam {
@Schema(description = "该数据所属的账号id", example = "533")
private String userId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "是否洽谈", example = "2")
private Integer operationStatus;
/**
* 大哥的等级
*/
@Schema(description="大哥的等级最小值")
private Integer levelMin;
/**
* 大哥的等级
*/
@Schema(description="大哥的等级最大值")
private Integer levelMax;
/**
* 大哥打赏的金币
*/
@Schema(description="大哥打赏的金币最小值")
private Integer hostcoinsMin;
/**
* 大哥打赏的金币
*/
@Schema(description="大哥打赏的金币最大值")
private Integer hostcoinsMax;
/**
* 大哥打赏的历史最高金币
*/
@Schema(description="大哥打赏的历史最高金币最小值")
private Integer historicHighCoinsMin;
/**
* 大哥打赏的历史最高金币
*/
@Schema(description="大哥打赏的历史最高金币最大值")
private Integer historicHighCoinsMax;
/**
* 大哥历史打赏金币总和
*/
@Schema(description="大哥历史打赏金币总和")
private Integer totalGiftCoinsMin;
/**
* 大哥历史打赏金币总和
*/
@Schema(description="大哥历史打赏金币总和")
private Integer totalGiftCoinsMax;
/**
* 租户 Id
*/
@Schema(description="租户 Id")
private Long tenantId;
/**
* 数据插入时间
*/
@Schema(description = "创建时间开始(yyyy-MM-dd)", example = "2023-01-01")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime createTimeStart;
/**
* 数据插入时间
*/
@Schema(description = "创建时间结束(yyyy-MM-dd)", example = "2023-01-01")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime createTimeEnd;
/**
* 排序规则
*/
@Schema(description = "排序方式(asc/desc)", example = "desc")
private String sort;
/**
* 按照何种业务排序
*/
@Schema(description = "排序字段(historicHighCoins/totalGiftCoins/level等)", example = "hostsCoins")
private String sortName;
@Schema(description = "国家名称")
private String countryName;
}

View File

@@ -80,5 +80,4 @@ public class EmployeeBigBrotherDO extends BaseDO {
*/
private Integer operationStatus;
}

View File

@@ -1,13 +1,12 @@
package cn.iocoder.yudao.module.tkdata.dal.mysql.employeebigbrother;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherPageReqVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 大哥数据员工业务 Mapper
@@ -17,23 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EmployeeBigBrotherMapper extends BaseMapperX<EmployeeBigBrotherDO> {
default PageResult<EmployeeBigBrotherDO> selectPage(EmployeeBigBrotherPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeBigBrotherDO>()
.eqIfPresent(EmployeeBigBrotherDO::getDisplayId, reqVO.getDisplayId())
.eqIfPresent(EmployeeBigBrotherDO::getUserIdStr, reqVO.getUserIdStr())
.likeIfPresent(EmployeeBigBrotherDO::getNickname, reqVO.getNickname())
.eqIfPresent(EmployeeBigBrotherDO::getLevel, reqVO.getLevel())
.eqIfPresent(EmployeeBigBrotherDO::getHostcoins, reqVO.getHostcoins())
.eqIfPresent(EmployeeBigBrotherDO::getFollowerCount, reqVO.getFollowerCount())
.eqIfPresent(EmployeeBigBrotherDO::getFollowingCount, reqVO.getFollowingCount())
.eqIfPresent(EmployeeBigBrotherDO::getRegion, reqVO.getRegion())
.eqIfPresent(EmployeeBigBrotherDO::getHistoricHighCoins, reqVO.getHistoricHighCoins())
.eqIfPresent(EmployeeBigBrotherDO::getTotalGiftCoins, reqVO.getTotalGiftCoins())
.eqIfPresent(EmployeeBigBrotherDO::getHostDisplayId, reqVO.getHostDisplayId())
.eqIfPresent(EmployeeBigBrotherDO::getUserId, reqVO.getUserId())
.betweenIfPresent(EmployeeBigBrotherDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(EmployeeBigBrotherDO::getOperationStatus, reqVO.getOperationStatus())
.orderByDesc(EmployeeBigBrotherDO::getId));
}
IPage<EmployeeBigBrotherDO> selectPagewithSelf(@Param("page") IPage<EmployeeBigBrotherDO> iPage,@Param("dto") EmployeeBigBrotherPageReqVO pageReqVO);
}

View File

@@ -1,10 +1,14 @@
package cn.iocoder.yudao.module.tkdata.service.employeebigbrother;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherPageReqVO;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherSaveReqVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.bigbrother.BigBrotherDO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO;
import cn.iocoder.yudao.module.tkdata.dal.mysql.employeebigbrother.EmployeeBigBrotherMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -88,7 +92,10 @@ public class EmployeeBigBrotherServiceImpl implements EmployeeBigBrotherService
@Override
public PageResult<EmployeeBigBrotherDO> getEmployeeBigBrotherPage(EmployeeBigBrotherPageReqVO pageReqVO) {
return employeeBigBrotherMapper.selectPage(pageReqVO);
pageReqVO.setTenantId(TenantContextHolder.getTenantId());
IPage<EmployeeBigBrotherDO> iPage = new Page<>(pageReqVO.getPageNo(),pageReqVO.getPageSize());
IPage<EmployeeBigBrotherDO> bigBrotherDOIPage = employeeBigBrotherMapper.selectPagewithSelf(iPage, pageReqVO);
return new PageResult<>(bigBrotherDOIPage.getRecords(),bigBrotherDOIPage.getTotal());
}
}

View File

@@ -9,4 +9,114 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO">
<!--@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="user_id" jdbcType="VARCHAR" property="userId" />
<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="operation_status" jdbcType="BOOLEAN" property="operationStatus"/>
</resultMap>
<select id="selectPagewithSelf"
resultType="cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO">
select sbr.id, sbr.display_id, sbr.user_id_str,sbr.nickname,sbr.level,sbr.hostcoins,
sbr.follower_count, sbr.following_count, sbr.region, sbr.historic_high_coins, sbr.total_gift_coins,
sbr.host_display_id,sbr.create_time, sbr.user_id, sbr.operation_status from
server_employee_big_brother sbr left join server_country_info ci ON sbr.region = ci.country_name
where sbr.tenant_id=#{dto.tenantId}
and sbr.deleted = 0
and sbr.user_id = #{dto.userId,jdbcType=VARCHAR}
<!-- 大哥所属国家筛选 -->
<if test="dto.region!= '' and dto.region != null">
and ci.country_group_name =#{dto.region,jdbcType=VARCHAR}
</if>
<if test="dto.countryName != null and dto.countryName != ''">
and sbr.region = #{dto.countryName}
</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 sbr.hostcoins >=#{dto.hostcoinsMin,jdbcType=INTEGER}
</if>
<if test="dto.hostcoinsMax != null and dto.hostcoinsMin == null ">
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 sbr.total_gift_coins >=#{dto.totalGiftCoinsMin,jdbcType=INTEGER}
</if>
<if test="dto.totalGiftCoinsMax != null and dto.totalGiftCoinsMin == null ">
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 sbr.level >=#{dto.levelMin,jdbcType=INTEGER}
</if>
<if test="dto.levelMax != null and dto.levelMin == null ">
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>
<if test="dto.operationStatus != null">
and sbr.operation_status =#{dto.operationStatus}
</if>
group by sbr.display_id
order by
<!-- 排序类型 -->
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="dto.sortName == '' or 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 == 'hostsCoins' and dto.sort != null">
sbr.hostcoins ${dto.sort}
</if>
<!-- 大哥打赏总金币排序 -->
<if test="dto.sortName == 'totalGiftCoins' and dto.sort != null">
sbr.total_gift_coins ${dto.sort}
</if>
</when>
</choose>
</select>
</mapper>