短剧新需求
This commit is contained in:
parent
03cff5e66f
commit
cf3fac6f88
|
|
@ -71,4 +71,18 @@ public class ExtSysController {
|
|||
PageUtils data = extSysService.queryInviteAwardDetailRecord(page, limit, Convert.toLong(userId));
|
||||
return Result.success().put("data", data);
|
||||
}
|
||||
|
||||
@GetMapping("/lottery/count/query/page")
|
||||
@ApiOperation("抽奖次数查询-分页")
|
||||
public Result getLotteryCountQueryPage(Integer page, Integer limit, String keywords) {
|
||||
PageUtils data = extSysService.queryLotteryCountPage(page, limit, keywords);
|
||||
return Result.success().put("data", data);
|
||||
}
|
||||
|
||||
@GetMapping("/lottery/detail/page")
|
||||
@ApiOperation("抽奖详情查询-分页")
|
||||
public Result getLotteryDetailPage(Integer page, Integer limit, String userId) {
|
||||
PageUtils data = extSysService.queryLotteryDetailPage(page, limit, Convert.toLong(userId));
|
||||
return Result.success().put("data", data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package com.sqx.modules.ext.dao;
|
||||
|
||||
import com.sqx.modules.ext.dto.InviteAwardDTO;
|
||||
import com.sqx.modules.ext.dto.InviteFriendDTO;
|
||||
import com.sqx.modules.ext.dto.SignInNumDTO;
|
||||
import com.sqx.modules.ext.dto.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -10,6 +8,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 扩展系统数据访问层
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-03-28 10:39
|
||||
*/
|
||||
|
|
@ -20,4 +19,10 @@ public interface ExtSysDao {
|
|||
List<SignInNumDTO> findInviteSignInList(@Param("userId") Long userId);
|
||||
|
||||
List<InviteAwardDTO> findInviteAwardDetailList(@Param("userId") Long userId);
|
||||
|
||||
List<LotteryCountQueryDTO> findLotteryCountList(@Param("keywords") String keywords);
|
||||
|
||||
List<LotteryDetailDTO> findLotteryDetailPage(@Param("userId") Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.sqx.modules.ext.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 抽奖次数查询DTO
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-03-28 10:24
|
||||
*/
|
||||
@Data
|
||||
public class LotteryCountQueryDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 账号ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String avatar;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 共解锁
|
||||
*/
|
||||
private Integer unlocked;
|
||||
/**
|
||||
* 今日解锁
|
||||
*/
|
||||
private Integer todayUnlocked;
|
||||
/**
|
||||
* 共获得抽奖次数
|
||||
*/
|
||||
private Integer totalDrawCount;
|
||||
/**
|
||||
* 剩余抽奖次数
|
||||
*/
|
||||
private Integer residueDrawCount;
|
||||
/**
|
||||
* 今日抽奖次数
|
||||
*/
|
||||
private Integer todayDrawCount;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.sqx.modules.ext.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 抽奖详情DTO类
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-03-28 10:24
|
||||
*/
|
||||
@Data
|
||||
public class LotteryDetailDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 抽奖id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String number;
|
||||
/**
|
||||
* 发放时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
}
|
||||
|
|
@ -68,6 +68,5 @@ public class SignInNumDTO implements Serializable {
|
|||
/**
|
||||
* 发放时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String createTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,8 @@ public interface ExtSysService {
|
|||
PageUtils queryInviteSignInRecord(Integer page, Integer limit, Long userId);
|
||||
|
||||
PageUtils queryInviteAwardDetailRecord(Integer page, Integer limit, Long userId);
|
||||
|
||||
PageUtils queryLotteryCountPage(Integer page, Integer limit, String keywords);
|
||||
|
||||
PageUtils queryLotteryDetailPage(Integer page, Integer limit, Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,19 +7,12 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.VipDetails;
|
||||
import com.sqx.modules.common.dao.CommonInfoDao;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.ext.dao.ExtSysDao;
|
||||
import com.sqx.modules.ext.dto.InviteAwardDTO;
|
||||
import com.sqx.modules.ext.dto.InviteFriendDTO;
|
||||
import com.sqx.modules.ext.dto.SignInNumDTO;
|
||||
import com.sqx.modules.ext.dto.*;
|
||||
import com.sqx.modules.ext.param.InviteFriendConfigParam;
|
||||
import com.sqx.modules.ext.service.ExtSysService;
|
||||
import com.sqx.modules.utils.TimeCompleteUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -81,7 +74,7 @@ public class ExtSysServiceImpl implements ExtSysService {
|
|||
|
||||
@Override
|
||||
public PageUtils queryInviteFriendRecord(Integer page, Integer limit, String keywords) {
|
||||
PageHelper.startPage(page,limit);
|
||||
PageHelper.startPage(page, limit);
|
||||
List<InviteFriendDTO> list = extSysDao.findInviteFriendList(keywords);
|
||||
PageInfo<InviteFriendDTO> pageInfo = new PageInfo<>(list);
|
||||
return PageUtils.page(pageInfo);
|
||||
|
|
@ -89,7 +82,7 @@ public class ExtSysServiceImpl implements ExtSysService {
|
|||
|
||||
@Override
|
||||
public PageUtils queryInviteSignInRecord(Integer page, Integer limit, Long userId) {
|
||||
PageHelper.startPage(page,limit);
|
||||
PageHelper.startPage(page, limit);
|
||||
List<SignInNumDTO> list = extSysDao.findInviteSignInList(userId);
|
||||
PageInfo<SignInNumDTO> pageInfo = new PageInfo<>(list);
|
||||
return PageUtils.page(pageInfo);
|
||||
|
|
@ -97,9 +90,25 @@ public class ExtSysServiceImpl implements ExtSysService {
|
|||
|
||||
@Override
|
||||
public PageUtils queryInviteAwardDetailRecord(Integer page, Integer limit, Long userId) {
|
||||
PageHelper.startPage(page,limit);
|
||||
PageHelper.startPage(page, limit);
|
||||
List<InviteAwardDTO> list = extSysDao.findInviteAwardDetailList(userId);
|
||||
PageInfo<InviteAwardDTO> pageInfo = new PageInfo<>(list);
|
||||
return PageUtils.page(pageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryLotteryCountPage(Integer page, Integer limit, String keywords) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<LotteryCountQueryDTO> list = extSysDao.findLotteryCountList(keywords);
|
||||
PageInfo<LotteryCountQueryDTO> pageInfo = new PageInfo<>(list);
|
||||
return PageUtils.page(pageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryLotteryDetailPage(Integer page, Integer limit, Long userId) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<LotteryDetailDTO> list = extSysDao.findLotteryDetailPage(userId);
|
||||
PageInfo<LotteryDetailDTO> pageInfo = new PageInfo<>(list);
|
||||
return PageUtils.page(pageInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,66 +121,66 @@ spring:
|
|||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
|
||||
duanju-slave:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: 0fd6497c308ccfa8
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-slave-0:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: 0fd6497c308ccfa8
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-slave-1:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: 0fd6497c308ccfa8
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-slave-2:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-2?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: 0fd6497c308ccfa8
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-slave-3:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-3?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: 0fd6497c308ccfa8
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-slave-4:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: 0fd6497c308ccfa8
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
# duanju-slave:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: 0fd6497c308ccfa8
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# duanju-slave-0:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: 0fd6497c308ccfa8
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# duanju-slave-1:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: 0fd6497c308ccfa8
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# duanju-slave-2:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-2?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: 0fd6497c308ccfa8
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# duanju-slave-3:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-3?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: 0fd6497c308ccfa8
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# duanju-slave-4:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju-4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: 0fd6497c308ccfa8
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# 数据源配置end
|
||||
|
||||
# 读写分离配置begin
|
||||
|
|
@ -189,31 +189,31 @@ spring:
|
|||
duanju:
|
||||
masterDataSourceName: duanju
|
||||
slaveDataSourceNames:
|
||||
# - duanju
|
||||
- duanju-slave
|
||||
- duanju
|
||||
#- duanju-slave
|
||||
duanju-0:
|
||||
masterDataSourceName: duanju-0
|
||||
slaveDataSourceNames:
|
||||
# - duanju-0
|
||||
- duanju-slave-0
|
||||
- duanju-0
|
||||
#- duanju-slave-0
|
||||
duanju-1:
|
||||
masterDataSourceName: duanju-1
|
||||
slaveDataSourceNames:
|
||||
# - duanju-1
|
||||
- duanju-slave-1
|
||||
- duanju-1
|
||||
#- duanju-slave-1
|
||||
duanju-2:
|
||||
masterDataSourceName: duanju-2
|
||||
slaveDataSourceNames:
|
||||
# - duanju-2
|
||||
- duanju-slave-2
|
||||
- duanju-2
|
||||
#- duanju-slave-2
|
||||
duanju-3:
|
||||
masterDataSourceName: duanju-3
|
||||
slaveDataSourceNames:
|
||||
# - duanju-3
|
||||
- duanju-slave-3
|
||||
- duanju-3
|
||||
#- duanju-slave-3
|
||||
duanju-4:
|
||||
masterDataSourceName: duanju-4
|
||||
slaveDataSourceNames:
|
||||
# - duanju-4
|
||||
- duanju-slave-4
|
||||
- duanju-4
|
||||
#- duanju-slave-4
|
||||
|
||||
|
|
|
|||
|
|
@ -4,56 +4,43 @@
|
|||
|
||||
<select id="findInviteFriendList" resultType="com.sqx.modules.ext.dto.InviteFriendDTO">
|
||||
select
|
||||
t1.user_id as userId,
|
||||
t1.x_user_id as userId,
|
||||
t1.user_name as userName,
|
||||
t1.phone,
|
||||
t1.avatar,
|
||||
t2.signInNum,
|
||||
t2.awardAmount
|
||||
from tb_user t1
|
||||
left JOIN (select user_id,sum(money) as awardAmount,sum(case when title = '签到奖励' then 1 else 0 end) as signInNum from user_money_details where classify = 6 group by user_id) t2 on t1.user_id = t2.user_id
|
||||
ifnull(t2.signInNum,0) as signInNum,
|
||||
ifnull(t2.awardAmount,0) as awardAmount
|
||||
from v_tb_user t1
|
||||
left JOIN (select x_user_id,sum(money) as awardAmount,sum(case when title = '签到奖励' then 1 else 0 end) as signInNum from v_user_money_details where classify = 6 group by x_user_id) t2 on t1.x_user_id = t2.x_user_id
|
||||
<where>
|
||||
and t2.awardAmount is not null
|
||||
<if test="keywords != null and keywords != ''">
|
||||
and (t1.user_name like concat('%',#{keywords},'%') or t1.phone like concat('%',#{keywords},'%')
|
||||
and (t1.user_name like concat('%',#{keywords},'%') or t1.phone like concat('%',#{keywords},'%'))
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t1.user_id
|
||||
ORDER BY t2.signInNum desc,t1.x_user_id asc
|
||||
</select>
|
||||
<select id="findInviteSignInList" resultType="com.sqx.modules.ext.dto.SignInNumDTO">
|
||||
SELECT
|
||||
t1.by_user_id AS userId,
|
||||
MIN( t1.create_time ) as createTime,
|
||||
t2.user_name as userName,
|
||||
t2.phone,
|
||||
t3.cert_name as realName,
|
||||
t3.cert_no as idCardNo,
|
||||
t3.bank_name as bankName,
|
||||
t3.account_no as bankCardNo,
|
||||
t3.mobile,
|
||||
t3.province,
|
||||
t3.city,
|
||||
t3.bank_branch
|
||||
MIN( t1.create_time ) as createTime
|
||||
FROM
|
||||
user_money_details t1
|
||||
LEFT JOIN tb_user t2 on t1.by_user_id = t2.user_id
|
||||
LEFT JOIN user_info t3 on t1.by_user_id = t3.user_id
|
||||
WHERE
|
||||
t1.user_id = #{userId}
|
||||
v_user_money_details t1
|
||||
WHERE 1=1
|
||||
AND t1.user_id = #{userId}
|
||||
AND t1.classify = 6
|
||||
AND t1.title = '签到奖励'
|
||||
GROUP BY t1.by_user_id
|
||||
ORDER BY t1.by_user_id
|
||||
ORDER BY t1.by_user_id asc
|
||||
</select>
|
||||
<select id="findInviteAwardDetailList" resultType="com.sqx.modules.ext.dto.InviteAwardDTO">
|
||||
SELECT DISTINCT
|
||||
SELECT
|
||||
t1.by_user_id AS userId,
|
||||
t1.money as amount,
|
||||
t2.phone as userPhone,
|
||||
t1.create_time as createTime
|
||||
FROM
|
||||
user_money_details t1
|
||||
LEFT JOIN tb_user t2 on t1.by_user_id = t2.user_id
|
||||
v_user_money_details t1
|
||||
LEFT JOIN tb_user t2 on t1.by_user_id = t2.user_id
|
||||
WHERE
|
||||
t1.user_id = #{userId}
|
||||
AND t1.classify = '6'
|
||||
|
|
@ -61,4 +48,57 @@
|
|||
and t2.user_id is not null
|
||||
order by t1.create_time desc,t1.by_user_id asc
|
||||
</select>
|
||||
<select id="findLotteryCountList" resultType="com.sqx.modules.ext.dto.LotteryCountQueryDTO">
|
||||
SELECT
|
||||
t1.user_id as userId,
|
||||
t1.avatar,
|
||||
t1.user_name as userName,
|
||||
t1.phone,
|
||||
ifnull( t2.unlocked, 0 ) AS unlocked,
|
||||
ifnull( t2.todayUnlocked, 0 ) AS todayUnlocked,
|
||||
ifnull( t3.totalDrawCount, 0 ) AS totalDrawCount,
|
||||
ifnull( t3.residueDrawCount, 0 ) AS residueDrawCount,
|
||||
ifnull( t3.todayDrawCount, 0 ) AS todayDrawCount
|
||||
FROM
|
||||
v_tb_user t1
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
user_id,
|
||||
count( 1 ) AS unlocked,
|
||||
sum(CASE WHEN pay_time >= DATE_FORMAT(CURDATE(), '%Y-%m-%d 00:00:00') and pay_time <= DATE_FORMAT(CURDATE(), '%Y-%m-%d 23:59:59') then 1 else 0 end) as todayUnlocked
|
||||
FROM
|
||||
v_orders
|
||||
WHERE STATUS = 1 AND pay_way = 9
|
||||
GROUP BY user_id
|
||||
) t2 on t1.user_id = t2.user_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
x.user_id,
|
||||
count(x.orders_id) as totalDrawCount,
|
||||
sum(case when y.source_id is null then 1 else 0 end) as residueDrawCount,
|
||||
sum(case when y.source_id is not null and DATE_FORMAT(y.create_time,'%Y-%m-%d') = CURDATE() then 1 else 0 end) as todayDrawCount
|
||||
FROM v_orders x
|
||||
LEFT JOIN v_disc_spinning_record y ON x.orders_id = y.source_id
|
||||
AND y.source = 'order'
|
||||
WHERE 1 = 1
|
||||
AND x.status = 1
|
||||
AND x.pay_way = 9
|
||||
group by x.user_id
|
||||
) t3 on t1.user_id = t3.user_id
|
||||
<where>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
and (t1.user_name like concat('%',#{keywords},'%') or t1.phone like concat('%',#{keywords},'%'))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="findLotteryDetailPage" resultType="com.sqx.modules.ext.dto.LotteryDetailDTO">
|
||||
select
|
||||
t1.id,
|
||||
t1.name,
|
||||
t1.number,
|
||||
t1.create_time
|
||||
from v_disc_spinning_record t1
|
||||
where t1.user_id = #{userId}
|
||||
order by t1.id asc
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue