Files
iot-dc3/dc3-common/dc3-common-postgres
ClaudeandClaude Opus 4.7 4a17fcd7fc docs(common-public): simplify verbose class-level Javadocs to concise one-liners
Remove redundant <p> paragraphs that restate the class name.
Keep @author/@version/@since tags consistent across all classes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-08 00:51:12 +08:00
..

DC3 Common Postgres

Overview

dc3-common-postgres is the shared PostgreSQL and MyBatis-Plus configuration module of the IoT DC3 platform. It auto-configures datasource, paging plugin, and common MyBatis utility support for all services that use PostgreSQL as their primary storage.

Module Information

  • Group ID: io.github.pnoker
  • Artifact ID: dc3-common-postgres
  • Version: 2026.5.5

Key Components

Component Purpose
MybatisPlusConfig Configures MybatisPlusInterceptor with pagination plugin; sets default enum type handler
MybatisUtil Utility methods for building MyBatis-Plus LambdaQueryWrapper conditions from query objects
ActivePostgresProfileConfig Profile-conditional config activation

Configuration Properties

Uses dynamic-datasource-spring-boot-starter for multi-datasource support:

spring:
  datasource:
    dynamic:
      datasource:
        master:
          url: jdbc:postgresql://${POSTGRES_HOST:dc3-postgres}:${POSTGRES_PORT:35432}/${POSTGRES_DB:dc3}?currentSchema=${POSTGRES_SCHEMA:dc3_manager}&...
          username: ${POSTGRES_USERNAME:dc3}
          password: ${POSTGRES_PASSWORD:dc3dc3dc3}

Schema Isolation

Each center service uses a separate Postgres schema via currentSchema in the JDBC URL:

Service Schema
dc3-center-auth dc3_auth
dc3-center-manager dc3_manager
dc3-center-data dc3_data

Build Instructions

mvn -s ../../.mvn/settings.xml clean package
  • dc3-common-manager, dc3-common-auth, dc3-common-data — Include this as a dependency for Postgres access
  • dc3-common-dal — Builds on top of this for shared DAL entities

License

Copyright 2016-present the IoT DC3 original author or authors.

Licensed under the GNU Affero General Public License v3.0 (AGPL 3.0)