PLC三端分离 数据库设计

数据库

create database if not exists plc_test default character set utf8mb4 default collate utf8mb4_general_ci;


create table acquisition_serv
(
    id                bigint unsigned auto_increment
        primary key,
    name              varchar(255)            not null,
    base_url          varchar(255)            not null,
    manipulation_path varchar(255)            not null,
    status_path       varchar(255) default '' not null
);

create table component
(
    id   bigint unsigned auto_increment
        primary key,
    name varchar(255)                  not null,
    type varchar(255) default 'sensor' not null,
    constraint name
        unique (name)
);

create table component_record
(
    id           bigint unsigned auto_increment
        primary key,
    equipment_id bigint unsigned         not null,
    component_id bigint unsigned         not null,
    value        varchar(255) default '' null,
    record_time  datetime                null
);

create table equipment
(
    id                  bigint unsigned auto_increment
        primary key,
    ip                  varchar(255)    not null,
    rack                int             not null,
    slot                int             not null,
    acquisition_serv_id bigint unsigned not null
);


create table manipulation
(
    id           bigint unsigned auto_increment
        primary key,
    equipment_id bigint unsigned not null,
    name         varchar(255)    not null,
    constraint unk_equipment_id_name
        unique (equipment_id, name)
);


create table manipulation_record
(
    id              bigint unsigned auto_increment
        primary key,
    manipulation_id bigint unsigned not null,
    record_time     datetime        null
);

service

public interface AcquisitionServService extends IService<AcquisitionServ> {

}

public class AcquisitionServServiceImpl extends ServiceImpl<AcquisitionServMapper, AcquisitionServ> implements AcquisitionServService{
}

mapper

public interface AcquisitionServMapper extends BaseMapper<AcquisitionServ> {

}

mapper.xml

<?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.fawvw.digital.mapper.AcquisitionServMapper">

    <resultMap id="BaseResultMap" type="com.fawvw.digital.model.AcquisitionServ">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="baseurl" column="baseUrl" jdbcType="VARCHAR"/>
            <result property="manipulationpath" column="manipulationPath" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,name,baseUrl,
        manipulationPath
    </sql>
</mapper>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值