移除广播表
短剧首页 关联查询修改
This commit is contained in:
@@ -53,7 +53,7 @@ public class ShardingConfig {
|
||||
/**
|
||||
* 广播表
|
||||
*/
|
||||
private Set<String> broadcastTables;
|
||||
// private Set<String> broadcastTables;
|
||||
|
||||
/**
|
||||
* 中心库的节点
|
||||
@@ -112,7 +112,7 @@ public class ShardingConfig {
|
||||
shardingRuleConfig.setMasterSlaveRuleConfigs(masterSlaveRuleConfigs());
|
||||
|
||||
// 配置广播表
|
||||
shardingRuleConfig.setBroadcastTables(broadcastTables);
|
||||
// shardingRuleConfig.setBroadcastTables(broadcastTables);
|
||||
|
||||
// 配置表的切分策略
|
||||
shardingRuleConfig.setTableRuleConfigs(addTableRuleConfigs());
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
||||
@@ -20,4 +21,6 @@ public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
||||
|
||||
List<CourseDetails> selectCourseDetailsList(String randomNum,Integer wxShow,Integer dyShow);
|
||||
|
||||
Map<String,Object> countCourse(String courseId);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.sqx.common.utils.*;
|
||||
import com.sqx.modules.app.entity.InviteAchievement;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.RedisUtils;
|
||||
@@ -38,6 +37,7 @@ import com.sqx.modules.course.entity.CourseUser;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import com.sqx.modules.course.service.CourseUserService;
|
||||
import com.sqx.modules.course.vo.CourseIn;
|
||||
import com.sqx.modules.orders.dao.OrdersDao;
|
||||
import com.sqx.modules.orders.service.OrdersService;
|
||||
import com.sqx.modules.redisService.RedisService;
|
||||
import com.sqx.modules.search.service.AppSearchService;
|
||||
@@ -75,6 +75,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
||||
@Autowired
|
||||
private OrdersService ordersService;
|
||||
@Autowired
|
||||
private OrdersDao ordersDao;
|
||||
@Autowired
|
||||
private CommonInfoService commonInfoService;
|
||||
@Autowired
|
||||
private JwtUtils jwtUtils;
|
||||
@@ -171,7 +173,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
||||
}
|
||||
}
|
||||
}
|
||||
Page<Map<String, Object>> pages = new Page<>(page, limit);
|
||||
// 一周的第一天
|
||||
DateTime begin = DateUtil.beginOfWeek(new Date());
|
||||
String startTime = begin.toString();
|
||||
@@ -193,26 +194,35 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
||||
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(map);
|
||||
List<Map<String, Object>> records = pageInfo.getList();
|
||||
for (Map<String, Object> m : records) {
|
||||
Integer i = courseDetailsDao.selectCount(new QueryWrapper<CourseDetails>().eq("course_id", m.get("courseId")));
|
||||
m.put("courseDetailsCount", i == null ? 0 : i);
|
||||
m.put("courseDetailsId", null);
|
||||
m.put("courseDetailsName", "");
|
||||
m.put("dyEpisodeId", "");
|
||||
m.put("wxCourseDetailsId", "");
|
||||
}
|
||||
PageUtils pageUtils = PageUtils.page(pageInfo);
|
||||
PageUtils pageUtils = PageUtils.page(pageInfo, true);
|
||||
setCache(cacheKey, JSONUtil.toJsonStr(pageUtils));
|
||||
return Result.success().put("data", pageUtils);
|
||||
}
|
||||
|
||||
// 无用 ifnull(tt.isRecommend,0) as isRecommend
|
||||
// left join (select course_id,count(*) as isRecommend from course_details where good=1 group by course_id) tt on tt.course_id = c.course_id
|
||||
|
||||
List<Map<String, Object>> list = baseMapper.selectCourseAdmin(classifyId, title, isRecommend, status, bannerId,
|
||||
sort, startTime, endTime, userId, isPrice, over, wxCourse, dyCourse, wxShow, dyShow);
|
||||
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(list);
|
||||
List<Map<String, Object>> records = pageInfo.getList();
|
||||
for (Map<String, Object> map : records) {
|
||||
map.put("courseDetailsId", null);
|
||||
Map<String, Object> countMap = courseDetailsDao.countCourse(map.get("courseId").toString());
|
||||
BigDecimal payMoney = ordersDao.sumPayByCourseId(map.get("courseId").toString());
|
||||
map.put("courseDetailsId", payMoney==null?BigDecimal.ZERO:payMoney);
|
||||
map.put("courseDetailsName", "");
|
||||
map.put("dyEpisodeId", "");
|
||||
map.put("wxCourseDetailsId", "");
|
||||
map.putAll(countMap);
|
||||
}
|
||||
PageUtils pageUtils = PageUtils.page(pageInfo);
|
||||
PageUtils pageUtils = PageUtils.page(pageInfo, true);
|
||||
setCache(cacheKey, JSONUtil.toJsonStr(pageUtils));
|
||||
return Result.success().put("data", pageUtils);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.sqx.modules.orders.entity.Orders;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@@ -43,5 +44,5 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
||||
|
||||
|
||||
Integer countOrderNum(Long userId, String time);
|
||||
|
||||
BigDecimal sumPayByCourseId(String courseId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user