Эх сурвалжийг харах

feat: postgrep配置信息

jay 2 жил өмнө
parent
commit
f54aa86ef1

+ 14 - 8
iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml

@@ -48,17 +48,23 @@
             <artifactId>yitter-idgenerator</artifactId>
         </dependency>
 
+<!--        <dependency>-->
+<!--            <groupId>com.h2database</groupId>-->
+<!--            <artifactId>h2</artifactId>-->
+<!--        </dependency>-->
+
+<!--        <dependency>-->
+<!--            <groupId>mysql</groupId>-->
+<!--            <artifactId>mysql-connector-java</artifactId>-->
+<!--            <version>8.0.32</version>-->
+<!--        </dependency>-->
+<!--        -->
         <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <version>42.2.9</version>
         </dependency>
 
-        <!--        <dependency>-->
-        <!--            <groupId>mysql</groupId>-->
-        <!--            <artifactId>mysql-connector-java</artifactId>-->
-        <!--            <version>8.0.32</version>-->
-        <!--        </dependency>-->
-
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>

+ 44 - 44
iot-starter/src/main/resources/application.yml

@@ -21,50 +21,50 @@ spring:
     init:
       schema-locations: classpath:sql/schema.sql
       mode: ALWAYS
-  datasource:
-    url: jdbc:h2:./data/iotkit;MODE=MySQL
-    username: sa
-    password: 123456
-    driverClassName: org.h2.Driver
-    type: com.zaxxer.hikari.HikariDataSource
-    # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
-    dynamic:
-      hikari:
-        connection-timeout: 5000
-        idle-timeout: 30000 # 经过idle-timeout时间如果连接还处于空闲状态, 该连接会被回收
-        min-idle: 5 # 池中维护的最小空闲连接数, 默认为 10 个
-        max-pool-size: 16 # 池中最大连接数, 包括闲置和使用中的连接, 默认为 10 个
-        max-lifetime: 60000 # 如果一个连接超过了时长,且没有被使用, 连接会被回收
-        is-auto-commit: true
-      primary: master #设置默认的数据源或者数据源组,默认值即为master
-      strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
-      datasource:
-        # 主库数据源
-        master:
-          type: ${spring.datasource.type}
-          driverClassName: org.h2.Driver
-          # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
-          # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          url: jdbc:h2:./data/iotkit;MODE=MySQL
-          username: sa
-          password: 123456
-        # 从库数据源
-        slave:
-          lazy: true
-          type: ${spring.datasource.type}
-          driverClassName: org.h2.Driver
-          url: jdbc:h2:./data/iotkit;MODE=MySQL
-          username: sa
-          password: 123456
-
-    # 内置h2 web console设置
-    platform: h2
-  h2:
-    console:
-      enabled: true
-      path: /h2
-      settings:
-        web-allow-others: true
+#  datasource:
+#    url: jdbc:h2:./data/iotkit;MODE=MySQL
+#    username: sa
+#    password: 123456
+#    driverClassName: org.h2.Driver
+#    type: com.zaxxer.hikari.HikariDataSource
+#    # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
+#    dynamic:
+#      hikari:
+#        connection-timeout: 5000
+#        idle-timeout: 30000 # 经过idle-timeout时间如果连接还处于空闲状态, 该连接会被回收
+#        min-idle: 5 # 池中维护的最小空闲连接数, 默认为 10 个
+#        max-pool-size: 16 # 池中最大连接数, 包括闲置和使用中的连接, 默认为 10 个
+#        max-lifetime: 60000 # 如果一个连接超过了时长,且没有被使用, 连接会被回收
+#        is-auto-commit: true
+#      primary: master #设置默认的数据源或者数据源组,默认值即为master
+#      strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
+#      datasource:
+#        # 主库数据源
+#        master:
+#          type: ${spring.datasource.type}
+#          driverClassName: org.h2.Driver
+#          # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
+#          # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
+#          url: jdbc:h2:./data/iotkit;MODE=MySQL
+#          username: sa
+#          password: 123456
+#        # 从库数据源
+#        slave:
+#          lazy: true
+#          type: ${spring.datasource.type}
+#          driverClassName: org.h2.Driver
+#          url: jdbc:h2:./data/iotkit;MODE=MySQL
+#          username: sa
+#          password: 123456
+#
+#    # 内置h2 web console设置
+#    platform: h2
+#  h2:
+#    console:
+#      enabled: true
+#      path: /h2
+#      settings:
+#        web-allow-others: true
   #=======内置H2数据库连接设置结束==========>>
 
 

+ 112 - 0
iot-starter/src/main/resources/sql/schema-postgre.sql

