记得上下班打卡 | git大法好,push需谨慎

Commit ee0e0f3d authored by GaoHu's avatar GaoHu

修改初始化条件

parent 1d44c602
...@@ -162,12 +162,16 @@ public class SmileSchoolServiceImpl extends ServiceImpl<SmileSchoolMapper, Smile ...@@ -162,12 +162,16 @@ public class SmileSchoolServiceImpl extends ServiceImpl<SmileSchoolMapper, Smile
*/ */
@PostConstruct @PostConstruct
private void updateRedisSchoolAll(){ private void updateRedisSchoolAll(){
//删除旧redisSchoolAll缓存 Query query = new Query();
smileRedisUtils.delSchoolAll(); long count = mongoTemplate.count(query, SmileSchoolVo.class.getSimpleName());
//跟新缓存 if (count==0){
updateSchoolRedis(); //删除旧redisSchoolAll缓存
//mongodb初始化就数据 smileRedisUtils.delSchoolAll();
saveSmileSchoolMongodb(); //跟新缓存
updateSchoolRedis();
//mongodb初始化就数据
saveSmileSchoolMongodb();
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment