2.初始化Server、Common工程

news2024/11/24 14:36:47

1.初始化项目结构

1.1 工程依赖关系

1.2 根pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         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>

    <groupId>com.swsm</groupId>
    <artifactId>dttask</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>dttask-common</module>
        <module>dttask-server</module>
    </modules>

    <name>dttask</name>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <platform.version>2.0</platform.version>
        <spring-boot.version>2.6.5</spring-boot.version>
        <spring-boot-klock-starter.version>1.4-RELEASE</spring-boot-klock-starter.version>
        <fastjson.version>1.2.72</fastjson.version>
        <lombok.version>1.18.12</lombok.version>
        <swagger2.version>2.8.0</swagger2.version>
        <mybatis-plus.version>3.5.1</mybatis-plus.version>
        <guava.version>31.1-jre</guava.version>
        <easypoi.version>4.1.0</easypoi.version>
        <easyexcel.version>2.2.6</easyexcel.version>
        <common-compress.version>1.19</common-compress.version>
        <httpclient.version>4.5.10</httpclient.version>
        <common-collections.version>4.4</common-collections.version>
        <common-lang3.version>3.9</common-lang3.version>
        <common-fileupload.version>1.4</common-fileupload.version>
        <commons-codec.version>1.13</commons-codec.version>
        <commons-beanutils.version>1.9.4</commons-beanutils.version>
        <commons-io.version>2.6</commons-io.version>
        <reactor-core.version>3.3.9.RELEASE</reactor-core.version>
        <validation-api.version>2.0.1.Final</validation-api.version>
        <poi.version>3.17</poi.version>
        <knife4j-spring-boot-starter.version>2.0.9</knife4j-spring-boot-starter.version>
        <knife4j-spring-ui.version>2.0.9</knife4j-spring-ui.version>
        <jackson-databind.version>2.11.1</jackson-databind.version>
        <spring-boot-klock-starter.version>1.4-RELEASE</spring-boot-klock-starter.version>
        <gson.version>2.6.2</gson.version>
        <mysql-connector.version>8.0.22</mysql-connector.version>
        <postgresql.version>42.2.5</postgresql.version>
        <oracle.version>19.3.0.0</oracle.version>
        <spring-kafka.version>2.3.12.RELEASE</spring-kafka.version>
        <spring-email.version>2.2.11.RELEASE</spring-email.version>
        <spring-boot-starter-jdbc.version>2.1.11.RELEASE</spring-boot-starter-jdbc.version>
        <spring-cloud-alibaba-nacos-discovery.version>2.2.0.RELEASE</spring-cloud-alibaba-nacos-discovery.version>
        <spring-cloud-starter-openfeign.version>3.1.1</spring-cloud-starter-openfeign.version>
        <jsch.version>RELEASE</jsch.version>
        <hutool-all.version>5.8.4</hutool-all.version>
        <itextpdf.version>5.5.11</itextpdf.version>
        <itext-asian.version>5.2.0</itext-asian.version>
        <flying-saucer-pdf-itext5.version>9.1.16</flying-saucer-pdf-itext5.version>
        <jtidy.version>r938</jtidy.version>
        <velocity.version>1.7</velocity.version>
        <velocity-tools.version>2.0</velocity-tools.version>
        <druid.version>1.2.9</druid.version>
        <javax.servlet-api.version>4.0.1</javax.servlet-api.version>
        <kafka.version>2.0.0</kafka.version>

    </properties>


    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>com.kymatrix</groupId>
                <artifactId>crawler-protocol-sdk</artifactId>
                <version>1.0-SNAPSHOT</version>
            </dependency>

            <dependency>
                <groupId>com.kymatrix</groupId>
                <artifactId>crawler-common</artifactId>
                <version>1.0-SNAPSHOT</version>
            </dependency>


            <!--springBoot的启动器的包管理器-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-slf4j-impl</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-bom</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- spring end -->

            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-all</artifactId>
                <version>4.1.22.Final</version>
            </dependency>


            <!-- swagger begin -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger2.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger2.version}</version>
            </dependency>
            <dependency>
                <groupId>com.github.xiaoymin</groupId>
                <artifactId>knife4j-spring-ui</artifactId>
                <version>${knife4j-spring-ui.version}</version>
            </dependency>
            <!-- swagger end -->

            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-boot-starter</artifactId>
                <version>${mybatis-plus.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.tomcat</groupId>
                        <artifactId>tomcat-jdbc</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- drivers begin -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql-connector.version}</version>
            </dependency>
            <!-- drivers end -->


            <!-- tools begin -->
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>

            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>

            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>${fastjson.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>${common-collections.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${common-lang3.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons-codec.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
                <version>${commons-beanutils.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>

            <dependency>
                <groupId>io.projectreactor</groupId>
                <artifactId>reactor-core</artifactId>
                <version>${reactor-core.version}</version>
            </dependency>

            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${validation-api.version}</version>
            </dependency>

            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${javax.servlet-api.version}</version>
            </dependency>

            <dependency>
                <groupId>cn.hutool</groupId>
                <artifactId>hutool-all</artifactId>
                <version>${hutool-all.version}</version>
            </dependency>
            <!-- tools end -->

        </dependencies>
    </dependencyManagement>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/java/</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <skip>false</skip>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.3.4.RELEASE</version>
                    <configuration>
                        <includeSystemScope>true</includeSystemScope>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <skip>false</skip>
                </configuration>
            </plugin>


        </plugins>
    </build>


</project>

2.初始dttask-common工程

dttask-common就是一个普通的java jar应用

2.1 pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>dttask</artifactId>
        <groupId>com.swsm</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>dttask-common</artifactId>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        
        <!-- spring begin -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-undertow</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <!-- spring end -->

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <!-- tools begin -->

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>


        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-ui</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

</project>

2.2 初始化数据库相关类,为mybatis-plus做准备

这里Job类、DttaskJob类、DeviceLink类中使用了对象字段,数据库使用了mysql的json字段格式,使用了FastjsonTypeHandler类,具体代码如下:

@Data
@TableName(value = "t_job", autoResultMap = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Job extends BaseEntity implements Serializable {
    
    @TableField("device_id")
    private Long deviceId;
    
    @TableField("device_link_id")
    private Long deviceLinkId;
    
    @TableField("link_type")
    private Integer linkType;
    
    @TableField(value = "link_spec", typeHandler = FastjsonTypeHandler.class)
    private LinkSpec linkSpec;
    
    @TableField(value = "job_spec", typeHandler = FastjsonTypeHandler.class)
    private JobSpec jobSpec;
}

3.初始化dttask-server工程

3.1 pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>dttask</artifactId>
        <groupId>com.swsm</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>dttask-server</artifactId>
    <packaging>jar</packaging>
    

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.kymatrix</groupId>
            <artifactId>crawler-protocol-sdk</artifactId>
        </dependency>
        <dependency>
            <groupId>com.kymatrix</groupId>
            <artifactId>crawler-common</artifactId>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-clients</artifactId>
        </dependency>

        <dependency>
            <groupId>com.ghgande</groupId>
            <artifactId>j2mod</artifactId>
            <version>2.3.5</version> <!-- 使用最新版本 -->
        </dependency>

        <dependency>
            <groupId>org.eclipse.paho</groupId>
            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
            <version>1.2.4</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    
    

</project>

3.2 服务启动类及mybatis、swagger配置类

3.3 验证

启动dttask-server,访问 http://127.0.0.1:9088/doc.html#/home,可看到如下 swagger界面

4. 工程加入git版本控制

工程加入git版本控制,就不在这里截图了,几步操作,不会的人可以网上搜搜,此时代码作为我们的0.1版本

5.数据库脚本

/*
 Navicat Premium Data Transfer

 Source Server         : mysql
 Source Server Type    : MySQL
 Source Server Version : 50726
 Source Host           : 127.0.0.1:3306
 Source Schema         : dttask-server

 Target Server Type    : MySQL
 Target Server Version : 50726
 File Encoding         : 65001

 Date: 14/12/2023 16:47:25
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_device
-- ----------------------------
DROP TABLE IF EXISTS `t_device`;
CREATE TABLE `t_device`  (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `delete_flag` int(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_device_link
-- ----------------------------
DROP TABLE IF EXISTS `t_device_link`;
CREATE TABLE `t_device_link`  (
  `id` bigint(20) NOT NULL,
  `device_id` bigint(20) NOT NULL,
  `link_type` int(2) NOT NULL COMMENT '0:modbus rtu; 1:modbus tcp; 2:mqtt',
  `link_spec` json NOT NULL,
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `delete_flag` int(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_dttask
-- ----------------------------
DROP TABLE IF EXISTS `t_dttask`;
CREATE TABLE `t_dttask`  (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `ip_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `port` int(8) NOT NULL,
  `status` int(1) NOT NULL COMMENT '0: 下线  1:上线   ',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `delete_flag` int(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_dttask_job
-- ----------------------------
DROP TABLE IF EXISTS `t_dttask_job`;
CREATE TABLE `t_dttask_job`  (
  `id` bigint(20) NOT NULL,
  `dttask_id` bigint(20) NOT NULL,
  `device_id` bigint(20) NOT NULL,
  `device_link_id` bigint(20) NOT NULL,
  `job_id` bigint(20) NOT NULL,
  `link_type` int(2) NOT NULL COMMENT '0:modbus rtu; 1:modbus tcp; 2:mqtt',
  `link_spec` json NOT NULL,
  `job_spec` json NOT NULL,
  `status` int(1) NOT NULL COMMENT '0: 创建  1:运行  2:暂停  3:异常',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `delete_flag` int(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_dttask_job_history
-- ----------------------------
DROP TABLE IF EXISTS `t_dttask_job_history`;
CREATE TABLE `t_dttask_job_history`  (
  `id` bigint(20) NOT NULL,
  `dttask_id` bigint(20) NOT NULL,
  `device_id` bigint(20) NOT NULL,
  `device_link_id` bigint(20) NOT NULL,
  `job_id` bigint(20) NOT NULL,
  `link_type` int(2) NOT NULL COMMENT '0:modbus rtu; 1:modbus tcp; 2:mqtt',
  `link_spec` json NOT NULL,
  `job_spec` json NOT NULL,
  `status` int(1) NOT NULL COMMENT '0: 创建  1:运行  2:暂停  3:异常',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `delete_flag` int(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_job
-- ----------------------------
DROP TABLE IF EXISTS `t_job`;
CREATE TABLE `t_job`  (
  `id` bigint(20) NOT NULL,
  `device_id` bigint(20) NOT NULL,
  `device_link_id` bigint(20) NOT NULL,
  `link_type` int(2) NOT NULL COMMENT '0:modbus rtu; 1:modbus tcp; 2:mqtt',
  `link_spec` json NOT NULL,
  `job_spec` json NOT NULL,
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  `delete_flag` int(1) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1319984.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

vue3使用vue-router嵌套路由(多级路由)

文章目录 1、Vue3 嵌套路由2、项目结构3、编写相关页面代码3.1、编写route文件下 index.ts文件3.2、main.ts文件代码&#xff1a;3.3、App.vue文件代码&#xff1a;3.4、views文件夹下的Home文件夹下的index.vue文件代码&#xff1a;3.5、views文件夹下的Home文件夹下的Tigerhh…

Android通过listview实现输入框自定义提示栏(代替AutoCompleteTextView自动完成文本框)

效果图 背景 本人因为一些需求初次接触android&#xff0c;需要实现一个类似android自带的AutoCompleteTextView&#xff08;自动完成文本框&#xff09;&#xff0c;但和其不同的是通过后端接口直接筛选数据&#xff08;自己的分词处理规则&#xff09;&#xff0c;然后返回前…

【LeetCode刷题笔记(5)】【Python】【盛最多水的容器】【双指针】【中等】

文章目录 盛最多水的容器算法题描述示例示例 1示例 2 提示题意拆解 解决方案&#xff1a;【双指针】运行结果复杂度分析 结束语 盛最多水的容器 盛最多水的容器 算法题描述 给定一个长度为 n 的整数数组 height 。有 n 条垂线&#xff0c;第 i 条线的两个端点是 (i, 0) 和 (…

虚拟展会展览如何搭建,虚拟展会展览有哪些优势

引言&#xff1a; 随着科技的不断进步&#xff0c;虚拟展会展览正逐渐成为企业推广和交流的新方式。那么虚拟展会展览应该如何搭建&#xff0c;虚拟展会展览又能带来哪些好处呢&#xff1f; 一.什么是虚拟展会展览 虚拟展会展览是一种通过网络平台进行的展览&#xff0c;与传…

制作RK3568 ubuntu20.04桌面版镜像

平台 主控: RK3568 编译主机: Ubuntu 20.04 AMD64 目标版本: Ubuntu 20.04 概述 RK3568是极具性价比的高能国产“芯“ , 是Rockchip面向与AIOT和工业市场打造的一款高性能、低功耗、功能丰富的国产化应用处理器。采用四核64位Cortex-A55架构&#xff0c;主频高达2.0GHz&#x…

数据结构:图文详解 队列 | 循环队列 的各种操作(出队,入队,获取队列元素,判断队列状态)

目录 队列的概念 队列的数据结构 队列的实现 入队 出队 获取队头元素 获取队列长度 循环队列的概念 循环队列的数据结构 循环队列的实现 判断队列是否为空 判断队列是否已满 入队 出队 得到队头元素 得到队尾元素 队列的概念 队列&#xff08;Queue&#xff0…

如何在使用Docker快速部署StackEdit并实现公网访问本地编辑器远程办公

文章目录 1. docker部署Stackedit2. 本地访问3. Linux 安装cpolar4. 配置Stackedit公网访问地址5. 公网远程访问Stackedit6. 固定Stackedit公网地址 StackEdit是一个受欢迎的Markdown编辑器&#xff0c;在GitHub上拥有20.7k Star&#xff01;&#xff0c;它支持将Markdown笔记保…

简单好用的图像编辑:Pixelmator Pro直装中文 for Mac

在 Pixelmator Pro 中&#xff0c;您可以找到从亮度、对比度和曝光等基本颜色调整到多通道曲线和基于轮的颜色平衡等高级工具的所有内容。 自动增强照片。 许多最重要的调整可以自动应用&#xff0c;使用经过 2000 万张照片训练的机器学习算法。 完善每一个细节。 神奇地移除…

回收站数据恢复,分享3个可行方法!

“我真的太粗心啦&#xff01;本来想删除一些电脑里不重要的文件&#xff0c;但是不小心把一些很重要的文件一起删除了&#xff0c;这可怎么办呢&#xff1f;我应该通过什么方法找回这些文件呢&#xff1f;” 在使用电脑的过程中&#xff0c;误删文件是很多用户都无法避免的一件…

使用vs code开发microPython,消除库文件报错

使用vs code 写microPython代码的时候&#xff0c;总是遇到库文件报错&#xff0c;也就是类似machine之类的库下面会有波浪线&#xff0c;看起来很是别扭。 前几天在翻看树莓派pico的文档&#xff0c;发现里面提供了很好的方法。 安装vs code环境 $ sudo apt update $ sudo a…

如何在Windows系统上部署VisualSVN并实现远程访问管理界面【内网穿透】

文章目录 前言1. VisualSVN安装与配置2. VisualSVN Server管理界面配置3. 安装cpolar内网穿透3.1 注册账号3.2 下载cpolar客户端3.3 登录cpolar web ui管理界面3.4 创建公网地址 4. 固定公网地址访问 前言 SVN 是 subversion 的缩写&#xff0c;是一个开放源代码的版本控制系统…

eclipse安装astview插件

astview插件可以展示java源码经过词法、语法分析后生成的抽象语法树&#xff08;AST&#xff09;&#xff1a; 在eclipse中安装该插件&#xff0c;见官方&#xff1a;org.eclipse.jdt.astview - AST View | The Eclipse Foundation 我的eclipse版本2020-06&#xff0c;开始使用…

触想智能工业一体机在金属3D打印机上的应用

1、行业发展背景 3D打印又称“增材制造”&#xff0c;是一种以数字模型为基础&#xff0c;通过逐层堆叠将打印材料熔结固化为三维实体物件的先进制造技术。 随着航空航天、科研、医疗、汽车等精工领域的颠覆性发展&#xff0c;制造业对于高强度、高精度、轻量型、柔性化金属零件…

联合电子车载充配电单元全球量产

2023年12月&#xff0c;联合电子新一代车载充配电单元批量交付。该产品将应用于全球市场&#xff0c;可覆盖中国、欧洲、北美、日本的交流与直流充电通讯体系。 该车载充配电单元由车载充电机&#xff08;On-board Charger&#xff09;和高压直流转换器&#xff08;HV DCDC Co…

Python数据科学视频讲解:Python数据检索

3.3 Python数据检索 视频为《Python数据科学应用从入门到精通》张甜 杨维忠 清华大学出版社一书的随书赠送视频讲解3.3节内容。本书已正式出版上市&#xff0c;当当、京东、淘宝等平台热销中&#xff0c;搜索书名即可。内容涵盖数据科学应用的全流程&#xff0c;包括数据科学应…

Linux服务器性能优化小结

文章目录 生产环境监测常见专业名词扫盲服务器平均负载服务器平均负载的定义如何判断平均负载值以及好坏情况如果依据平均负载来判断服务器当前状况系统平均负载和CPU使用率的区别 CPU上下文切换基本概念3种上下文切换进程上下文切换线程上下文切换中断上下文切换 查看上下文切…

Kafka消息延迟和时序性详解(文末送书)

目录 一、概括1.1 介绍 Kafka 消息延迟和时序性1.1.1 什么是 Kafka 消息延迟&#xff1f;1.1.2 为什么消息延迟很重要&#xff1f;1.1.3 什么是 Kafka 消息时序性&#xff1f;1.1.4 消息延迟和时序性的关系 1.2 延迟的来源1.2.1 Kafka 内部延迟 二、衡量和监控消息延迟2.1 延迟…

内网BUG管理系统本地部署并结合内网穿透实现异地远程访问

文章目录 前言1. 本地安装配置BUG管理系统2. 内网穿透2.1 安装cpolar内网穿透2.2 创建隧道映射本地服务3. 测试公网远程访问4. 配置固定二级子域名4.1 保留一个二级子域名5.1 配置二级子域名6. 使用固定二级子域名远程 前言 BUG管理软件,作为软件测试工程师的必备工具之一。在…

2023.12.17Linux基础命令

ls -l详细信息 -a所有 springcloud微服务 ctrlalt鼠标左键&#xff0c;从虚拟机中回到本机 执行这两条语句 拿到远程主机的ip地址之后就要试图连接 要实现连接&#xff0c;就要有远程连接的软件 ssh和http一样&#xff0c;也是一种协议 SSH 是 Secure Shell&am…

查看知乎数学公式Tex源码的方法

首先使用F12打开开发者工具&#xff0c;再使用元素选择器选中要查看的公式。 在源码对应位置附近可以看到一个类型为 math/tex 的 script&#xff0c;如果没找到可以展开目录查找。