Compare commits
3 Commits
ce9ccd4fd9
...
e648c9b1ee
Author | SHA1 | Date |
---|---|---|
|
e648c9b1ee | |
|
a68ae1f34e | |
|
793030157f |
|
@ -8,10 +8,16 @@
|
|||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="spzx-model" />
|
||||
<module name="spzx-server-gateway" />
|
||||
<module name="common-util" />
|
||||
<module name="common-log" />
|
||||
<module name="service-product-client" />
|
||||
<module name="common-service" />
|
||||
<module name="service-product" />
|
||||
<module name="service-user" />
|
||||
<module name="spzx-manager" />
|
||||
<module name="service-user-client" />
|
||||
<module name="common-log" />
|
||||
<module name="service-order" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
|
@ -20,8 +26,16 @@
|
|||
<module name="common-log" options="-parameters" />
|
||||
<module name="common-service" options="-parameters" />
|
||||
<module name="common-util" options="-parameters" />
|
||||
<module name="service-order" options="-parameters" />
|
||||
<module name="service-product" options="-parameters" />
|
||||
<module name="service-product-client" options="-parameters" />
|
||||
<module name="service-user" options="-parameters" />
|
||||
<module name="service-user-client" options="-parameters" />
|
||||
<module name="spzx-manager" options="-parameters" />
|
||||
<module name="spzx-model" options="-parameters" />
|
||||
<module name="spzx-server-gateway" options="-parameters" />
|
||||
<module name="spzx-service" options="" />
|
||||
<module name="spzx-service-client" options="" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -8,6 +8,17 @@
|
|||
<file url="file://$PROJECT_DIR$/spzx-common/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-manager/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-model/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-server-gateway/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service-client/service-product-client/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service-client/service-user-client/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service-client/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service-client/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service-client/untitled/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service/service-order/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service/service-product/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service/service-user/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spzx-service/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/spzx-service-client/untitled/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
27
pom.xml
27
pom.xml
|
@ -20,6 +20,10 @@
|
|||
<module>spzx-model</module>
|
||||
<module>spzx-manager</module>
|
||||
<module>spzx-common/common-log</module>
|
||||
<module>spzx-service</module>
|
||||
<module>spzx-service/service-product</module>
|
||||
<module>spzx-server-gateway</module>
|
||||
<module>spzx-service-client</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
@ -31,6 +35,9 @@
|
|||
<lombok.version>1.18.20</lombok.version>
|
||||
<mybatis.version>3.0.1</mybatis.version>
|
||||
<pagehelper.version>2.1.0</pagehelper.version>
|
||||
<cloud.version>2022.0.2</cloud.version>
|
||||
<alibaba.version>2022.0.0.0-RC2</alibaba.version>
|
||||
<alipay.version>4.8.73.ALL</alipay.version>
|
||||
</properties>
|
||||
|
||||
<!-- 管理依赖,版本锁定 -->
|
||||
|
@ -67,6 +74,26 @@
|
|||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>${pagehelper.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>${alibaba.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<!--导入支付宝支付sdk-->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>${alipay.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
||||
|
|
|
@ -30,9 +30,8 @@ public class CategoryController {
|
|||
|
||||
@Operation(summary = "导出数据", description = "导出数据")
|
||||
@GetMapping(value = "/exportData")
|
||||
public Result<String> exportData(HttpServletResponse response) {
|
||||
public void exportData(HttpServletResponse response) {
|
||||
categoryService.exportData(response);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "导入功能", description = "导入功能")
|
||||
|
|
|
@ -61,7 +61,7 @@ public class CategoryServiceImpl implements CategoryService {
|
|||
response.setCharacterEncoding("utf-8");
|
||||
|
||||
String filename = URLEncoder.encode("分类数据", StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-dispostion", "attachment;filename=" + filename + ".xlsx");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + filename + ".xlsx");
|
||||
|
||||
// 查询数据库中的数据
|
||||
List<Category> categoryList = categoryMapper.selectAll();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -2,14 +2,18 @@ package com.atguigu.spzx.model.vo.h5;
|
|||
|
||||
import com.atguigu.spzx.model.entity.product.Category;
|
||||
import com.atguigu.spzx.model.entity.product.ProductSku;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class IndexVo {
|
||||
|
||||
private List<Category> categoryList ; // 一级分类的类别数据
|
||||
private List<ProductSku> productSkuList ; // 畅销商品列表数据
|
||||
|
||||
private List<Category> categoryList; // 一级分类的类别数据
|
||||
private List<ProductSku> productSkuList; // 畅销商品列表数据
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-parent-v2</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>spzx-server-gateway</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>spzx-server-gateway</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
package com.atguigu;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-parent-v2</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>spzx-service-client</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>spzx-service-client</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
<modules>
|
||||
<module>service-product-client</module>
|
||||
<module>service-user-client</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-service-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-product-client</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>service-product-client</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-service-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-user-client</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>service-user-client</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
package com.atguigu;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-parent-v2</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>spzx-service</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>spzx-service</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
<modules>
|
||||
<module>service-user</module>
|
||||
<module>service-order</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>common-service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis的起步依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mysql驱动 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 服务注册 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 流量控制 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-order</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>service-order</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
bunny:
|
||||
datasource:
|
||||
host: 106.15.251.123
|
||||
port: 3305
|
||||
sqlData: db_spzx
|
||||
username: root
|
||||
password: "02120212"
|
|
@ -0,0 +1,22 @@
|
|||
server:
|
||||
port: 8511
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: service-product
|
||||
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 192.168.1.5:8848
|
||||
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||
username: ${bunny.datasource.username}
|
||||
password: "${bunny.datasource.password}"
|
||||
|
||||
mybatis:
|
||||
config-location: classpath:mybatis-config.xml
|
||||
mapper-locations: classpath:/mapper/*/*.xml
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<contextName>logback</contextName>
|
||||
|
||||
<!-- 日志的输出目录 -->
|
||||
<property name="log.path" value="logs//spzx-manager//logs"/>
|
||||
|
||||
<!--控制台日志格式:彩色日志-->
|
||||
<!-- magenta:洋红 -->
|
||||
<!-- boldMagenta:粗红-->
|
||||
<!-- cyan:青色 -->
|
||||
<!-- white:白色 -->
|
||||
<!-- magenta:洋红 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) %highlight([%-5level]) %green(%logger) %msg%n"/>
|
||||
|
||||
<!--文件日志格式-->
|
||||
<property name="FILE_LOG_PATTERN" value="%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n"/>
|
||||
|
||||
<!--编码-->
|
||||
<property name="ENCODING" value="UTF-8"/>
|
||||
|
||||
<!-- 控制台日志 -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- 临界值过滤器 -->
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件日志 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>${log.path}//log.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%date{yyyy-MM-dd HH:mm:ss} %msg%n</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 开发环境 -->
|
||||
<springProfile name="dev">
|
||||
<!-- com.atguigu日志记录器:业务程序INFO级别 -->
|
||||
<logger name="com.atguigu" level="INFO"/>
|
||||
<!-- 根日志记录器:INFO级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-product</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>service-product</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
package com.atguigu.product;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ProductApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ProductApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.atguigu.product.controller;
|
||||
|
||||
import com.atguigu.product.service.CategoryService;
|
||||
import com.atguigu.product.service.ProductService;
|
||||
import com.atguigu.spzx.model.entity.product.Category;
|
||||
import com.atguigu.spzx.model.entity.product.ProductSku;
|
||||
import com.atguigu.spzx.model.vo.h5.IndexVo;
|
||||
import com.atguigu.spzx.model.vo.result.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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(value = "/api/product/index")
|
||||
public class IndexController {
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
@Operation(summary = "获取首页数据", description = "获取首页数据")
|
||||
@GetMapping
|
||||
public Result<IndexVo> findData() {
|
||||
// 查询以及分类
|
||||
List<Category> categoryList = categoryService.selectOneCategory();
|
||||
// 根据销量排序,获取前十条数据
|
||||
List<ProductSku> productSkuList = productService.selectProductSkuBySale();
|
||||
|
||||
IndexVo vo = IndexVo.builder().categoryList(categoryList).productSkuList(productSkuList).build();
|
||||
return Result.success(vo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.atguigu.product.mapper;
|
||||
|
||||
import com.atguigu.spzx.model.entity.product.Category;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CategoryMapper {
|
||||
/**
|
||||
* 查询以及分类
|
||||
*
|
||||
* @return 分类列表
|
||||
*/
|
||||
List<Category> findOneCategory();
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.atguigu.product.mapper;
|
||||
|
||||
import com.atguigu.spzx.model.entity.product.ProductSku;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProductSkuMapper {
|
||||
/**
|
||||
* 根据销量排序,获取前十条数据
|
||||
*
|
||||
* @return ProductSku列表
|
||||
*/
|
||||
List<ProductSku> selectProductSkuBySale();
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.atguigu.product.service;
|
||||
|
||||
import com.atguigu.spzx.model.entity.product.Category;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CategoryService {
|
||||
/**
|
||||
* 查询以及分类
|
||||
*
|
||||
* @return 分类实体类列表
|
||||
*/
|
||||
List<Category> selectOneCategory();
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.atguigu.product.service;
|
||||
|
||||
import com.atguigu.spzx.model.entity.product.ProductSku;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProductService {
|
||||
/**
|
||||
* 根据销量排序,获取前十条数据
|
||||
*
|
||||
* @return ProductSku 列表
|
||||
*/
|
||||
List<ProductSku> selectProductSkuBySale();
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.atguigu.product.service.impl;
|
||||
|
||||
import com.atguigu.product.mapper.CategoryMapper;
|
||||
import com.atguigu.product.service.CategoryService;
|
||||
import com.atguigu.spzx.model.entity.product.Category;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CategoryServiceImpl implements CategoryService {
|
||||
@Autowired
|
||||
private CategoryMapper categoryMapper;
|
||||
|
||||
/**
|
||||
* 查询以及分类
|
||||
*
|
||||
* @return 分类实体类列表
|
||||
*/
|
||||
@Override
|
||||
public List<Category> selectOneCategory() {
|
||||
return categoryMapper.findOneCategory();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.atguigu.product.service.impl;
|
||||
|
||||
import com.atguigu.product.mapper.ProductSkuMapper;
|
||||
import com.atguigu.product.service.ProductService;
|
||||
import com.atguigu.spzx.model.entity.product.ProductSku;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProductServiceImpl implements ProductService {
|
||||
@Autowired
|
||||
private ProductSkuMapper productSkuMapper;
|
||||
|
||||
/**
|
||||
* 根据销量排序,获取前十条数据
|
||||
*
|
||||
* @return ProductSku 列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProductSku> selectProductSkuBySale() {
|
||||
return productSkuMapper.selectProductSkuBySale();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
bunny:
|
||||
datasource:
|
||||
host: 106.15.251.123
|
||||
port: 3305
|
||||
sqlData: db_spzx
|
||||
username: root
|
||||
password: "02120212"
|
||||
|
||||
nacos:
|
||||
server-addr: z-bunny.cn:8848
|
|
@ -0,0 +1,22 @@
|
|||
server:
|
||||
port: 8511
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: service-product
|
||||
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: ${bunny.nacos.server-addr}
|
||||
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||
username: ${bunny.datasource.username}
|
||||
password: "${bunny.datasource.password}"
|
||||
|
||||
mybatis:
|
||||
config-location: classpath:mybatis-config.xml
|
||||
mapper-locations: classpath:/mapper/*/*.xml
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<contextName>logback</contextName>
|
||||
|
||||
<!-- 日志的输出目录 -->
|
||||
<property name="log.path" value="logs//spzx-manager//logs"/>
|
||||
|
||||
<!--控制台日志格式:彩色日志-->
|
||||
<!-- magenta:洋红 -->
|
||||
<!-- boldMagenta:粗红-->
|
||||
<!-- cyan:青色 -->
|
||||
<!-- white:白色 -->
|
||||
<!-- magenta:洋红 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) %highlight([%-5level]) %green(%logger) %msg%n"/>
|
||||
|
||||
<!--文件日志格式-->
|
||||
<property name="FILE_LOG_PATTERN" value="%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n"/>
|
||||
|
||||
<!--编码-->
|
||||
<property name="ENCODING" value="UTF-8"/>
|
||||
|
||||
<!-- 控制台日志 -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- 临界值过滤器 -->
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件日志 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>${log.path}//log.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%date{yyyy-MM-dd HH:mm:ss} %msg%n</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 开发环境 -->
|
||||
<springProfile name="dev">
|
||||
<!-- com.atguigu日志记录器:业务程序INFO级别 -->
|
||||
<logger name="com.atguigu" level="INFO"/>
|
||||
<!-- 根日志记录器:INFO级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.atguigu.product.mapper.CategoryMapper">
|
||||
<!-- 用于select查询公用抽取的列 -->
|
||||
<sql id="columns">
|
||||
id,name,image_url,parent_id,status,order_num,create_time,update_time,is_deleted
|
||||
</sql>
|
||||
|
||||
<!-- 查询以及分类 -->
|
||||
<select id="findOneCategory" resultType="com.atguigu.spzx.model.entity.product.Category">
|
||||
select
|
||||
<include refid="columns"/>
|
||||
from category
|
||||
where is_deleted = 0
|
||||
and parent_id = #{parentId} order by id
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.atguigu.product.mapper.ProductSkuMapper">
|
||||
|
||||
<!-- 根据销量排序,获取前十条数据 -->
|
||||
<select id="selectProductSkuBySale" resultType="com.atguigu.spzx.model.entity.product.ProductSku">
|
||||
SELECT psku.*
|
||||
FROM product_sku psku
|
||||
INNER JOIN product p ON p.id = psku.product_id
|
||||
WHERE p.`status` = 1
|
||||
AND p.is_deleted = 0
|
||||
AND psku.is_deleted = 0
|
||||
ORDER BY psku.sale_num DESC
|
||||
LIMIT 10
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>spzx-service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-user</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>service-user</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
bunny:
|
||||
datasource:
|
||||
host: 106.15.251.123
|
||||
port: 3305
|
||||
sqlData: db_spzx
|
||||
username: root
|
||||
password: "02120212"
|
|
@ -0,0 +1,22 @@
|
|||
server:
|
||||
port: 8511
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: service-product
|
||||
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 192.168.1.5:8848
|
||||
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||
username: ${bunny.datasource.username}
|
||||
password: "${bunny.datasource.password}"
|
||||
|
||||
mybatis:
|
||||
config-location: classpath:mybatis-config.xml
|
||||
mapper-locations: classpath:/mapper/*/*.xml
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<contextName>logback</contextName>
|
||||
|
||||
<!-- 日志的输出目录 -->
|
||||
<property name="log.path" value="logs//spzx-manager//logs"/>
|
||||
|
||||
<!--控制台日志格式:彩色日志-->
|
||||
<!-- magenta:洋红 -->
|
||||
<!-- boldMagenta:粗红-->
|
||||
<!-- cyan:青色 -->
|
||||
<!-- white:白色 -->
|
||||
<!-- magenta:洋红 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) %highlight([%-5level]) %green(%logger) %msg%n"/>
|
||||
|
||||
<!--文件日志格式-->
|
||||
<property name="FILE_LOG_PATTERN" value="%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n"/>
|
||||
|
||||
<!--编码-->
|
||||
<property name="ENCODING" value="UTF-8"/>
|
||||
|
||||
<!-- 控制台日志 -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- 临界值过滤器 -->
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件日志 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>${log.path}//log.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%date{yyyy-MM-dd HH:mm:ss} %msg%n</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 开发环境 -->
|
||||
<springProfile name="dev">
|
||||
<!-- com.atguigu日志记录器:业务程序INFO级别 -->
|
||||
<logger name="com.atguigu" level="INFO"/>
|
||||
<!-- 根日志记录器:INFO级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue