8 Star 10 Fork 13

gjj / hi-gencode

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

hi-gencode

项目介绍

hi-gencode,一款基于springboot,mybatis的代码生成器(目前仅支持mysql)。

具有多表关联生成功能,能够下载生成后的模板文件zip包,默认生成controller、service、entity、mapper、mapperxml文件。

内置有ParamsData(集成查询条件、分页条件、排序条件)类。

该代码生成器运行在浏览器web端,建议使用谷歌浏览器。

演示地址(可能有点卡,毕竟阿里云入门级服务器): http://120.79.5.163:9090/gen/index/to-index

技术选型

  1. 后端框架:springboot2.0、freemarker模板引擎、mybatis数据持久层、mysql数据库、druid数据库连接池
  2. 前端框架: thymeleaf、vue、axios、element-ui、lodash

代码生成器使用说明("访问地址:http://localhost:9090/gen/index/to-index")

输入图片说明

输入图片说明

输入图片说明

输入图片说明

输入图片说明

输入图片说明

输入图片说明

输入图片说明

输入图片说明

输入图片说明

输入图片说明

开发说明

  1. 需要引入分页maven坐标
<dependency>
	<groupId>com.github.pagehelper</groupId>
	<artifactId>pagehelper-spring-boot-starter</artifactId>
	<version>1.2.3</version>
</dependency>
  1. 代码生成之后需要用到几个关键类,在"开发需要"文件夹中
  2. 对应该接口

输入图片说明

前端封装的json格式是

(querys(查询条件)name为对应实体类的字段,opt是查询条件,value是对应查询的值)

(orders(排序条件)name为对应实体类的字段,type为排序条件)

{
	"querys": [{
			"name": "orderType",
			"opt": "=",
			"value": "1"
		}, {
			"name": "customerName",
			"opt": "like",
			"value": "liuy"
		}, {
			"name": "createTime",
			"opt": ">=",
			"value": "2018-08-29 00:00:00"
		}, {
			"name": "createTime",
			"opt": "<=",
			"value": "2018-09-04 00:00:00"
		},
		{
			"name": "orderNo",
			"opt": "in",
			"value": ["FD123156FS5GSD", "20180823040809"]
		},
		{
			"name": "orderStatus",
			"opt": "in",
			"value": [1, 2]
		},
		{
			"name": "orderType",
			"opt": "is null"
		},
		{
			"name": "orderType",
			"opt": "is not null"
		}

	],
	"pageInfo": {
		"pageNum": 1,
		"pageSize": 10
	},
	"orders": [{
		"name": "id",
		"type": "desc"
	}]
}
  1. 如果需要自己建立查询条件、排序条件则需要这样封装
ParamsData<OrderEntity.Query,OrderEntity.Order> paramsData=new ParamsData<OrderEntity.Query,OrderEntity.Order>();
paramsData.addQuerys(OrderInfoEntity.getQuery("orderNo","like","WEREWR"));
paramsData.addQuerys(OrderInfoEntity.getQuery("orderStatus","=",1));
paramsData.addQuerys(OrderInfoEntity.getQuery("createTime",">=","2018-09-01 10:00:00"));
paramsData.addQuerys(OrderInfoEntity.getQuery("orderType","is null",""));
paramsData.addQuerys(OrderInfoEntity.getQuery("orderType","is not null",""));

Long[] ids=new Long[0];
String[] strings=new String[0];
paramsData.addQuerys(OrderInfoEntity.getQuery("orderNo","in",strings));
paramsData.addQuerys(OrderInfoEntity.getQuery("orderStatus","in",ids));

paramsData.addOrders(OrderInfoEntity.getOrder("id","desc"));
  1. 更新需要更新的字段(模板生成之后mapper的updateByColumn的columns参数封装)
List<String> columns=new ArrayList<String>();
columns.add(Base.getFieldName("orderNo",OrderInfoEntity.class));
columns.add(Base.getFieldName("orderType",OrderInfoEntity.class));
  1. 根据某些条件删除对应记录,模板生成mapper的deleteByParam的paramOrderPage参数封装 (和第四条一样)

Comments ( 6 )

Sign in for post a comment

About

hi-gencode,一款基于springboot,mybatis的代码生成器,具有多表关联生成功能 spread retract
Cancel

Releases

No release

Gitee Metrics

Contributors

All

Activities

load more
can not load any more
Java
1
https://gitee.com/gaojunjie03/hi-gencode.git
git@gitee.com:gaojunjie03/hi-gencode.git
gaojunjie03
hi-gencode
hi-gencode
master

Search