@@ -0,0 +1,112 @@
+
+-- ----------------------------
+-- 18、代码生成业务表
+-- ----------------------------
+drop table if exists gen_table;
+create table if not exists gen_table
+(
+    table_id          int8,
+    data_name         varchar(200)  default ''::varchar,
+    table_name        varchar(200)  default ''::varchar,
+    table_comment     varchar(500)  default ''::varchar,
+    sub_table_name    varchar(64)   default ''::varchar,
+    sub_table_fk_name varchar(64)   default ''::varchar,
+    class_name        varchar(100)  default ''::varchar,
+    tpl_category      varchar(200)  default 'crud'::varchar,
+    package_name      varchar(100)  default null::varchar,
+    module_name       varchar(30)   default null::varchar,
+    business_name     varchar(30)   default null::varchar,
+    function_name     varchar(50)   default null::varchar,
+    function_author   varchar(50)   default null::varchar,
+    gen_type          char          default '0'::bpchar not null,
+    gen_path          varchar(200)  default '/'::varchar,
+    options           varchar(1000) default null::varchar,
+    create_dept       int8,
+    create_by         int8,
+    create_time       timestamp,
+    update_by         int8,
+    update_time       timestamp,
+    remark            varchar(500)  default null::varchar,
+    constraint gen_table_pk primary key (table_id)
+    );
+
+comment on table gen_table is '代码生成业务表';
+comment on column gen_table.table_id is '编号';
+comment on column gen_table.data_name is '数据源名称';
+comment on column gen_table.table_name is '表名称';
+comment on column gen_table.table_comment is '表描述';
+comment on column gen_table.sub_table_name is '关联子表的表名';
+comment on column gen_table.sub_table_fk_name is '子表关联的外键名';
+comment on column gen_table.class_name is '实体类名称';
+comment on column gen_table.tpl_category is '使用的模板(CRUD单表操作 TREE树表操作)';
+comment on column gen_table.package_name is '生成包路径';
+comment on column gen_table.module_name is '生成模块名';
+comment on column gen_table.business_name is '生成业务名';
+comment on column gen_table.function_name is '生成功能名';
+comment on column gen_table.function_author is '生成功能作者';
+comment on column gen_table.gen_type is '生成代码方式(0zip压缩包 1自定义路径)';
+comment on column gen_table.gen_path is '生成路径(不填默认项目路径)';
+comment on column gen_table.options is '其它生成选项';
+comment on column gen_table.create_dept is '创建部门';
+comment on column gen_table.create_by is '创建者';
+comment on column gen_table.create_time is '创建时间';
+comment on column gen_table.update_by is '更新者';
+comment on column gen_table.update_time is '更新时间';
+comment on column gen_table.remark is '备注';
+
+-- ----------------------------
+-- 19、代码生成业务表字段
+-- ----------------------------
+drop table if exists gen_table_column;
+create table if not exists gen_table_column
+(
+    column_id      int8,
+    table_id       int8,
+    column_name    varchar(200) default null::varchar,
+    column_comment varchar(500) default null::varchar,
+    column_type    varchar(100) default null::varchar,
+    java_type      varchar(500) default null::varchar,
+    java_field     varchar(200) default null::varchar,
+    is_pk          char         default null::bpchar,
+    is_increment   char         default null::bpchar,
+    is_required    char         default null::bpchar,
+    is_insert      char         default null::bpchar,
+    is_edit        char         default null::bpchar,
+    is_list        char         default null::bpchar,
+    is_query       char         default null::bpchar,
+    query_type     varchar(200) default 'EQ'::varchar,
+    html_type      varchar(200) default null::varchar,
+    dict_type      varchar(200) default ''::varchar,
+    sort           int4,
+    create_dept    int8,
+    create_by      int8,
+    create_time    timestamp,
+    update_by      int8,
+    update_time    timestamp,
+    constraint gen_table_column_pk primary key (column_id)
+    );
+
+comment on table gen_table_column is '代码生成业务表字段';
+comment on column gen_table_column.column_id is '编号';
+comment on column gen_table_column.table_id is '归属表编号';
+comment on column gen_table_column.column_name is '列名称';
+comment on column gen_table_column.column_comment is '列描述';
+comment on column gen_table_column.column_type is '列类型';
+comment on column gen_table_column.java_type is 'JAVA类型';
+comment on column gen_table_column.java_field is 'JAVA字段名';
+comment on column gen_table_column.is_pk is '是否主键(1是)';
+comment on column gen_table_column.is_increment is '是否自增(1是)';
+comment on column gen_table_column.is_required is '是否必填(1是)';
+comment on column gen_table_column.is_insert is '是否为插入字段(1是)';
+comment on column gen_table_column.is_edit is '是否编辑字段(1是)';
+comment on column gen_table_column.is_list is '是否列表字段(1是)';
+comment on column gen_table_column.is_query is '是否查询字段(1是)';
+comment on column gen_table_column.query_type is '查询方式(等于、不等于、大于、小于、范围)';
+comment on column gen_table_column.html_type is '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)';
+comment on column gen_table_column.dict_type is '字典类型';
+comment on column gen_table_column.sort is '排序';
+comment on column gen_table_column.create_dept is '创建部门';
+comment on column gen_table_column.create_by is '创建者';
+comment on column gen_table_column.create_time is '创建时间';
+comment on column gen_table_column.update_by is '更新者';
+comment on column gen_table_column.update_time is '更新时间';