阳少的工具站 阳少的工具站
首页
  • 项目简介
  • 项目部署
  • 快速上手
  • 功能使用

    • 代码生成
    • 权限控制
    • 数据权限
问答
💖支持
GitHub (opens new window)
首页
  • 项目简介
  • 项目部署
  • 快速上手
  • 功能使用

    • 代码生成
    • 权限控制
    • 数据权限
问答
💖支持
GitHub (opens new window)
  • 指南

    • 项目简介
    • 项目部署
    • 快速上手
      • 新增微服务
        • 1.创建微服务模块
        • 2.拷贝pom文件的依赖项
        • 3.创建数据库、创建表
        • 4.使用easycode生成代码
        • 5.之后需要设置gateway路由配置
        • 6.在gateway查看文档
  • 功能使用

    • 代码生成
    • 权限控制
    • 数据权限
  • 指南
  • 指南
gyv12345@163.com
2022-07-26
目录

快速上手

# 新增微服务

# 1.创建微服务模块

新建一个maven项目

vd1WuT.md.png (opens new window)

# 2.拷贝pom文件的依赖项


<pom>
    <dependencies>
        <!--注册中心客户端-->
        <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-nacos-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.ulisesbocchio</groupId>
            <artifactId>jasypt-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-sys-api</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-sa-token</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-data</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-web</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-log</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-swagger</artifactId>
        </dependency>
        <dependency>
            <groupId>cn.yt4j</groupId>
            <artifactId>yt4j-flow</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
        </plugins>
    </build>
</pom>

# 3.创建数据库、创建表

create database `yt4j_crm` default character set utf8mb4 collate utf8mb4_unicode_ci;

DROP TABLE IF EXISTS `crm_customer`;
CREATE TABLE `crm_customer`  (
  `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '客户名称',
  `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '联系方式',
  `create_user_id` bigint(0) NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_user_id` bigint(0) NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
  `dept_id` bigint(0) NULL DEFAULT NULL COMMENT '部门',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客户表' ROW_FORMAT = Dynamic;

# 4.使用easycode生成代码

vd3OWn.md.png (opens new window)

# 5.之后需要设置gateway路由配置

spring:
  cloud:
    gateway:
      routes:
        - id: yt4j-sys
          uri: lb://yt4j-sys
          predicates:
            - Path=/sys/**
          filters:
            - StripPrefix=1
        - id: yt4j-auth
          uri: lb://yt4j-auth
          predicates:
            - Path=/auth/**
          filters:
            - StripPrefix=1
        - id: yt4j-crm # id与模块名称一致
          uri: lb://yt4j-crm # lb与模块名称一致
          predicates:
            - Path=/crm/** # 这里去掉前缀
          filters:
            - StripPrefix=1

# 6.在gateway查看文档

http://127.0.0.1:8888/doc.html 就可以访问项目文档了

上次更新: 2022/08/18, 01:25:36
项目部署
代码生成

← 项目部署 代码生成→

Theme by Vdoing | Copyright © 2020-2025 yt4j | 豫ICP备2024074107号 | 豫公网安备41030402000167号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式