导出最新sql,优化首页数据

This commit is contained in:
hupeng
2020-03-07 11:23:18 +08:00
parent 529fc770ee
commit dc1fa321bc
17 changed files with 3324 additions and 6562 deletions

View File

@ -4,6 +4,7 @@ import co.yixiang.utils.SpringContextHolder;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
@ -16,6 +17,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableAsync
@SpringBootApplication
@EnableTransactionManagement
@EnableCaching
@MapperScan({"co.yixiang.modules.*.mapper"})
public class ApiRun {

View File

@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

View File

@ -16,13 +16,13 @@ import co.yixiang.constant.ShopConstants;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.RedisUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@ -50,14 +50,11 @@ public class IndexController {
@AnonymousAccess
@Cacheable(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY)
@GetMapping("/index")
@ApiOperation(value = "首页数据",notes = "首页数据")
public ApiResult<Map<String,Object>> index(){
if(RedisUtil.get(ShopConstants.YSHOP_REDIS_INDEX_KEY) != null){
return ApiResult.ok(RedisUtil.get(ShopConstants.YSHOP_REDIS_INDEX_KEY));
}
Map<String,Object> map = new LinkedHashMap<>();
//banner
map.put("banner",systemGroupDataService.getDatas("routine_home_banner"));
@ -79,10 +76,6 @@ public class IndexController {
//滚动
map.put("roll",systemGroupDataService.getDatas("routine_home_roll_news"));
//缓存
RedisUtil.set(ShopConstants.YSHOP_REDIS_INDEX_KEY,map,ShopConstants.YSHOP_REDIS_INDEX_KEY_EXPIRE);
return ApiResult.ok(map);
}