Compare commits
No commits in common. "fee9dab7857026344cc6663b6b4a3b21de301b3f" and "e648c9b1ee655a942e9940121263ba78bf19c3a8" have entirely different histories.
fee9dab785
...
e648c9b1ee
|
@ -21,11 +21,4 @@ public class Knife4jConfig {
|
||||||
return new OpenAPI().info(new Info().title("尚品甑选API接口文档")
|
return new OpenAPI().info(new Info().title("尚品甑选API接口文档")
|
||||||
.version("1.0").description("尚品甑选API接口文档").contact(new Contact().name("bunny")));
|
.version("1.0").description("尚品甑选API接口文档").contact(new Contact().name("bunny")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public GroupedOpenApi webApi() { // 创建了一个api接口的分组
|
|
||||||
return GroupedOpenApi.builder()
|
|
||||||
.group("web-api") // 分组名称
|
|
||||||
.pathsToMatch("/api/**").build(); // 接口请求路径规则
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,41 +0,0 @@
|
||||||
package com.atguigu.utils;
|
|
||||||
|
|
||||||
import com.atguigu.spzx.model.entity.product.Category;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class CategoryHelper {
|
|
||||||
/**
|
|
||||||
* 构建树型结构
|
|
||||||
*
|
|
||||||
* @param categoryList 分类列表
|
|
||||||
* @return 结构列表
|
|
||||||
*/
|
|
||||||
public static List<Category> buildTree(List<Category> categoryList) {
|
|
||||||
ArrayList<Category> tree = new ArrayList<>();
|
|
||||||
// 将菜单进行遍历
|
|
||||||
categoryList.forEach(category -> {
|
|
||||||
if (category.getParentId() == 0) {
|
|
||||||
tree.add(getChildren(category, categoryList));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Category getChildren(Category category, List<Category> categoryList) {
|
|
||||||
// 遍历所有菜单数据,判断id和parentID对应关系
|
|
||||||
category.setChildren(new ArrayList<>());
|
|
||||||
|
|
||||||
categoryList.forEach(menu -> {
|
|
||||||
if (menu.getChildren() == null) menu.setChildren(new ArrayList<>());
|
|
||||||
if (category.getId().equals(menu.getParentId())) {
|
|
||||||
category.getChildren().add(getChildren(menu, categoryList));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return category;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,9 +23,9 @@ spring:
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.atguigu.spzx.manger.mapper: debug
|
com.atguigu.mapper: debug
|
||||||
com.atguigu.spzx.manger.controller: info
|
com.atguigu.controller: info
|
||||||
com.atguigu.spzx.manger.service: info
|
com.atguigu.service: info
|
||||||
pattern:
|
pattern:
|
||||||
dateformat: HH:mm:ss:SSS
|
dateformat: HH:mm:ss:SSS
|
||||||
file:
|
file:
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package com.atguigu.product.controller;
|
|
||||||
|
|
||||||
import com.atguigu.product.service.CategoryService;
|
|
||||||
import com.atguigu.spzx.model.entity.product.Category;
|
|
||||||
import com.atguigu.spzx.model.vo.result.Result;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Tag(name = "分类接口管理")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/product/category/")
|
|
||||||
@Slf4j
|
|
||||||
@CrossOrigin
|
|
||||||
public class CategoryController {
|
|
||||||
@Autowired
|
|
||||||
private CategoryService categoryService;
|
|
||||||
|
|
||||||
@Operation(summary = "获取分类树形数据", description = "获取分类树形数据")
|
|
||||||
@GetMapping("findCategoryTree")
|
|
||||||
public Result<List<Category>> findCategoryTree() {
|
|
||||||
log.info("===>获取分类树形数据");
|
|
||||||
List<Category> list = categoryService.findCategoryTree();
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,9 +8,7 @@ import com.atguigu.spzx.model.vo.h5.IndexVo;
|
||||||
import com.atguigu.spzx.model.vo.result.Result;
|
import com.atguigu.spzx.model.vo.result.Result;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
@ -20,8 +18,6 @@ import java.util.List;
|
||||||
@Tag(name = "首页接口管理")
|
@Tag(name = "首页接口管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/api/product/index")
|
@RequestMapping(value = "/api/product/index")
|
||||||
@Slf4j
|
|
||||||
@CrossOrigin
|
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoryService categoryService;
|
private CategoryService categoryService;
|
||||||
|
@ -31,7 +27,6 @@ public class IndexController {
|
||||||
@Operation(summary = "获取首页数据", description = "获取首页数据")
|
@Operation(summary = "获取首页数据", description = "获取首页数据")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public Result<IndexVo> findData() {
|
public Result<IndexVo> findData() {
|
||||||
log.info("===>获取首页数据");
|
|
||||||
// 查询以及分类
|
// 查询以及分类
|
||||||
List<Category> categoryList = categoryService.selectOneCategory();
|
List<Category> categoryList = categoryService.selectOneCategory();
|
||||||
// 根据销量排序,获取前十条数据
|
// 根据销量排序,获取前十条数据
|
||||||
|
|
|
@ -13,11 +13,4 @@ public interface CategoryMapper {
|
||||||
* @return 分类列表
|
* @return 分类列表
|
||||||
*/
|
*/
|
||||||
List<Category> findOneCategory();
|
List<Category> findOneCategory();
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所以分类
|
|
||||||
*
|
|
||||||
* @return 分类列表
|
|
||||||
*/
|
|
||||||
List<Category> findAll();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,4 @@ public interface CategoryService {
|
||||||
* @return 分类实体类列表
|
* @return 分类实体类列表
|
||||||
*/
|
*/
|
||||||
List<Category> selectOneCategory();
|
List<Category> selectOneCategory();
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询属性结构
|
|
||||||
*
|
|
||||||
* @return 分类实体类列表
|
|
||||||
*/
|
|
||||||
List<Category> findCategoryTree();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.atguigu.product.service.impl;
|
||||||
import com.atguigu.product.mapper.CategoryMapper;
|
import com.atguigu.product.mapper.CategoryMapper;
|
||||||
import com.atguigu.product.service.CategoryService;
|
import com.atguigu.product.service.CategoryService;
|
||||||
import com.atguigu.spzx.model.entity.product.Category;
|
import com.atguigu.spzx.model.entity.product.Category;
|
||||||
import com.atguigu.utils.CategoryHelper;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -23,16 +22,4 @@ public class CategoryServiceImpl implements CategoryService {
|
||||||
public List<Category> selectOneCategory() {
|
public List<Category> selectOneCategory() {
|
||||||
return categoryMapper.findOneCategory();
|
return categoryMapper.findOneCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询属性结构
|
|
||||||
*
|
|
||||||
* @return 分类实体类列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Category> findCategoryTree() {
|
|
||||||
// 查询所以分类,返回list集合
|
|
||||||
List<Category> categoryList = categoryMapper.findAll();
|
|
||||||
return CategoryHelper.buildTree(categoryList);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,5 @@ bunny:
|
||||||
username: root
|
username: root
|
||||||
password: "02120212"
|
password: "02120212"
|
||||||
|
|
||||||
redis:
|
|
||||||
host: 106.15.251.123
|
|
||||||
port: 6379
|
|
||||||
database: 2
|
|
||||||
|
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: z-bunny.cn:8848
|
server-addr: z-bunny.cn:8848
|
||||||
|
|
||||||
|
|
|
@ -17,26 +17,6 @@ spring:
|
||||||
username: ${bunny.datasource.username}
|
username: ${bunny.datasource.username}
|
||||||
password: "${bunny.datasource.password}"
|
password: "${bunny.datasource.password}"
|
||||||
|
|
||||||
data:
|
|
||||||
redis:
|
|
||||||
host: ${bunny.redis.host}
|
|
||||||
port: ${bunny.redis.port}
|
|
||||||
database: ${bunny.redis.database}
|
|
||||||
|
|
||||||
logging:
|
|
||||||
level:
|
|
||||||
com.atguigu.product.mapper: debug
|
|
||||||
com.atguigu.product.controller: info
|
|
||||||
com.atguigu.product.service: info
|
|
||||||
pattern:
|
|
||||||
dateformat: HH:mm:ss:SSS
|
|
||||||
file:
|
|
||||||
path: "logs/${spring.application.name}"
|
|
||||||
|
|
||||||
mybatis:
|
mybatis:
|
||||||
type-aliases-package: com.atguigu.spzx.model
|
config-location: classpath:mybatis-config.xml
|
||||||
mapper-locations: classpath:/mapper/*/*.xml
|
mapper-locations: classpath:/mapper/*/*.xml
|
||||||
configuration:
|
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
|
||||||
map-underscore-to-camel-case: true
|
|
||||||
auto-mapping-behavior: full
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
-----------------▄██-█▄---------
|
|
||||||
-----------------███▄██▄--------
|
|
||||||
-----------------███████--------
|
|
||||||
-----------------▀███████-------
|
|
||||||
-------------------██████▄▄-----
|
|
||||||
-------------------█████████▄---
|
|
||||||
-------------------██████▄████--
|
|
||||||
-------▄███████████████████████-
|
|
||||||
-----▄███████████████████████▀--
|
|
||||||
---▄██████████████████████------
|
|
||||||
---███████████████████████------
|
|
||||||
---███████████████████████------
|
|
||||||
-▄▄██████████████████████▀------
|
|
||||||
-█████████████████▀█████--------
|
|
||||||
-▀██████████████▀▀-▀█████▄------
|
|
||||||
-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
|
@ -4,7 +4,7 @@
|
||||||
<contextName>logback</contextName>
|
<contextName>logback</contextName>
|
||||||
|
|
||||||
<!-- 日志的输出目录 -->
|
<!-- 日志的输出目录 -->
|
||||||
<property name="log.path" value="logs/service-product/logs"/>
|
<property name="log.path" value="logs//spzx-manager//logs"/>
|
||||||
|
|
||||||
<!--控制台日志格式:彩色日志-->
|
<!--控制台日志格式:彩色日志-->
|
||||||
<!-- magenta:洋红 -->
|
<!-- magenta:洋红 -->
|
||||||
|
|
|
@ -11,20 +11,7 @@
|
||||||
select
|
select
|
||||||
<include refid="columns"/>
|
<include refid="columns"/>
|
||||||
from category
|
from category
|
||||||
where parent_id = 0
|
where is_deleted = 0
|
||||||
and status = 1
|
and parent_id = #{parentId} order by id
|
||||||
and is_deleted = 0
|
|
||||||
order by order_num
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 查询所以分类 -->
|
|
||||||
<select id="findAll" resultType="com.atguigu.spzx.model.entity.product.Category">
|
|
||||||
select
|
|
||||||
<include refid="columns"/>
|
|
||||||
from category
|
|
||||||
where
|
|
||||||
status = 1
|
|
||||||
and is_deleted = 0
|
|
||||||
order by order_num
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE configuration PUBLIC
|
|
||||||
"-//mybatis.org//DTD Config 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
|
||||||
<configuration>
|
|
||||||
<settings>
|
|
||||||
<!-- 设置驼峰标识 -->
|
|
||||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
|
||||||
<!-- 打印SQL语句 -->
|
|
||||||
<setting name="logImpl" value="STDOUT_LOGGING"/>
|
|
||||||
</settings>
|
|
||||||
<plugins>
|
|
||||||
<!-- 分页插件 -->
|
|
||||||
<plugin interceptor="com.github.pagehelper.PageInterceptor"/>
|
|
||||||
</plugins>
|
|
||||||
</configuration>
|
|
Loading…
Reference in New Issue