# CodeHelper
**Repository Path**: darkidiot/CodeHelper
## Basic Information
- **Project Name**: CodeHelper
- **Description**: ①可视化数据库连接配置 ②自动生成service及dao层代码:支持Mapper和sqlSession两种配置风格 ③代码结构简单、零依赖、可简单个性化定制
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 102
- **Forks**: 28
- **Created**: 2016-07-21
- **Last Updated**: 2022-09-16
## Categories & Tags
**Categories**: database-dev
**Tags**: None
## README
# Mybatis 代码生成小工具


+ ①`可视化`数据库连接配置
+ ②自动生成service及dao层代码
> ps:支持Mapper和sqlSession两种配置风格
+ ③代码结构简单、零依赖、可简单个性化定制
### Usage:
```java
git clone https://git.oschina.net/darkidiot/CodeHelper.git
java -jar ./CodeHelper/dist/CodeHelper.jar
```

# How to Customize Your own CodeHelper?
## Code Review:
### Java:
```java
private String getMyBatisCode(Table table, String pack, String author) throws Exception {
String xml = Util.read(getDaoTemplateLocation());
String daoTemplate = Util.matchs(xml, "([\\w\\W]+?)", 1).get(0);
... ... ...
return daoTemplate.toString();
}
```
### xml:
```xml
#columns.mapping#
... ... ...
#table.name#
#id#,
... ... ...
... ... ...
INSERT INTO
()
VALUES()
... ... ...
UPDATE
#commaIfEntrys#
WHERE #id# = #idVal#
... ... ...
DELETE FROM
WHERE #id# = #{id}
```
#### You can modify above code for generate any code on the basis of your mind.
# End