diff --git a/.idea/encodings.xml b/.idea/encodings.xml index cf5b385..4534e5f 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -14,6 +14,7 @@ + diff --git a/.idea/misc.xml b/.idea/misc.xml index 132404b..fd42907 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/common/service-util/src/main/java/com/atguigu/ssyx/CodeGet.java b/common/service-util/src/main/java/com/atguigu/ssyx/CodeGet.java index 982bb3e..665de88 100644 --- a/common/service-util/src/main/java/com/atguigu/ssyx/CodeGet.java +++ b/common/service-util/src/main/java/com/atguigu/ssyx/CodeGet.java @@ -17,16 +17,16 @@ public class CodeGet { // 2、全局配置 // 全局配置 GlobalConfig gc = new GlobalConfig(); - gc.setOutputDir("F:\\File\\Java\\ssyx\\guigu-ssyx-parent\\service\\service-sys" + "/src/main/java\\com\\atguigu\\ssyx\\sys"); + gc.setOutputDir("F:\\File\\Java\\ssyx\\guigu-ssyx-parent\\service\\service-product" + "/src/main/java"); gc.setServiceName("%sService"); // 去掉Service接口的首字母I - gc.setAuthor("atguigu"); + gc.setAuthor("bunny"); gc.setOpen(false); mpg.setGlobalConfig(gc); // 3、数据源配置 DataSourceConfig dsc = new DataSourceConfig(); - dsc.setUrl("jdbc:mysql://106.15.251.123:3305/shequ-sys?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true"); + dsc.setUrl("jdbc:mysql://106.15.251.123:3305/shequ-product?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true"); dsc.setDriverName("com.mysql.cj.jdbc.Driver"); dsc.setUsername("root"); dsc.setPassword("02120212"); @@ -35,8 +35,8 @@ public class CodeGet { // 4、包配置 PackageConfig pc = new PackageConfig(); - pc.setParent("com.atguigu"); - pc.setModuleName("system"); // 模块名 + pc.setParent("com.atguigu.ssyx"); + pc.setModuleName("product"); // 模块名 pc.setController("controller"); pc.setService("service"); pc.setMapper("mapper"); @@ -45,7 +45,8 @@ public class CodeGet { // 5、策略配置 StrategyConfig strategy = new StrategyConfig(); - strategy.setInclude("region", "region_ware", "ware"); + strategy.setInclude("attr", "attr_group", "base_category_trademark", "category", "comment", "comment_replay", "mq_repeat_record", + "region_ware", "sku_attr_value", "sku_detail", "sku_image", "sku_info", "sku_poster", "sku_stock_history", "ware"); strategy.setNaming(NamingStrategy.underline_to_camel);// 数据库表映射到实体的命名策略 strategy.setColumnNaming(NamingStrategy.underline_to_camel);// 数据库表字段映射到实体的命名策略 strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 diff --git a/service/pom.xml b/service/pom.xml index 9e711c9..1013f23 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -15,6 +15,7 @@ service-acl service-sys + service-product diff --git a/service/service-product/pom.xml b/service/service-product/pom.xml new file mode 100644 index 0000000..921dc11 --- /dev/null +++ b/service/service-product/pom.xml @@ -0,0 +1,23 @@ + + 4.0.0 + + com.atguigu + service + 1.0-SNAPSHOT + + + service-product + jar + + service-product + https://maven.apache.org + + + UTF-8 + + + + + + diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/ServiceProductApplication.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/ServiceProductApplication.java new file mode 100644 index 0000000..e3b8ff3 --- /dev/null +++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/ServiceProductApplication.java @@ -0,0 +1,15 @@ +package com.atguigu.ssyx.product; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@ComponentScan(basePackages = {"com.atguigu.ssyx"}) +@EnableTransactionManagement +public class ServiceProductApplication { + public static void main(String[] args) { + SpringApplication.run(ServiceProductApplication.class, args); + } +} \ No newline at end of file diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/config/Knife4jConfig.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/config/Knife4jConfig.java new file mode 100644 index 0000000..99cfe59 --- /dev/null +++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/config/Knife4jConfig.java @@ -0,0 +1,54 @@ +package com.atguigu.ssyx.product.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.ParameterBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.schema.ModelRef; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.service.Parameter; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +@EnableSwagger2WebMvc +public class Knife4jConfig { + @Bean + public Docket adminApiConfig() { + List pars = new ArrayList<>(); + ParameterBuilder tokenPar = new ParameterBuilder(); + tokenPar.name("adminId") + .description("用户token") + .defaultValue("1") + .modelRef(new ModelRef("string")) + .parameterType("header") + .required(false) + .build(); + pars.add(tokenPar.build()); + + return new Docket(DocumentationType.SWAGGER_2) + .groupName("adminApi") + .apiInfo(adminApiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.atguigu.ssyx.product.controller")) + .paths(PathSelectors.regex("/admin/.*")) + .build() + .globalOperationParameters(pars); + } + + private ApiInfo adminApiInfo() { + return new ApiInfoBuilder() + .title("后台管理系统-API文档") + .description("本文档描述了尚上优选后台系统服务接口定义") + .version("1.0") + .contact(new Contact("atguigu", "http://atguigu.com", "atguigu")) + .build(); + } +} \ No newline at end of file diff --git a/service/service-product/src/main/resources/application-dev.yml b/service/service-product/src/main/resources/application-dev.yml new file mode 100644 index 0000000..642acdd --- /dev/null +++ b/service/service-product/src/main/resources/application-dev.yml @@ -0,0 +1,27 @@ +server: + port: 8203 + +bunny: + datasource: + host: 106.15.251.123 + port: 3305 + sqlData: shequ-product + username: root + password: "02120212" + + nacos: + server-addr: z-bunny.cn:8848 + discovery: + namespace: ssyx + + redis: + host: 47.120.65.66 + port: 6379 + database: 2 + password: "02120212" + + minio: + endpointUrl: "http://129.211.31.58:9000" + bucket-name: ssyx + accessKey: bunny + secretKey: "02120212" \ No newline at end of file diff --git a/service/service-product/src/main/resources/application.yml b/service/service-product/src/main/resources/application.yml new file mode 100644 index 0000000..1d69fb6 --- /dev/null +++ b/service/service-product/src/main/resources/application.yml @@ -0,0 +1,62 @@ +server: + port: 8203 +spring: + application: + name: service-product + profiles: + active: dev + + 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}" + + cloud: + sentinel: + log: + dir: logs/${spring.application.name}/sentinel + nacos: + discovery: + namespace: ${bunny.nacos.discovery.namespace} + server-addr: ${bunny.nacos.server-addr} + + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + + +mybatis-plus: + type-aliases-package: com.atguigu.model # 配置每个包前缀 + mapper-locations: classpath:mapper/*.xml + configuration: + map-underscore-to-camel-case: true + auto-mapping-behavior: full + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 查看日志 + global-config: + db-config: + # 设置表名前缀,不用在每个tableName添加前缀 + # table-prefix: t_ + # 全局配置主键值方式 + id-type: assign_id + logic-not-delete-value: 0 # 未删除默认为0 + logic-delete-value: 1 # 删除 + logic-delete-field: deleted # 全局配置逻辑删除 + +logging: + level: + com.atguigu.ssyx.acl.mapper: debug + com.atguigu.ssyx.acl.controller: info + com.atguigu.ssyx.acl.service: info + pattern: + dateformat: HH:mm:ss:SSS + file: + path: "logs/${spring.application.name}" + +bunny: + minio: + endpointUrl: ${bunny.minio.endpointUrl} + accessKey: ${bunny.minio.accessKey} + secretKey: ${bunny.minio.secretKey} + bucket-name: ${bunny.minio.bucket-name} \ No newline at end of file diff --git a/service/service-product/src/main/resources/banner.txt b/service/service-product/src/main/resources/banner.txt new file mode 100644 index 0000000..cc77fc2 --- /dev/null +++ b/service/service-product/src/main/resources/banner.txt @@ -0,0 +1,16 @@ +-----------------▄██-█▄--------- +-----------------███▄██▄-------- +-----------------███████-------- +-----------------▀███████------- +-------------------██████▄▄----- +-------------------█████████▄--- +-------------------██████▄████-- +-------▄███████████████████████- +-----▄███████████████████████▀-- +---▄██████████████████████------ +---███████████████████████------ +---███████████████████████------ +-▄▄██████████████████████▀------ +-█████████████████▀█████-------- +-▀██████████████▀▀-▀█████▄------ +-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------ \ No newline at end of file diff --git a/service/service-product/src/main/resources/favicon.ico b/service/service-product/src/main/resources/favicon.ico new file mode 100644 index 0000000..1ba397c Binary files /dev/null and b/service/service-product/src/main/resources/favicon.ico differ