答案回复点赞配置
| 11 | * |
| 12 | */ |
| 13 | @Component("answerReplyLikeConfig") |
| 14 | public class AnswerReplyLikeConfig { |
| 15 | |
| 16 | @Resource LikeConfig likeConfig; |
| 17 | |
| 18 | /** 分表数量 **/ |
| 19 | @Value("${bbs.sharding.answerReplyLikeConfig_tableQuantity}") |
| 20 | @Getter |
| 21 | private Integer tableQuantity = 1; |
| 22 | |
| 23 | /** |
| 24 | * 根据答案回复点赞Id查询分配到表编号 |
| 25 | * 根据答案回复点赞Id和答案回复点赞分表数量求余 |
| 26 | * @param answerReplyLikeId 答案回复点赞Id |
| 27 | * 注意:答案回复点赞Id要先判断最后4位是不是数字 |
| 28 | * likeManage.verificationItemLikeId(?) |
| 29 | * @return |
| 30 | */ |
| 31 | public Integer answerReplyLikeIdRemainder(String answerReplyLikeId){ |
| 32 | int answerReplyId = likeConfig.getItemLikeId(answerReplyLikeId); |
| 33 | return answerReplyId % this.getTableQuantity(); |
| 34 | } |
| 35 | /** |
| 36 | * 根据答案回复Id查询分配到表编号 |
| 37 | * 根据答案回复Id和答案回复点赞分表数量求余(用户Id后四位) |
| 38 | * @param answerReplyId 答案回复Id |
| 39 | * @return |
| 40 | */ |
| 41 | public Integer answerReplyIdRemainder(Long answerReplyId){ |
| 42 | //选取得后N位答案回复Id |
| 43 | String afterAnswerReplyId = String.format("%04d", answerReplyId%10000); |
| 44 | return Integer.parseInt(afterAnswerReplyId) % this.getTableQuantity(); |
| 45 | } |
| 46 | |
| 47 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…