mirror of
https://github.com/moshowgame/SpringBootCodeGenerator.git
synced 2025-12-26 05:48:33 +08:00
Merge pull request #118 from chentianming11/master
支持common-mapper&修复entity和plusentity的swagger引包错误
This commit is contained in:
commit
6aa41d565f
@ -20,7 +20,7 @@
|
|||||||
> #支持`MySQL`、Oracle、PgSQL三大主流数据库
|
> #支持`MySQL`、Oracle、PgSQL三大主流数据库
|
||||||
>
|
>
|
||||||
>generate to many popular templates by ddl-sql/insert-sql/simple json<br>
|
>generate to many popular templates by ddl-sql/insert-sql/simple json<br>
|
||||||
> 可通过`建表SQL语句`或`INSERT语句`或者`简单JSON`生成`JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL`相关模板代码.
|
> 可通过`建表SQL语句`或`INSERT语句`或者`简单JSON`生成`JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL/CommonMapper`相关模板代码.
|
||||||
>
|
>
|
||||||
>thanks for your using and feedback,I'm inspired by the 600PV every day and github more than 700 stars <br>
|
>thanks for your using and feedback,I'm inspired by the 600PV every day and github more than 700 stars <br>
|
||||||
> 感谢大家的使用和反馈,每天六百的PV和获得超过七百多的星星是我前进和继续做下去的动力。
|
> 感谢大家的使用和反馈,每天六百的PV和获得超过七百多的星星是我前进和继续做下去的动力。
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import java.util.List;
|
|||||||
public class ClassInfo {
|
public class ClassInfo {
|
||||||
|
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
private String originTableName;
|
||||||
private String className;
|
private String className;
|
||||||
private String classComment;
|
private String classComment;
|
||||||
private List<FieldInfo> fieldList;
|
private List<FieldInfo> fieldList;
|
||||||
|
|||||||
@ -73,7 +73,7 @@ public class TableParseUtil {
|
|||||||
//优化对likeu.members这种命名的支持
|
//优化对likeu.members这种命名的支持
|
||||||
tableName = tableName.substring(tableName.indexOf(".") + 1);
|
tableName = tableName.substring(tableName.indexOf(".") + 1);
|
||||||
}
|
}
|
||||||
|
String originTableName = tableName;
|
||||||
//ignore prefix
|
//ignore prefix
|
||||||
if(tableName!=null && StringUtils.isNotNull(MapUtil.getString(paramInfo.getOptions(),"ignorePrefix"))){
|
if(tableName!=null && StringUtils.isNotNull(MapUtil.getString(paramInfo.getOptions(),"ignorePrefix"))){
|
||||||
tableName = tableName.replaceAll(MapUtil.getString(paramInfo.getOptions(),"ignorePrefix"),"");
|
tableName = tableName.replaceAll(MapUtil.getString(paramInfo.getOptions(),"ignorePrefix"),"");
|
||||||
@ -323,6 +323,7 @@ public class TableParseUtil {
|
|||||||
codeJavaInfo.setClassName(className);
|
codeJavaInfo.setClassName(className);
|
||||||
codeJavaInfo.setClassComment(classComment);
|
codeJavaInfo.setClassComment(classComment);
|
||||||
codeJavaInfo.setFieldList(fieldList);
|
codeJavaInfo.setFieldList(fieldList);
|
||||||
|
codeJavaInfo.setOriginTableName(originTableName);
|
||||||
|
|
||||||
return codeJavaInfo;
|
return codeJavaInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,5 +174,20 @@
|
|||||||
"description": "swagger-yml"
|
"description": "swagger-yml"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"group": "common-mapper",
|
||||||
|
"templates": [{
|
||||||
|
"id": "74",
|
||||||
|
"name": "tkentity",
|
||||||
|
"description": "tkentity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "75",
|
||||||
|
"name": "tkmapper",
|
||||||
|
"description": "tkmapper"
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||||
|
|
||||||
|
<#if isAutoImport?exists && isAutoImport==true>
|
||||||
|
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import javax.persistence.*;
|
||||||
|
<#if isSwagger?exists && isSwagger==true>
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;</#if>
|
||||||
|
</#if>
|
||||||
|
/**
|
||||||
|
* @description ${classInfo.classComment}
|
||||||
|
* @author ${authorName}
|
||||||
|
* @date ${.now?string('yyyy-MM-dd')}
|
||||||
|
*/
|
||||||
|
<#if isLombok?exists && isLombok==true>@Data</#if>
|
||||||
|
<#if isComment?exists && isComment==true>@Table(name="${classInfo.originTableName}")</#if><#if isSwagger?exists && isSwagger==true>
|
||||||
|
@ApiModel("${classInfo.classComment}")</#if>
|
||||||
|
public class ${classInfo.className} implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||||
|
<#list classInfo.fieldList as fieldItem >
|
||||||
|
<#if isComment?exists && isComment==true>/**
|
||||||
|
* ${fieldItem.fieldComment}
|
||||||
|
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||||
|
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
|
||||||
|
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
|
||||||
|
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||||
|
|
||||||
|
</#list>
|
||||||
|
public ${classInfo.className}() {
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<#if isLombok?exists && isLombok==false>
|
||||||
|
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||||
|
return ${fieldItem.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||||
|
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||||
|
<#if isAutoImport?exists && isAutoImport==true>
|
||||||
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import ${packageName}.entity.${classInfo.className};
|
||||||
|
</#if>
|
||||||
|
/**
|
||||||
|
* @description ${classInfo.classComment}Mapper
|
||||||
|
* @author ${authorName}
|
||||||
|
* @date ${.now?string('yyyy-MM-dd')}
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ${classInfo.className}Mapper extends Mapper<${classInfo.className}> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -10,8 +10,9 @@ import javax.persistence.Entity;
|
|||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
<#if isSwagger?exists && isSwagger==true>
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;</#if>
|
||||||
</#if>
|
</#if>
|
||||||
/**
|
/**
|
||||||
* @description ${classInfo.classComment}
|
* @description ${classInfo.classComment}
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import java.util.List;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
<#if isSwagger?exists && isSwagger==true>
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;</#if>
|
||||||
</#if>
|
</#if>
|
||||||
/**
|
/**
|
||||||
* @description ${classInfo.classComment}
|
* @description ${classInfo.classComment}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user