Skip to content

Commit

Permalink
添加author模板属性
Browse files Browse the repository at this point in the history
  • Loading branch information
dolyw committed Apr 9, 2019
1 parent f80070d commit 34b62b3
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 45 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
----|------|----
SpringBoot1.5(第一版) | Test类生成代码 | [https://github.com/wang926454/SpringBootGenerator/releases](https://github.com/wang926454/SpringBootGenerator/releases)
SpringBoot2.1(第二版) | Test类生成代码 | [https://github.com/wang926454/SpringBootGenerator/releases](https://github.com/wang926454/SpringBootGenerator/releases)
SpringBoot1.5(第三版) | 可视化界面生成代码 | 当前
SpringBoot1.5(第三版) | 可视化界面或Test类两种 | 当前

#### 项目介绍

Expand All @@ -29,9 +29,9 @@ SpringBoot + Mybatis + PageHelper + 通用Mapper + Thymeleaf(Amaze UI(布局) +

#### 安装教程

1. 配置resource下config/generator.properties数据库信息
1. 配置resource下config/generator.properties数据库信息,Test类在src\test\java\com\example\generator\GeneratorCode
2. 模板提供两套示例LayUI和RESTful,自行添加模板路径src\test\resources\template\two
3. 运行项目src\main\java\com\example\Application.java即可,访问[http://localhost:8080](http://localhost:8080),可以在线设置生成代码的配置
3. 可视化界面操作运行项目src\main\java\com\example\Application.java即可,访问[http://localhost:8080](http://localhost:8080),可以在线设置生成代码的配置

#### 使用说明

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config/generator.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ template=/src/main/resources/template/two/RESTful
# 需要移除的表名前缀,使用逗号进行分隔多个前缀,示例值: t_,table_(不能有空格)
tableRemovePrefixes=

# author属性,方法注释作者名称
author=Generator
# basepackage属性,包路径
basepackage=com.example
# commonspackage属性,包路径
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/**
* ${className}Controller
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@Controller
Expand All @@ -39,7 +39,7 @@ public class ${className}Controller {

/**
* 主页面
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@RequestMapping
Expand All @@ -49,7 +49,7 @@ public String index(HttpServletRequest request) {

/**
* 列表
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@ResponseBody
Expand All @@ -66,7 +66,7 @@ public Map<String, Object> list(@RequestBody ${className}Dto ${classNameLower}Dt

/**
* 预新增
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@ResponseBody
Expand All @@ -80,7 +80,7 @@ public Map<String, Object> prepareInsert(@RequestBody ${className}Dto ${classNam

/**
* 新增
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@ResponseBody
Expand All @@ -95,7 +95,7 @@ public Map<String, Object> insert(@RequestBody ${className}Dto ${classNameLower}

/**
* 预修改
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@ResponseBody
Expand All @@ -109,7 +109,7 @@ public Map<String, Object> prepareUpdate(@RequestBody ${className}Dto ${classNam

/**
* 修改
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@ResponseBody
Expand All @@ -124,7 +124,7 @@ public Map<String, Object> update(@RequestBody ${className}Dto ${classNameLower}
/**
* 删除
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@ResponseBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/**
* ${className}Dao
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@Repository
Expand All @@ -22,7 +22,7 @@ public interface ${className}Dao extends BaseDao<${className}Dto> {
* 列表
* @param ${classNameLower}Dto
* @return java.util.List<${basepackage}.dto.custom.${className}Dto;>
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public List<${className}Dto> findPageInfo(${className}Dto ${classNameLower}Dto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* ${className}Dto
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@Table(name = "${table.sqlName}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/**
* ${className}DtoBase
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public class ${className}DtoBase extends BaseDto implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* ${className}Service
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public interface ${className}Service extends IBaseService<${className}Dto> {
Expand All @@ -19,7 +19,7 @@ public interface ${className}Service extends IBaseService<${className}Dto> {
* 列表
* @param ${classNameLower}Dto
* @return java.util.List<${basepackage}.dto.custom.${className}Dto;>
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public PageInfo<${className}Dto> findPageInfo(int page, int rows, ${className}Dto ${classNameLower}Dto, String orderBy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/**
* ${className}ServiceImpl
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@Service("${classNameLower}Service")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* ${className}Controller
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@RestController
Expand All @@ -39,7 +39,7 @@ public class ${className}Controller {

/**
* 列表
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@GetMapping
Expand All @@ -62,7 +62,7 @@ public ResponseBean list(@RequestParam(defaultValue = "1") Integer page, @Reques

/**
* 查询
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@GetMapping("/{id}")
Expand All @@ -76,7 +76,7 @@ public ResponseBean findById(@PathVariable("id") Integer id) {

/**
* 新增
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@PostMapping
Expand All @@ -91,7 +91,7 @@ public ResponseBean add(@RequestBody ${className}Dto ${classNameLower}Dto) {

/**
* 更新
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@PutMapping
Expand All @@ -106,7 +106,7 @@ public ResponseBean update(@RequestBody ${className}Dto ${classNameLower}Dto) {

/**
* 删除
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@DeleteMapping("/{id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* ${className}Dao
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@Repository
Expand All @@ -21,7 +21,7 @@ public interface ${className}Dao extends Mapper<${className}Dto> {
* 列表
* @param ${classNameLower}Dto
* @return java.util.List<${basepackage}.dto.custom.${className}Dto;>
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public List<${className}Dto> findPageInfo(${className}Dto ${classNameLower}Dto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* ${className}Dto
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@Table(name = "${table.sqlName}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* ${className}DtoBase
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public class ${className}DtoBase implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/**
* I${className}Service
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public interface I${className}Service extends IBaseService<${className}Dto> {
Expand All @@ -19,7 +19,7 @@ public interface I${className}Service extends IBaseService<${className}Dto> {
* 列表
* @param ${classNameLower}Dto
* @return java.util.List<${basepackage}.dto.custom.${className}Dto;>
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
public List<${className}Dto> findPageInfo(${className}Dto ${classNameLower}Dto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**
* ${className}ServiceImpl
* @author Generator
* @author ${author}
* @date ${now?string('yyyy-MM-dd HH:mm:ss')}
*/
@Service("${classNameLower}Service")
Expand Down
30 changes: 20 additions & 10 deletions src/main/resources/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ <h5 class="header-title m-t-0 m-b-30">配置</h5>
<el-input v-model.trim="generator.tableRemovePrefixes" placeholder="请输入tableRemovePrefixes"/>
</el-form-item>

<el-form-item label="author" prop="author">
<el-input v-model.trim="generator.author" placeholder="请输入author"/>
</el-form-item>

<el-form-item label="basepackage" prop="basepackage">
<el-input v-model.trim="generator.basepackage" placeholder="请输入basepackage"/>
</el-form-item>
Expand Down Expand Up @@ -91,30 +95,36 @@ <h5 class="header-title m-t-0 m-b-30">说明</h5>
<div>生成代码需要移除的表名前缀,例如t_user变User类则配置t_,使用逗号分隔同时配置多个前缀,示例: table_,t_(不能有空格)</div>
</el-collapse-item>
<el-collapse-item title="template" name="4">
<template slot="title">
<b class="title">author</b>
</template>
<div>模板代码的author属性(注释的作者名称),示例: Wang926454</div>
</el-collapse-item>
<el-collapse-item title="template" name="5">
<template slot="title">
<b class="title">basepackage</b>
</template>
<div>模板代码的basepackage属性,示例: com.example</div>
</el-collapse-item>
<el-collapse-item title="template" name="5">
<el-collapse-item title="template" name="6">
<template slot="title">
<b class="title">commonspackage</b>
</template>
<div>模板代码的commonspackage属性,示例: com.example</div>
</el-collapse-item>
<el-collapse-item title="template" name="6">
<el-collapse-item title="template" name="7">
<template slot="title">
<b class="title">namespace</b>
</template>
<div>模板代码的namespace属性,示例: view</div>
</el-collapse-item>
<el-collapse-item title="template" name="7">
<el-collapse-item title="template" name="8">
<template slot="title">
<b class="title">modulepackage</b>
</template>
<div>模板代码的modulepackage属性,示例: generator</div>
</el-collapse-item>
<el-collapse-item title="template" name="8">
<el-collapse-item title="template" name="9">
<template slot="title">
<b class="title">更多配置</b>
</template>
Expand Down Expand Up @@ -153,6 +163,8 @@ <h5 class="header-title m-t-0 m-b-30">说明</h5>
template: '',
// 生成代码需要移除的表名前缀
tableRemovePrefixes: '',
// 模板代码的author属性
author: '',
// 模板代码的basepackage属性
basepackage: '',
// 模板代码的commonspackage属性
Expand All @@ -174,6 +186,9 @@ <h5 class="header-title m-t-0 m-b-30">说明</h5>
tableRemovePrefixes: [
{ required: true, message: '请输入tableRemovePrefixes', trigger: 'blur' }
],
author: [
{ required: true, message: '请输入author', trigger: 'blur' }
],
basepackage: [
{ required: true, message: '请输入basepackage', trigger: 'blur' }
],
Expand Down Expand Up @@ -225,7 +240,7 @@ <h5 class="header-title m-t-0 m-b-30">说明</h5>
this.$notify({
dangerouslyUseHTMLString: true,
title: '请等待',
message: '配置更新会导致应用热重启'
message: '<b>配置更新会导致应用热重启</b>'
});
this.generator = data.data;
setTimeout(() => {
Expand All @@ -236,11 +251,6 @@ <h5 class="header-title m-t-0 m-b-30">说明</h5>
});
}, 3033);
} else {
this.$notify({
dangerouslyUseHTMLString: true,
title: '提示',
message: data.msg
});
this.$message.error(data.msg);
this.submitLoading = false;
}
Expand Down
Loading

0 comments on commit 34b62b3

Please sign in to comment.