Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
3ef249a5d4
|
|
@ -23,6 +23,11 @@ public class SpringContextUtils implements ApplicationContextAware {
|
|||
return applicationContext.getBean(name);
|
||||
}
|
||||
|
||||
public static Object getSpringBean(Class<?> clazz) {
|
||||
return applicationContext == null ? null : applicationContext.getBean(clazz);
|
||||
}
|
||||
|
||||
|
||||
public static <T> T getBean(String name, Class<T> requiredType) {
|
||||
return applicationContext.getBean(name, requiredType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.sqx.config;
|
||||
|
||||
import com.sqx.modules.utils.InvitationCodeUtil;
|
||||
import com.sqx.sharding.MasterSlaveRules;
|
||||
import com.sqx.sharding.ShardingDataBase;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
|
|
@ -8,10 +9,12 @@ import lombok.Data;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfiguration;
|
||||
import org.apache.shardingsphere.api.config.sharding.KeyGeneratorConfiguration;
|
||||
import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
|
||||
import org.apache.shardingsphere.api.config.sharding.TableRuleConfiguration;
|
||||
import org.apache.shardingsphere.api.config.sharding.strategy.InlineShardingStrategyConfiguration;
|
||||
import org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory;
|
||||
import org.codehaus.groovy.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
@ -47,6 +50,11 @@ public class ShardingConfig {
|
|||
*/
|
||||
private String showSql;
|
||||
|
||||
/**
|
||||
* 广播表
|
||||
*/
|
||||
private Set<String> broadcastTables;
|
||||
|
||||
/**
|
||||
* 中心库的节点
|
||||
*/
|
||||
|
|
@ -103,6 +111,9 @@ public class ShardingConfig {
|
|||
// 配置数据库主从
|
||||
shardingRuleConfig.setMasterSlaveRuleConfigs(masterSlaveRuleConfigs());
|
||||
|
||||
// 配置广播表
|
||||
shardingRuleConfig.setBroadcastTables(broadcastTables);
|
||||
|
||||
// 配置表的切分策略
|
||||
shardingRuleConfig.setTableRuleConfigs(addTableRuleConfigs());
|
||||
|
||||
|
|
@ -131,35 +142,44 @@ public class ShardingConfig {
|
|||
String.format(centerTablesDataNode, centerTable));
|
||||
sets.add(tableRuleConfig);
|
||||
}
|
||||
if ("prod".equals(activeProfile)) {
|
||||
// 定义区域表的分库规则
|
||||
InlineShardingStrategyConfiguration databaseShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
||||
regionTablesShardingDatabaseColumn, regionTablesShardingDatabaseAlgorithm);
|
||||
for (String regionTable : regionTables) {
|
||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||
tableRuleConfig.setDatabaseShardingStrategyConfig(databaseShardingStrategyConfig);
|
||||
sets.add(tableRuleConfig);
|
||||
// 定义区域表的分库规则
|
||||
InlineShardingStrategyConfiguration databaseShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
||||
regionTablesShardingDatabaseColumn, regionTablesShardingDatabaseAlgorithm);
|
||||
for (String regionTable : regionTables) {
|
||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||
tableRuleConfig.setDatabaseShardingStrategyConfig(databaseShardingStrategyConfig);
|
||||
// 设置区域表使用雪花算法生成主键
|
||||
switch (regionTable){
|
||||
case "orders":
|
||||
tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "orders_id"));
|
||||
break;
|
||||
case "course_collect":
|
||||
tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "course_collect_id"));
|
||||
break;
|
||||
case "course_user":
|
||||
tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "course_user_id"));
|
||||
break;
|
||||
case "tb_user":
|
||||
tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "user_id"));
|
||||
break;
|
||||
default:
|
||||
tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "id"));
|
||||
break;
|
||||
}
|
||||
sets.add(tableRuleConfig);
|
||||
}
|
||||
|
||||
// 定义区域表的分库规则
|
||||
InlineShardingStrategyConfiguration courseDetailsShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
||||
courseDetailsShardingDatabaseColumn, courseDetailsShardingDatabaseAlgorithm);
|
||||
for (String regionTable : courseDetails) {
|
||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||
tableRuleConfig.setDatabaseShardingStrategyConfig(courseDetailsShardingStrategyConfig);
|
||||
sets.add(tableRuleConfig);
|
||||
}
|
||||
}else {
|
||||
for (String centerTable : regionTables) {
|
||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(centerTable,
|
||||
String.format(centerTablesDataNode, centerTable));
|
||||
sets.add(tableRuleConfig);
|
||||
}
|
||||
for (String centerTable : courseDetails) {
|
||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(centerTable,
|
||||
String.format(centerTablesDataNode, centerTable));
|
||||
sets.add(tableRuleConfig);
|
||||
}
|
||||
// 定义区域表的分库规则
|
||||
InlineShardingStrategyConfiguration courseDetailsShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
||||
courseDetailsShardingDatabaseColumn, courseDetailsShardingDatabaseAlgorithm);
|
||||
for (String regionTable : courseDetails) {
|
||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||
tableRuleConfig.setDatabaseShardingStrategyConfig(courseDetailsShardingStrategyConfig);
|
||||
// 设置区域表使用雪花算法生成主键
|
||||
KeyGeneratorConfiguration keyGeneratorConfig = new KeyGeneratorConfiguration("SNOWFLAKE", "id");
|
||||
tableRuleConfig.setKeyGeneratorConfig(keyGeneratorConfig);
|
||||
|
||||
sets.add(tableRuleConfig);
|
||||
}
|
||||
return sets;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
package com.sqx.config;
|
||||
|
||||
/**
|
||||
* 描述: Twitter的分布式自增ID雪花算法snowflake (Java版)
|
||||
**/
|
||||
public class SnowFlake {
|
||||
|
||||
/**
|
||||
* 起始的时间戳
|
||||
*/
|
||||
private final static long START_STMP = 1480166465631L;
|
||||
|
||||
/**
|
||||
* 每一部分占用的位数
|
||||
*/
|
||||
private final static long SEQUENCE_BIT = 12; //序列号占用的位数
|
||||
private final static long MACHINE_BIT = 5; //机器标识占用的位数
|
||||
private final static long DATACENTER_BIT = 5;//数据中心占用的位数
|
||||
|
||||
/**
|
||||
* 每一部分的最大值
|
||||
*/
|
||||
private final static long MAX_DATACENTER_NUM = ~(-1L << DATACENTER_BIT);
|
||||
private final static long MAX_MACHINE_NUM = ~(-1L << MACHINE_BIT);
|
||||
private final static long MAX_SEQUENCE = ~(-1L << SEQUENCE_BIT);
|
||||
|
||||
/**
|
||||
* 每一部分向左的位移
|
||||
*/
|
||||
private final static long MACHINE_LEFT = SEQUENCE_BIT;
|
||||
private final static long DATACENTER_LEFT = SEQUENCE_BIT + MACHINE_BIT;
|
||||
private final static long TIMESTMP_LEFT = DATACENTER_LEFT + DATACENTER_BIT;
|
||||
|
||||
/**
|
||||
* 数据中心
|
||||
*/
|
||||
private long datacenterId;
|
||||
/**
|
||||
* 机器标识
|
||||
*/
|
||||
private long machineId;
|
||||
/**
|
||||
* 代表了一毫秒内生成的多个id的最新序号
|
||||
*/
|
||||
private long sequence = 10000L;
|
||||
/**
|
||||
* 上一次时间戳
|
||||
*/
|
||||
private long lastStmp = -1L;
|
||||
|
||||
public SnowFlake() {
|
||||
}
|
||||
|
||||
public SnowFlake(long datacenterId, long machineId) {
|
||||
if (datacenterId > MAX_DATACENTER_NUM || datacenterId < 0) {
|
||||
throw new IllegalArgumentException("datacenterId can't be greater than MAX_DATACENTER_NUM or less than 0");
|
||||
}
|
||||
if (machineId > MAX_MACHINE_NUM || machineId < 0) {
|
||||
throw new IllegalArgumentException("machineId can't be greater than MAX_MACHINE_NUM or less than 0");
|
||||
}
|
||||
this.datacenterId = datacenterId;
|
||||
this.machineId = machineId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 产生下一个ID
|
||||
*
|
||||
* @param ifEvenNum 是否偶数 true 时间不连续全是偶数 时间连续 奇数偶数 false 时间不连续 奇偶都有 所以一般建议用false
|
||||
*/
|
||||
public synchronized long nextId(boolean ifEvenNum) {
|
||||
long currStmp = getNewstmp();
|
||||
if (currStmp < lastStmp) {
|
||||
throw new RuntimeException("Clock moved backwards. Refusing to generate id");
|
||||
}
|
||||
/**
|
||||
* 时间不连续出来全是偶数
|
||||
*/
|
||||
if (ifEvenNum) {
|
||||
if (currStmp == lastStmp) {
|
||||
//相同毫秒内,序列号自增
|
||||
sequence = (sequence + 1) & MAX_SEQUENCE;
|
||||
//同一毫秒的序列数已经达到最大
|
||||
if (sequence == 0L) {
|
||||
currStmp = getNextMill();
|
||||
}
|
||||
} else {
|
||||
//不同毫秒内,序列号置为0
|
||||
sequence = 0L;
|
||||
}
|
||||
} else {
|
||||
//相同毫秒内,序列号自增
|
||||
sequence = (sequence + 1) & MAX_SEQUENCE;
|
||||
}
|
||||
|
||||
lastStmp = currStmp;
|
||||
|
||||
return (currStmp - START_STMP) << TIMESTMP_LEFT //时间戳部分
|
||||
| datacenterId << DATACENTER_LEFT //数据中心部分
|
||||
| machineId << MACHINE_LEFT //机器标识部分
|
||||
| sequence; //序列号部分
|
||||
}
|
||||
|
||||
private long getNextMill() {
|
||||
long mill = getNewstmp();
|
||||
while (mill <= lastStmp) {
|
||||
mill = getNewstmp();
|
||||
}
|
||||
return mill;
|
||||
}
|
||||
|
||||
private long getNewstmp() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.sqx.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SnowFlakeConfig {
|
||||
/**
|
||||
* 数据中心
|
||||
*/
|
||||
@Value("${snowflake.datacenterId}")
|
||||
private String datacenterId;
|
||||
/**
|
||||
* 机器标识
|
||||
*/
|
||||
@Value("${snowflake.machineId}")
|
||||
private String machineId;
|
||||
|
||||
@Bean(name = "snowFlake")
|
||||
public SnowFlake snowFlake() {
|
||||
return new SnowFlake(Long.parseLong(datacenterId), Long.parseLong(machineId));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
package com.sqx.modules.app.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.announcement.entity.Announcement;
|
||||
import com.sqx.modules.announcement.service.AnnouncementService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -21,10 +23,11 @@ public class AppAnnouncementController {
|
|||
|
||||
@GetMapping
|
||||
public Result get() {
|
||||
List<Announcement> records = announcementService.page(new Page<>(1, 1), new LambdaQueryWrapper<Announcement>()
|
||||
.eq(Announcement::getState, 1)
|
||||
.orderByDesc(Announcement::getCreateTime)).getRecords();
|
||||
return Result.success().put("data", records.isEmpty() ? null : records.get(0));
|
||||
PageHelper.startPage(1,1);
|
||||
List<Announcement> list = announcementService.list(new LambdaQueryWrapper<Announcement>()
|
||||
.eq(Announcement::getState, 1)
|
||||
.orderByDesc(Announcement::getCreateTime));
|
||||
return Result.success().put("data", list.isEmpty() ? null : list.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@ package com.sqx.modules.app.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.UserInfo;
|
||||
import com.sqx.modules.app.service.UserInfoService;
|
||||
import com.sqx.modules.app.mapper.UserInfoMapper;
|
||||
import com.sqx.modules.app.service.UserInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
|
|||
queryWrapper.in("classify", arrayList);
|
||||
}
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(baseMapper.selectList(queryWrapper))));
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(baseMapper.selectList(queryWrapper)),true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.sqx.modules.discSpinning.controller;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.exception.CzgException;
|
||||
import com.sqx.common.utils.*;
|
||||
|
|
@ -27,7 +28,9 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
|
@ -126,8 +129,10 @@ public class DiscSpinningController {
|
|||
})
|
||||
@ApiOperation("查询大转盘")
|
||||
public Result selectDiscSpinning(@RequestParam(required = false, defaultValue = "1") Integer source) {
|
||||
return Result.success().put("data", discSpinningService.page(new Page<>(1, 20),
|
||||
new QueryWrapper<DiscSpinning>().eq("disc_type", source).orderByAsc("disc_type", "odds")));
|
||||
PageHelper.startPage(1,20);
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(discSpinningService.list(
|
||||
new QueryWrapper<DiscSpinning>().eq("disc_type", source).orderByAsc("disc_type", "odds"))),true)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package com.sqx.modules.invite.controller.app;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.annotation.Login;
|
||||
|
|
@ -25,7 +25,6 @@ import com.sqx.modules.invite.service.InviteAwardService;
|
|||
import com.sqx.modules.invite.service.InviteMoneyService;
|
||||
import com.sqx.modules.invite.service.InviteService;
|
||||
import com.sqx.modules.urlAddress.service.UrlAddressService;
|
||||
import com.sqx.modules.userSign.entity.UserSignRecord;
|
||||
import com.sqx.modules.utils.SenInfoCheckUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -36,7 +35,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -170,7 +168,8 @@ public class AppInviteController {
|
|||
@GetMapping("/selectInviteAwardList")
|
||||
@ApiOperation("查询邀请奖励列表")
|
||||
public Result selectInviteAwardList(Integer page, Integer limit) {
|
||||
return Result.success().put("data", inviteAwardService.page(new Page<>(page, limit), new QueryWrapper<InviteAward>().orderByAsc("invite_count")));
|
||||
PageHelper.startPage(page,limit);
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(inviteAwardService.list(new QueryWrapper<InviteAward>().orderByAsc("invite_count"))),true));
|
||||
}
|
||||
|
||||
@Login
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package com.sqx.modules.taskCenter.controller;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.taskCenter.entity.TaskCenter;
|
||||
|
|
@ -13,7 +15,6 @@ import com.sqx.modules.taskCenter.entity.TaskCenterReward;
|
|||
import com.sqx.modules.taskCenter.service.TaskCenterRecordService;
|
||||
import com.sqx.modules.taskCenter.service.TaskCenterRewardService;
|
||||
import com.sqx.modules.taskCenter.service.TaskCenterService;
|
||||
import com.sqx.modules.userSign.entity.UserSignRecord;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -74,7 +75,8 @@ public class TaskCenterController {
|
|||
@GetMapping("/taskCenter/selectTaskCenter")
|
||||
@ApiOperation("查询任务中心")
|
||||
public Result selectTaskCenter(Integer page, Integer limit) {
|
||||
return Result.success().put("data", taskCenterService.page(new Page<>(page, limit), new QueryWrapper<TaskCenter>().orderByAsc("sort", "type")));
|
||||
PageHelper.startPage(page,limit);
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(taskCenterService.list(new QueryWrapper<TaskCenter>().orderByAsc("sort", "type"))),true));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
package com.sqx.modules.utils;
|
||||
|
||||
import com.sqx.common.utils.SpringContextUtils;
|
||||
import com.sqx.config.SnowFlake;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 邀请码生成解密工具类
|
||||
*
|
||||
|
|
@ -122,5 +127,8 @@ public class InvitationCodeUtil {
|
|||
return res;
|
||||
}
|
||||
|
||||
// public static String getSnowFlakeId() {
|
||||
// return String.valueOf(((SnowFlake) Objects.requireNonNull(SpringContextUtils.getSpringBean(SnowFlake.class))).nextId(false));
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ minimum-idle: 5
|
|||
# 最大连接数,小于等于0会被重置为默认值10;大于零小于1会被重置为minimum-idle的值
|
||||
maximum-pool-size: 15
|
||||
# 空闲连接超时时间,默认值600000(10分钟),大于等于max-lifetime且max-lifetime>0,会被重置为0;不等于0且小于10秒,会被重置为10秒。
|
||||
idle-timeout: 30000
|
||||
idle-timeout: 20000
|
||||
# 连接最大存活时间.不等于0且小于30秒,会被重置为默认值30分钟.设置应该比mysql设置的超时时间短
|
||||
max-lifetime: 30000
|
||||
# 连接超时时间:毫秒,小于250毫秒,否则被重置为默认值30秒
|
||||
|
|
@ -22,13 +22,22 @@ spring:
|
|||
# sharding-jdbc 配置
|
||||
shardingsphere:
|
||||
# 显示sharding-jdbc改写的sql语句
|
||||
show-sql: false
|
||||
show-sql: true
|
||||
|
||||
center-tables-data-node: duanju.%s
|
||||
# 区域表的数据源节点
|
||||
region-tables-data-node: duanju-$->{0..4}.%s
|
||||
# 区域分库策略的计算字段
|
||||
region-tables-sharding-database-column: user_id
|
||||
# 分库的计算方法
|
||||
region-tables-sharding-database-algorithm: duanju-$->{user_id % 5}
|
||||
|
||||
# 短剧集表 拆分
|
||||
course_details-sharding-database-column: course_id
|
||||
course_details-sharding-database-algorithm: duanju-$->{course_id % 5}
|
||||
# 数据源名称
|
||||
datasource:
|
||||
# 数据源配置begin
|
||||
master-0:
|
||||
duanju:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
|
|
@ -38,7 +47,59 @@ spring:
|
|||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-0:
|
||||
# 数据源配置begin
|
||||
duanju-0:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju-0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
password: VideoUser@1
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-1:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju-1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
password: VideoUser@1
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-2:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju-2?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
password: VideoUser@1
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-3:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju-3?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
password: VideoUser@1
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
duanju-4:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju-4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
password: VideoUser@1
|
||||
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
|
||||
|
|
@ -48,13 +109,88 @@ spring:
|
|||
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
|
||||
master-slave-rules:
|
||||
#数据源
|
||||
duanju:
|
||||
master-data-source-name: master-0
|
||||
slave-data-source-names: slave-0
|
||||
# - master-0
|
||||
# - slave-0
|
||||
masterDataSourceName: duanju
|
||||
slaveDataSourceNames:
|
||||
# - duanju
|
||||
- duanju-slave
|
||||
duanju-0:
|
||||
masterDataSourceName: duanju-0
|
||||
slaveDataSourceNames:
|
||||
# - duanju-0
|
||||
- duanju-slave-0
|
||||
duanju-1:
|
||||
masterDataSourceName: duanju-1
|
||||
slaveDataSourceNames:
|
||||
# - duanju-1
|
||||
- duanju-slave-1
|
||||
duanju-2:
|
||||
masterDataSourceName: duanju-2
|
||||
slaveDataSourceNames:
|
||||
# - duanju-2
|
||||
- duanju-slave-2
|
||||
duanju-3:
|
||||
masterDataSourceName: duanju-3
|
||||
slaveDataSourceNames:
|
||||
# - duanju-3
|
||||
- duanju-slave-3
|
||||
duanju-4:
|
||||
masterDataSourceName: duanju-4
|
||||
slaveDataSourceNames:
|
||||
# - duanju-4
|
||||
- duanju-slave-4
|
||||
|
|
|
|||
|
|
@ -1,184 +0,0 @@
|
|||
swagger:
|
||||
enabled: false
|
||||
pay:
|
||||
h5BaseUrl: https://dj-h5.hnsiyao.cn/me/detail/detail?allId=
|
||||
orderNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/notify
|
||||
extractNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/extractNotify
|
||||
|
||||
# 数据源的一些配置
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 最小空闲连接,默认值10,小于0或大于maximum-pool-size,都会重置为maximum-pool-size
|
||||
minimum-idle: 5
|
||||
# 最大连接数,小于等于0会被重置为默认值10;大于零小于1会被重置为minimum-idle的值
|
||||
maximum-pool-size: 15
|
||||
# 空闲连接超时时间,默认值600000(10分钟),大于等于max-lifetime且max-lifetime>0,会被重置为0;不等于0且小于10秒,会被重置为10秒。
|
||||
idle-timeout: 30000
|
||||
# 连接最大存活时间.不等于0且小于30秒,会被重置为默认值30分钟.设置应该比mysql设置的超时时间短
|
||||
max-lifetime: 30000
|
||||
# 连接超时时间:毫秒,小于250毫秒,否则被重置为默认值30秒
|
||||
connection-timeout: 30000
|
||||
|
||||
spring:
|
||||
# sharding-jdbc 配置
|
||||
shardingsphere:
|
||||
center-tables-data-node: duanju.%s
|
||||
# 区域表的数据源节点
|
||||
region-tables-data-node: duanju-$->{0..4}.%s
|
||||
# 区域分库策略的计算字段
|
||||
region-tables-sharding-database-column: user_id
|
||||
# 分库的计算方法
|
||||
region-tables-sharding-database-algorithm: duanju-$->{Math.abs(user_id) % 5}
|
||||
|
||||
# 短剧集表 拆分
|
||||
course_details-sharding-database-column: course_id
|
||||
course_details-sharding-database-algorithm: duanju-$->{Math.abs(course_id) % 5}
|
||||
|
||||
# 显示sharding-jdbc改写的sql语句
|
||||
show-sql: false
|
||||
# 数据源名称
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc7xx913734hv5w5q.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
password: VideoUser@1
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
# 数据源配置begin
|
||||
master-0:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-1:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-2:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-3:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-4:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-0:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-1:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-2:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-3:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-4:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
# 数据源配置end
|
||||
|
||||
# 读写分离配置begin
|
||||
master-slave-rules:
|
||||
#数据源
|
||||
duanju:
|
||||
master-data-source-name: master
|
||||
slave-data-source-names: slave
|
||||
duanju-0:
|
||||
master-data-source-name: master-0
|
||||
slave-data-source-names: slave-0
|
||||
duanju-1:
|
||||
master-data-source-name: master-1
|
||||
slave-data-source-names: slave-1
|
||||
duanju-2:
|
||||
master-data-source-name: master-2
|
||||
slave-data-source-names: slave-2
|
||||
duanju-3:
|
||||
master-data-source-name: master-3
|
||||
slave-data-source-names: slave-3
|
||||
duanju-4:
|
||||
master-data-source-name: master-4
|
||||
slave-data-source-names: slave-4
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ minimum-idle: 5
|
|||
# 最大连接数,小于等于0会被重置为默认值10;大于零小于1会被重置为minimum-idle的值
|
||||
maximum-pool-size: 15
|
||||
# 空闲连接超时时间,默认值600000(10分钟),大于等于max-lifetime且max-lifetime>0,会被重置为0;不等于0且小于10秒,会被重置为10秒。
|
||||
idle-timeout: 30000
|
||||
idle-timeout: 20000
|
||||
# 连接最大存活时间.不等于0且小于30秒,会被重置为默认值30分钟.设置应该比mysql设置的超时时间短
|
||||
max-lifetime: 30000
|
||||
# 连接超时时间:毫秒,小于250毫秒,否则被重置为默认值30秒
|
||||
|
|
|
|||
|
|
@ -19,25 +19,33 @@ management:
|
|||
db:
|
||||
enabled: false #关闭数据库健康检查isV
|
||||
#mybatis
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:/mapper/**/*.xml
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: com.sqx.modules.*.entity
|
||||
global-config:
|
||||
#数据库相关配置
|
||||
db-config:
|
||||
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
|
||||
id-type: AUTO
|
||||
logic-delete-value: -1
|
||||
logic-not-delete-value: 0
|
||||
banner: false
|
||||
#原生配置
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
cache-enabled: false
|
||||
call-setters-on-nulls: true
|
||||
jdbc-type-for-null: 'null'
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
pagehelper:
|
||||
offsetAsPageNum: true
|
||||
rowBoundsWithCount: true
|
||||
helperDialect: mysql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
params:
|
||||
count: countSql
|
||||
#mybatis-plus:
|
||||
# mapper-locations: classpath*:/mapper/**/*.xml
|
||||
# #实体扫描,多个package用逗号或者分号分隔
|
||||
# typeAliasesPackage: com.sqx.modules.*.entity
|
||||
# global-config:
|
||||
# #数据库相关配置
|
||||
# db-config:
|
||||
# #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
|
||||
# id-type: AUTO
|
||||
# logic-delete-value: -1
|
||||
# logic-not-delete-value: 0
|
||||
# banner: false
|
||||
# #原生配置
|
||||
# configuration:
|
||||
# map-underscore-to-camel-case: true
|
||||
# cache-enabled: false
|
||||
# call-setters-on-nulls: true
|
||||
# jdbc-type-for-null: 'null'
|
||||
## log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
sqx:
|
||||
redis:
|
||||
|
|
@ -59,13 +67,18 @@ limit:
|
|||
urlRate: 10 # 同一用户单url每秒限制次数
|
||||
ipJumpLimit: 4 # 同一ip每分钟跳动次数
|
||||
|
||||
# 指定sharding-jdbc雪花算法的工作机器ID
|
||||
snowflake:
|
||||
datacenterId: 1
|
||||
machineId: 3
|
||||
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true
|
||||
# 环境 dev|test|prod
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
# jackson时间格式化
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
|
|
@ -93,6 +106,9 @@ spring:
|
|||
# pathmatch:
|
||||
# matching-strategy: ant_path_matcher
|
||||
shardingsphere:
|
||||
#广播表
|
||||
broadcast-tables:
|
||||
- course
|
||||
# 短剧集表 通过course_id 分
|
||||
course-details:
|
||||
- course_details
|
||||
|
|
@ -111,15 +127,17 @@ spring:
|
|||
- user_sign_record
|
||||
- invite_achievement
|
||||
- invite_money
|
||||
- user_info
|
||||
- sys_user
|
||||
#中心表
|
||||
center-tables:
|
||||
- message_info
|
||||
- announcement
|
||||
- schedule_job_log
|
||||
- invite
|
||||
- msg
|
||||
- sys_role_menu
|
||||
- sdk_info
|
||||
- course
|
||||
- user_integral_details
|
||||
- common_info
|
||||
- sys_log
|
||||
|
|
@ -128,7 +146,6 @@ spring:
|
|||
- sys_user_role
|
||||
- sys_menu
|
||||
- comment_good
|
||||
- sys_user
|
||||
- course_comment
|
||||
- banner
|
||||
- disc_spinning
|
||||
|
|
|
|||
|
|
@ -5,28 +5,23 @@
|
|||
|
||||
|
||||
<select id="selectCourseByCollect" resultType="com.sqx.modules.course.entity.Course">
|
||||
SELECT
|
||||
MAX(u.update_time) AS produceEndTime,
|
||||
c.*,
|
||||
d.course_details_name AS courseDetailsName,
|
||||
d.course_details_id AS courseDetailsId,
|
||||
COUNT(d.course_details_id) AS courseDetailsCount
|
||||
FROM
|
||||
course_collect u
|
||||
LEFT JOIN
|
||||
course c ON u.course_id = c.course_id
|
||||
LEFT JOIN
|
||||
course_details d ON u.course_details_id = d.course_details_id
|
||||
LEFT JOIN
|
||||
course_collect cc ON u.course_id = cc.course_id AND cc.user_id = #{userId} AND cc.classify = 3
|
||||
WHERE
|
||||
u.user_id = #{userId}
|
||||
AND u.classify = #{classify}
|
||||
AND c.course_id IS NOT NULL
|
||||
GROUP BY
|
||||
u.course_id, c.course_id, d.course_details_name, d.course_details_id
|
||||
ORDER BY
|
||||
produceEndTime DESC;
|
||||
SELECT MAX(u.update_time) AS produceEndTime,
|
||||
c.*,
|
||||
d.course_details_name AS courseDetailsName,
|
||||
d.course_details_id AS courseDetailsId,
|
||||
COUNT(d.course_details_id) AS courseDetailsCount
|
||||
FROM course_collect u
|
||||
LEFT JOIN
|
||||
course c ON u.course_id = c.course_id
|
||||
LEFT JOIN
|
||||
course_details d ON u.course_details_id = d.course_details_id
|
||||
LEFT JOIN
|
||||
course_collect cc ON u.course_id = cc.course_id AND cc.user_id = #{userId} AND cc.classify = 3
|
||||
WHERE u.user_id = #{userId}
|
||||
AND u.classify = #{classify}
|
||||
AND c.course_id IS NOT NULL
|
||||
GROUP BY u.course_id, c.course_id, d.course_details_name, d.course_details_id
|
||||
ORDER BY produceEndTime DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue