Giter VIP home page Giter VIP logo

dubniumsculptor's Introduction

𬭊蚀刻器 Dubnium (Db) Sculptor

一个用于在项目启动时自动检测并创建数据库表结构的简易工具. 依赖 MVCIntrospector 库 ([17.6.0,)).


cmd

git clone https://github.com/FirokOtaku/DubniumSculptor.git
cd DubniumSculptor
mvn install

maven

<dependency>
    <groupId>firok.spring</groupId>
    <artifactId>dbsculptor</artifactId>
    <version>{VRESION}</version>
</dependency>

application.yml

firok:
  spring:
    dbsculptor:
      enable: true
    mvci:
      runtime:
        enable-mapper-config: true

Java 17+

import firok.spring.dbsculptor.DirectMapper;
import firok.spring.mvci.runtime.CurrentMappers;
import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.annotation.MapperScans;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;

// 使相关组件可以被扫描
@MapperScans({
    @MapperScan("firok.spring.dbsculptor"),
})
@ComponentScans({
    @ComponentScan("firok.spring.mvci.runtime"),
    @ComponentScan("firok.spring.dbsculptor"),
})
public class AnySpringApplication
{
    // 保证项目里有这两个实例,
    // 且名为 currentMappers 和 directMapper
    @Autowired
    CurrentMappers currentMappers;
    @Autowired
    DirectMapper directMapper;
}
import firok.spring.dbsculptor.Dubnium;
import firok.spring.mvci.MVCIntrospective;

// 在实体类标注 MVCI 和 DBS 的注解
@MVCIntrospective
@Dubnium(sculpturalScript = """
    # 在这里编写自定义 SQL 脚本
    create table d_user (
        username varchar(64),
        password varchar(64),
    );
    """)
public class UserBean
{
    String username;
    String password;
}

lgpl3

dubniumsculptor's People

Contributors

firokotaku avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.