This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cn.jmfen.sport.activitycenter.mapper; | |
import cn.jmfen.sport.activitycenter.bo.ActivityJoinBo; | |
import cn.jmfen.sport.activitycenter.vo.ActivityJoinVo; | |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
import org.apache.ibatis.annotations.Mapper; | |
import org.apache.ibatis.annotations.Param; | |
/** | |
* @Author: Luoma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 生成指定范围之内的数字 [min,max] | |
* | |
* @param min | |
* @param max | |
* @return | |
*/ | |
public static int getRandomRange(int min, int max) { | |
return min + (int) (Math.random() * ((max - min) + 1)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* pipeline批量执行redis命令 | |
* @param zSetMap | |
* @return | |
*/ | |
public List<Object> zSetPipelineBatchAdd(Map<String, Map<Object, Double>> zSetMap) { | |
return redisTemplate.executePipelined(new RedisCallback<String>() { | |
//序列化方式 | |
RedisSerializer keySerializer = redisTemplate.getKeySerializer(); | |
RedisSerializer valueSerializer = redisTemplate.getValueSerializer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
a.activity_id, | |
a.id AS activity_round_id, | |
a.round_num, | |
a.round_start_time, | |
a.round_end_time, | |
a.reward_time, | |
b.start_time AS activity_start_time, | |
b.end_time AS activity_end_time, | |
b.draw_reward_type, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Administrator | |
*/ | |
@Mapper | |
public interface InviteRewardDetailMapper extends SuperMapper<InviteRewardDetailEntity> { | |
/** | |
* 查询活动流水统计 | |
* @param page | |
* @param inviteRewardSearchBo | |
* @return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//精确到小数点后两位,向下取 | |
float calNum = 3.25f; | |
float addExpNum = (float) ((Math.floor((calNum) * 100)) / 100); | |
//去除小数 | |
float afterAddExp = 3.58f; | |
int floor = (int) Math.floor(afterAddExp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM ( | |
SELECT *, CONVERT(SUBSTRING_INDEX(invite_num_range, '-', 1),SIGNED) AS lower, | |
CONVERT(SUBSTRING_INDEX(invite_num_range, '-' ,- 1),SIGNED) AS upper | |
FROM jmf_invite_reward_config) AS a | |
WHERE 0 BETWEEN a.lower-1 AND a.upper ORDER BY a.lower+1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 获取用户抽奖码详情,根据轮次id和用户id | |
* | |
* @param activityRoundIds | |
* @param userId | |
* @return | |
*/ | |
@Select("<script> SELECT a.activity_id,a.activity_round_id,a.lottery_code,a.lottery_code_status,a.round_num, " + | |
" a.user_id,a.user_head_image,a.user_nickname,a.acquire_type,a.activity_join_id, " + | |
" b.id as activity_order_id,b.reward_level_id,b.reward_level,c.winner_lottery_codes,c.draw_status " + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) limit分页公式 | |
(1)limit分页公式:curPage是当前第几页;pageSize是一页多少条记录 | |
limit (curPage-1)*pageSize,pageSize | |
(2)用的地方:sql语句中 | |
select * from student limit(curPage-1)*pageSize,pageSize; | |
2) 总页数公式 | |
(1)总页数公式:totalRecord是总记录数;pageSize是一页分多少条记录 | |
int totalPageNum = (totalRecord +pageSize - 1) / pageSize; | |
(2)用的地方:前台UI分页插件显示分页码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public List<MatchEntity> matchSearchInit(MatchEsSearchItem matchEsSearchItem) { | |
String searchKey = matchEsSearchItem.getSearchKey(); | |
Preconditions.checkArgument(StringUtil.isNotBlank(searchKey), "搜索关键字不能为空!"); | |
//搜索 | |
LocalDate today = LocalDate.now(); | |
Date beginDate = Date.from(today.minusMonths(3).atStartOfDay(ZoneId.systemDefault()).toInstant()); | |
Date endDate = Date.from(today.plusMonths(3).atStartOfDay(ZoneId.systemDefault()).toInstant()); | |
//时间过滤 | |
RangeQueryBuilder rangeQuery = QueryBuilders |
NewerOlder