| | |
| | | */ |
| | | @Override |
| | | public List<WorldCupListVo> getWorldCupList(WorldCupList worldCupList) { |
| | | if(null == worldCupList.getSort()){ |
| | | worldCupList.setSort(1); |
| | | } |
| | | //没有筛选门店,默认使用当前门店 |
| | | if(null == worldCupList.getStoreId()){ |
| | | worldCupList.setStoreId(worldCupList.getStoreId()); |
| | | } |
| | | return this.baseMapper.getWorldCupList(worldCupList); |
| | | List<WorldCupListVo> worldCupList1 = this.baseMapper.getWorldCupList(worldCupList); |
| | | for (WorldCupListVo worldCupListVo : worldCupList1) { |
| | | Integer id = Integer.valueOf(worldCupListVo.getId()); |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id).eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Integer heat = worldCupListVo.getHeat(); |
| | | if(collect.size() > 0){ |
| | | int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | heat += count; |
| | | } |
| | | worldCupListVo.setHeat(heat); |
| | | } |
| | | |
| | | Collections.sort(worldCupList1, new Comparator<WorldCupListVo>() { |
| | | @Override |
| | | public int compare(WorldCupListVo o1, WorldCupListVo o2) { |
| | | if(worldCupList.getSort() == 1){ |
| | | return o1.getHeat().compareTo(o2.getHeat()); |
| | | } |
| | | if(worldCupList.getSort() == 2){ |
| | | return o1.getHeat().compareTo(o2.getHeat()) * -1; |
| | | } |
| | | return 0; |
| | | } |
| | | }); |
| | | |
| | | return worldCupList1; |
| | | } |
| | | |
| | | |
| | |
| | | jsonArray.add(store.getName()); |
| | | } |
| | | worldCupInfo.setStores(jsonArray.toJSONString()); |
| | | |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id).eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Integer heat = worldCupInfo.getHeat(); |
| | | if(collect.size() > 0){ |
| | | int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | heat += count; |
| | | } |
| | | worldCupInfo.setHeat(heat); |
| | | return worldCupInfo; |
| | | } |
| | | |
| | |
| | | Properties props3 = new Properties(); |
| | | props3.setProperty("algorithm-expression", "t_world_cup_payment_participant$->{worldCupId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_world_cup_payment_participant-inline", new AlgorithmConfiguration("INLINE", props3)); |
| | | result1.getKeyGenerators().put("t_world_cup_payment_participantt-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | result1.getKeyGenerators().put("t_world_cup_payment_participant-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |
| | | linkedList.add(result1); |
| | | return linkedList; |
| | |
| | | |
| | | |
| | | <select id="getWorldCupList" resultType="com.dsh.communityWorldCup.model.WorldCupListVo"> |
| | | select * from ( |
| | | select |
| | | a.id, |
| | | a.name, |
| | | DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | CONCAT(a.startAge, '-', a.endAge) as age, |
| | | a.coverImg, |
| | | a.intro as content, |
| | | a.lon, |
| | | a.lat, |
| | | ifnull(b.num, 0) + a.basePeople as heat |
| | | from t_world_cup a |
| | | left join (select worldCupId, count(*) as num from t_world_cup_payment_participant where worldCupPaymentId in (select id from t_world_cup_payment where payStatus = 2 and refundTime is null and state = 1) group by worldCupId) b on (a.id = b.worldCupId) |
| | | where a.status in (1, 2) order by a.createTime desc |
| | | <if test="null != item.content and '' != item.content"> |
| | | and a.name like CONCAT('%', #{item.content}, '%') |
| | | </if> |
| | | <if test="null != item.storeId"> |
| | | and a.worldCupId in (select worldCupId from t_world_cup_store where storeId = #{item.storeId}) |
| | | </if> |
| | | <if test="null != item.gender"> |
| | | and #{item.gender} between #{startAge} and #{endAge} |
| | | </if> |
| | | ) as aa |
| | | <if test="null != item.sort and 1 == item.sort"> |
| | | order by aa.heat |
| | | select |
| | | a.id, |
| | | a.name, |
| | | DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | CONCAT(a.startAge, '-', a.endAge) as age, |
| | | a.coverImg, |
| | | a.intro as content, |
| | | a.lon, |
| | | a.lat, |
| | | a.basePeople as heat |
| | | from t_world_cup a |
| | | where a.status in (1, 2) |
| | | <if test="null != item.content and '' != item.content"> |
| | | and a.name like CONCAT('%', #{item.content}, '%') |
| | | </if> |
| | | <if test="null != item.sort and 2 == item.sort"> |
| | | order by aa.heat desc |
| | | <if test="null != item.storeId"> |
| | | and a.worldCupId in (select worldCupId from t_world_cup_store where storeId = #{item.storeId}) |
| | | </if> |
| | | <if test="null != item.gender"> |
| | | and #{item.gender} = a.gender |
| | | </if> |
| | | order by a.createTime desc |
| | | </select> |
| | | |
| | | |
| | |
| | | a.id, |
| | | a.infoImg, |
| | | a.name, |
| | | ifnull(b.num, 0) as heat, |
| | | a.basePeople as heat, |
| | | DATE_FORMAT(a.startTime, '%Y-%m-%d %H:%i') as startTime, |
| | | DATE_FORMAT(a.endTime, '%Y-%m-%d %H:%i') as endTime, |
| | | DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | |
| | | a.intro, |
| | | a.content |
| | | from t_world_cup a |
| | | left join (select worldCupId, count(*) as num from t_world_cup_payment_participant where worldCupPaymentId in (select id from t_world_cup_payment where payStatus = 2 and state = 1) group by worldCupId) b on (a.id = b.worldCupId) |
| | | where a.id = #{id} |
| | | </select> |
| | | </mapper> |