Giter Site home page Giter Site logo

jcodes's Introduction

jcodes

介绍

代码生成工厂

软件架构

images

软件依赖

  1. beetl(模版生成)
  2. jdbc(获取数据库连接)
  3. snakeyaml(配置文件)

源码使用说明

  1. 配置codes.yml,配置样例
#作者
author: xxx
#生成项目配置
project:
  #生成的项目目标目录
  baseDir: /Users/zhouzx/xxx
  #项目配置文件的来源目录
  config: /Users/zhouzx/config
  #模板文件的来源目录
  template: /Users/zhouzx/templates
  #项目名
  name: lvji-codes-test
  #坐标
  groupId: com.czarea
  #版本号
  version: 1.0
  #模块
  module: pay
#生成业务代码配置
template:
  #模板文件的来源目录
  dir: /Users/zhouzx/
  #生成的代码目标目录
  outPath: /Users/zhouzx/jcodes/out
  ## 公共包名(微服务)
  commonPackage: com.czarea.xxx.common
  #包名
  basePackage: com.czarea.order
  #需要生成的业务表
  tables:
      - xxx
      - xxx
  prefixes: eo_
  #添加自己个性的key
  keys:
    module: zzx
    day: abc
#数据库配置
db:
  userName: xxx
  password: xxx
  database: xxx
  url: jdbc:mysql://127.0.0.1:3306/xxx?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC
  driverClass: com.mysql.cj.jdbc.Driver

上面配置可能会觉得很复杂,一般我们只使用生成代码的就可以使用如下配置即可:

author: xxx
template:
  dir: /Users/zhouzx/java_projects/jcodes/templates/new
  outPath: /Users/zhouzx/jcodes/out
  commonPackage: com.czarea.xxx.common
  basePackage: com.czarea.order.garden
  tables:
    - t_distributor
    - t_dms_order_title
    - t_dms_order_title_view
    - t_order_stat
  prefixes: t_

db:
  userName: xxx
  password: xxx
  database: xxx
  url: jdbc:mysql://192.168.32.88:3306/xxx?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC
  driverClass: com.mysql.cj.jdbc.Driver

  1. 配置模版文件,项目中有模版文件样例,在templates/java/guide目录下
  2. 运行Bootstrap类

脚本使用说明

参数:
    p pj    (创建项目)
    p code  (生产代码)
    d       (删除代码)
示例:	  
./jcodes.bat p pj
./jcodes.sh p code
  1. windows系统下运行bin/jcodes.bat p pj
  2. linux系统下运行bin/jcodes.sh p pj

idea插件使用说明

  1. 自己打包生成idea安装包:
:jcodes-intellij-plugin:clean buildPlugn

在build/distributions/下找到zip安装包 2. idea plugins marketplace搜索jcodes安装 2. ALT+S快捷键或对应选项卡界面选中运行jcodes插件

images

  1. 下载source下的模版文件,修改codes.yml,点击生成代码

jcodes's People

Contributors

czarea avatar lancelotzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

guanqh2019

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.