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

Commit 21301da6 authored by zhengfuxin's avatar zhengfuxin

修改banner和金刚位

parent b4cdb595
......@@ -16,6 +16,7 @@ import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
import com.liquidnet.service.goblin.mapper.GoblinFrontBannerMapper;
import com.liquidnet.service.kylin.dao.BannerDetailsListDao;
import com.liquidnet.service.kylin.dto.param.BannersSearchParam;
......@@ -87,7 +88,13 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
orderObject
);
//redis 修改
if(redisDataSourceUtil.getRedisGoblinUtil().hasKey(GoblinRedisConst.FRONT_BANNER+"0")){
//从数据库中查出来,从新塞进去
LambdaQueryWrapper<GoblinFrontBanner> queryWrapper = Wrappers.lambdaQuery(GoblinFrontBanner.class);
queryWrapper.ne(GoblinFrontBanner::getDelTag,1);
queryWrapper.orderByDesc(GoblinFrontBanner::getIndexs);
List<GoblinFrontBanner> list=goblinFrontBannerMapper.selectList(queryWrapper);
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_BANNER,list);
/* if(redisDataSourceUtil.getRedisGoblinUtil().hasKey(GoblinRedisConst.FRONT_BANNER+"0")){
ArrayList<GoblinFrontBanner> list = (ArrayList<GoblinFrontBanner>) redisDataSourceUtil.getRedisGoblinUtil().get(GoblinRedisConst.FRONT_BANNER+0);
list= (ArrayList<GoblinFrontBanner>) list.stream().map(goblinFrontBanner1->{
if(goblinFrontBanner1.getBannerId().equals(goblinFrontBanner.getBannerId())){
......@@ -96,7 +103,7 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
return goblinFrontBanner1;
}).collect(Collectors.toList());
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_BANNER+"0",list);
}
}*/
return true;
}
/**
......@@ -113,7 +120,10 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
* @date 2021/12/27 下午4:36
*/
public boolean delte(Long id){
//数据库
GoblinFrontBanner goblinFrontBanner=goblinFrontBannerMapper.selectById(id);
goblinFrontBanner.setDelTag(1);
this.update(goblinFrontBanner);
/* //数据库
goblinFrontBannerMapper.deleteById(id);
//mongodb 删除
mongoTemplate.remove(Query.query(Criteria.where("mid").is(id)), GoblinFrontBanner.class, GoblinFrontBanner.class.getSimpleName());
......@@ -127,7 +137,7 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
return goblinFrontBanner1;
}).collect(Collectors.toList());
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_BANNER+"0",list);
}
}*/
return true;
}
/**
......
package com.liquidnet.client.admin.zhengzai.goblin.service.imp;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontNavigationService;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
import com.liquidnet.service.goblin.mapper.GoblinFrontBannerMapper;
import com.liquidnet.service.goblin.mapper.GoblinFrontNavigationMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mongodb.BasicDBObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
......@@ -31,7 +40,7 @@ public class GoblinFrontNavigationServiceImpl extends ServiceImpl<GoblinFrontNav
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
GoblinFrontNavigationMapper goblinFrontNavigationMapper;
private GoblinFrontNavigationMapper goblinFrontNavigationMapper;
@Autowired
private RedisDataSourceUtil redisDataSourceUtil;
......@@ -57,16 +66,45 @@ public class GoblinFrontNavigationServiceImpl extends ServiceImpl<GoblinFrontNav
}
return true;
}
public boolean update(GoblinFrontNavigation goblinFrontBanner){
public boolean update(GoblinFrontNavigation goblinFrontNavigation){
//数据库修改
goblinFrontNavigationMapper.updateById(goblinFrontNavigation);
//mongodb修改
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontNavigation)));
mongoTemplate.getCollection(GoblinFrontNavigation.class.getSimpleName()).updateOne(
Query.query(Criteria.where("navigationId").is(goblinFrontNavigation.getNavigationId())).getQueryObject(),
orderObject
);
//redis 修改
//从数据库中查出来,从新塞进去
LambdaQueryWrapper<GoblinFrontNavigation> queryWrapper = Wrappers.lambdaQuery(GoblinFrontNavigation.class);
queryWrapper.ne(GoblinFrontNavigation::getDelTag,1);
queryWrapper.orderByDesc(GoblinFrontNavigation::getIndexs);
List<GoblinFrontNavigation> list=goblinFrontNavigationMapper.selectList(queryWrapper);
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_NAVIGATION,list);
return true;
}
public GoblinFrontNavigation getOne(Long id){
return null;
return goblinFrontNavigationMapper.selectById(id);
}
public boolean delte(Long id){
public boolean delete(Long id){
GoblinFrontNavigation goblinFrontNavigation=goblinFrontNavigationMapper.selectById(id);
goblinFrontNavigation.setDelTag(1);
this.update(goblinFrontNavigation);
return true;
}
public PageInfo<GoblinFrontNavigation> page(int pageSize, int pageNumber, GoblinFrontNavigation goblinFrontNavigation) {
return null;
PageInfo<GoblinFrontNavigation> pageInfoTmp = null;
try {
PageHelper.startPage(pageNumber, pageSize);
LambdaQueryWrapper<GoblinFrontNavigation> queryWrapper = Wrappers.lambdaQuery(GoblinFrontNavigation.class);
queryWrapper.orderByDesc(GoblinFrontNavigation::getCreateTime);
List<GoblinFrontNavigation> list=goblinFrontNavigationMapper.selectList(queryWrapper);
pageInfoTmp = new PageInfo(list);
} catch (Exception e) {
return new PageInfo();
}
return pageInfoTmp;
}
}
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