Giter VIP home page Giter VIP logo

code-generator's Introduction

code-generator

使用 SpringBoot+Vue 开发

根据建表 SQL 语句生成 实体类、mapper、service、serviceImpl、controller 代码

开发原因

工作中重复的 CRUD 内容太多,表字段又很多,故开发此代码生成器

基于项目:https://github.com/moshowgame/SpringBootCodeGenerator 开发,感谢作者 @moshowgame

主要添加了可自定义模板功能,可自定义代码生成的模板,完全在 web 端即可新增自己的模板,并且使用自己自定义的模板生成代码

演示地址:http://61.153.191.232:21345/#/generator

模板编写指南

项目中用的自定义模板是 FreeMarker,附上一份项目模板编写说明:https://www.sunnyc.icu/articles/4bfb823a/

部署

部署需要安装 dockerdocker-compose

或者直接安装 docker 桌面版

  1. 创建 docker-compose.yml 文件,21345 可以改成任意你喜欢的端口号,后续通过此端口号访问项目

    version: "3"
    services:
      api:
        image: hsunnyc/code-generator-server:1.0.1
        restart: always
        volumes:
          - ./templates:/opt/service/code-generator/templates
          - ./deleted:/opt/service/code-generator/deleted
        environment:
          TZ: Asia/Shanghai
      web:
        image: hsunnyc/code-generator-ui:1.0.1
        restart: always
        environment:
          TZ: Asia/Shanghai
        ports:
          - "21345:80"
        depends_on:
          - api
  2. 启动,在 docker-compose.yml 同级目录下

    # 前台启动
    docker-compose up
    # 后台启动 [推荐]
    docker-compose up -d
    # 停止
    docker-compose down
  3. 在你 docker-compose.yml 同级目录下会出现 templates 和 deleted 两个文件夹

    • templates:存储模板组,也就是目前所有模板文件
    • deleted :存储已删除的模板文件
  4. 访问 http://[your_ip]:21345

特性

1. 解析建表 SQL,根据模板生成代码

image-20220416130817223

image-20220416130817223

image-20220416130817223

2. 可自定义生成代码的模板

image-20220416132426459

TODO

  • 可自定义代码生成模板
  • 模板编写指南

code-generator's People

Contributors

hczs avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.