替换默认注释工具
This commit is contained in:
@@ -17,12 +17,12 @@
|
||||
package com.itfsw.mybatis.generator.plugins.utils;
|
||||
|
||||
import com.itfsw.mybatis.generator.plugins.CommentPlugin;
|
||||
import com.itfsw.mybatis.generator.plugins.utils.enhanced.DefaultCommentGenerator;
|
||||
import com.itfsw.mybatis.generator.plugins.utils.enhanced.TemplateCommentGenerator;
|
||||
import org.mybatis.generator.api.CommentGenerator;
|
||||
import org.mybatis.generator.api.PluginAdapter;
|
||||
import org.mybatis.generator.config.Context;
|
||||
import org.mybatis.generator.config.PluginConfiguration;
|
||||
import org.mybatis.generator.internal.DefaultCommentGenerator;
|
||||
import org.mybatis.generator.internal.util.StringUtility;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -56,15 +56,15 @@ public class BasePlugin extends PluginAdapter {
|
||||
PluginConfiguration cfg = PluginTools.getPluginConfiguration(CommentPlugin.class, context);
|
||||
|
||||
if (cfg == null || cfg.getProperty(CommentPlugin.PRE_TEMPLATE) == null){
|
||||
if (context.getCommentGeneratorConfiguration().getConfigurationType().equals("DEFAULT")){
|
||||
if (context.getCommentGenerator() instanceof DefaultCommentGenerator){
|
||||
// 使用默认模板引擎
|
||||
commentGenerator = new DefaultCommentGenerator();
|
||||
commentGenerator = new TemplateCommentGenerator("mybatis-generator-comment.ftl", true);
|
||||
} else {
|
||||
// 用户自定义
|
||||
commentGenerator = context.getCommentGenerator();
|
||||
}
|
||||
} else {
|
||||
TemplateCommentGenerator templateCommentGenerator = new TemplateCommentGenerator(cfg.getProperty(CommentPlugin.PRE_TEMPLATE));
|
||||
TemplateCommentGenerator templateCommentGenerator = new TemplateCommentGenerator(cfg.getProperty(CommentPlugin.PRE_TEMPLATE), false);
|
||||
|
||||
// ITFSW 插件使用的注释生成器
|
||||
commentGenerator = templateCommentGenerator;
|
||||
|
||||
-333
@@ -1,333 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.itfsw.mybatis.generator.plugins.utils.enhanced;
|
||||
|
||||
import org.mybatis.generator.api.CommentGenerator;
|
||||
import org.mybatis.generator.api.IntrospectedColumn;
|
||||
import org.mybatis.generator.api.IntrospectedTable;
|
||||
import org.mybatis.generator.api.dom.java.*;
|
||||
import org.mybatis.generator.api.dom.xml.TextElement;
|
||||
import org.mybatis.generator.api.dom.xml.XmlElement;
|
||||
import org.mybatis.generator.config.MergeConstants;
|
||||
import org.mybatis.generator.internal.util.StringUtility;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------------------------------
|
||||
* 注释生成工具
|
||||
* ---------------------------------------------------------------------------
|
||||
* @author: hewei
|
||||
* @time:2017/4/28 15:11
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
public class DefaultCommentGenerator implements CommentGenerator {
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addJavaFileComment(org.mybatis.generator.api.dom.java.CompilationUnit)
|
||||
*/
|
||||
public void addJavaFileComment(CompilationUnit compilationUnit) {
|
||||
// add no file level comments by default
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a suitable comment to warn users that the element was generated, and when it was generated.
|
||||
* @param xmlElement the xml element
|
||||
*/
|
||||
public void addComment(XmlElement xmlElement) {
|
||||
|
||||
xmlElement.addElement(new TextElement("<!--"));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" WARNING - ");
|
||||
sb.append(MergeConstants.NEW_ELEMENT_TAG);
|
||||
xmlElement.addElement(new TextElement(sb.toString()));
|
||||
xmlElement.addElement(new TextElement(" This element is automatically generated by MyBatis Generator, do not modify."));
|
||||
xmlElement.addElement(new TextElement(" @project https://github.com/itfsw/mybatis-generator-plugin"));
|
||||
xmlElement.addElement(new TextElement("-->"));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addRootComment(org.mybatis.generator.api.dom.xml.XmlElement)
|
||||
*/
|
||||
public void addRootComment(XmlElement rootElement) {
|
||||
// add no document level comments by default
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addConfigurationProperties(java.util.Properties)
|
||||
*/
|
||||
public void addConfigurationProperties(Properties properties) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds the custom javadoc tag for. You may do nothing if you do not wish to include the Javadoc tag -
|
||||
* however, if you do not include the Javadoc tag then the Java merge capability of the eclipse plugin will break.
|
||||
* @param javaElement the java element
|
||||
* @param markAsDoNotDelete the mark as do not delete
|
||||
*/
|
||||
protected void addJavadocTag(JavaElement javaElement, boolean markAsDoNotDelete) {
|
||||
javaElement.addJavaDocLine(" *");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" * ");
|
||||
sb.append(MergeConstants.NEW_ELEMENT_TAG);
|
||||
if (markAsDoNotDelete) {
|
||||
sb.append(" do_not_delete_during_merge");
|
||||
}
|
||||
|
||||
javaElement.addJavaDocLine(sb.toString());
|
||||
javaElement.addJavaDocLine(" * @project https://github.com/itfsw/mybatis-generator-plugin");
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addClassComment(org.mybatis.generator.api.dom.java.InnerClass, org.mybatis.generator.api.IntrospectedTable)
|
||||
*/
|
||||
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable) {
|
||||
if (innerClass instanceof InnerInterfaceWrapperToInnerClass){
|
||||
InnerInterfaceWrapperToInnerClass innerInterfaceWrapperToInnerClass = (InnerInterfaceWrapperToInnerClass) innerClass;
|
||||
InnerInterface innerInterface = innerInterfaceWrapperToInnerClass.getInnerInterface();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
innerInterface.addJavaDocLine("/**");
|
||||
innerInterface.addJavaDocLine(" * This interface was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This interface corresponds to the database table ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
innerInterface.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(innerInterface, false);
|
||||
|
||||
innerInterface.addJavaDocLine(" */");
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
innerClass.addJavaDocLine("/**");
|
||||
innerClass.addJavaDocLine(" * This class was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This class corresponds to the database table ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
innerClass.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(innerClass, false);
|
||||
|
||||
innerClass.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addTopLevelClassComment(org.mybatis.generator.api.dom.java.TopLevelClass, org.mybatis.generator.api.IntrospectedTable)
|
||||
*/
|
||||
@Override
|
||||
public void addModelClassComment(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
topLevelClass.addJavaDocLine("/**");
|
||||
|
||||
String remarks = introspectedTable.getRemarks();
|
||||
if (StringUtility.stringHasValue(remarks)) {
|
||||
topLevelClass.addJavaDocLine(" * Database Table Remarks:");
|
||||
String[] remarkLines = remarks.split(System.getProperty("line.separator"));
|
||||
for (String remarkLine : remarkLines) {
|
||||
topLevelClass.addJavaDocLine(" * " + remarkLine);
|
||||
}
|
||||
}
|
||||
topLevelClass.addJavaDocLine(" *");
|
||||
|
||||
topLevelClass.addJavaDocLine(" * This class was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This class corresponds to the database table ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
topLevelClass.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(topLevelClass, true);
|
||||
|
||||
topLevelClass.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addEnumComment(org.mybatis.generator.api.dom.java.InnerEnum, org.mybatis.generator.api.IntrospectedTable)
|
||||
*/
|
||||
public void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
innerEnum.addJavaDocLine("/**");
|
||||
innerEnum.addJavaDocLine(" * This enum was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This enum corresponds to the database table ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
innerEnum.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(innerEnum, false);
|
||||
|
||||
innerEnum.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addFieldComment(org.mybatis.generator.api.dom.java.Field, org.mybatis.generator.api.IntrospectedTable, org.mybatis.generator.api.IntrospectedColumn)
|
||||
*/
|
||||
public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
|
||||
|
||||
field.addJavaDocLine("/**");
|
||||
|
||||
String remarks = introspectedColumn.getRemarks();
|
||||
if (StringUtility.stringHasValue(remarks)) {
|
||||
field.addJavaDocLine(" * Database Column Remarks:");
|
||||
String[] remarkLines = remarks.split(System.getProperty("line.separator"));
|
||||
for (String remarkLine : remarkLines) {
|
||||
field.addJavaDocLine(" * " + remarkLine);
|
||||
}
|
||||
}
|
||||
|
||||
field.addJavaDocLine(" *");
|
||||
field.addJavaDocLine(" * This field was generated by MyBatis Generator.");
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" * This field corresponds to the database column ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
sb.append('.');
|
||||
sb.append(introspectedColumn.getActualColumnName());
|
||||
field.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(field, false);
|
||||
|
||||
field.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addFieldComment(org.mybatis.generator.api.dom.java.Field, org.mybatis.generator.api.IntrospectedTable)
|
||||
*/
|
||||
public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
field.addJavaDocLine("/**");
|
||||
field.addJavaDocLine(" * This field was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This field corresponds to the database table ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
field.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(field, false);
|
||||
|
||||
field.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addGeneralMethodComment(org.mybatis.generator.api.dom.java.Method, org.mybatis.generator.api.IntrospectedTable)
|
||||
*/
|
||||
public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
method.addJavaDocLine("/**");
|
||||
method.addJavaDocLine(" * This method was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This method corresponds to the database table ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
method.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(method, false);
|
||||
|
||||
method.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addGetterComment(org.mybatis.generator.api.dom.java.Method, org.mybatis.generator.api.IntrospectedTable, org.mybatis.generator.api.IntrospectedColumn)
|
||||
*/
|
||||
public void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
method.addJavaDocLine("/**");
|
||||
method.addJavaDocLine(" * This method was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This method returns the value of the database column ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
sb.append('.');
|
||||
sb.append(introspectedColumn.getActualColumnName());
|
||||
method.addJavaDocLine(sb.toString());
|
||||
|
||||
method.addJavaDocLine(" *");
|
||||
|
||||
sb.setLength(0);
|
||||
sb.append(" * @return the value of ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
sb.append('.');
|
||||
sb.append(introspectedColumn.getActualColumnName());
|
||||
method.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(method, false);
|
||||
|
||||
method.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addSetterComment(org.mybatis.generator.api.dom.java.Method, org.mybatis.generator.api.IntrospectedTable, org.mybatis.generator.api.IntrospectedColumn)
|
||||
*/
|
||||
public void addSetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
method.addJavaDocLine("/**");
|
||||
method.addJavaDocLine(" * This method was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This method sets the value of the database column ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
sb.append('.');
|
||||
sb.append(introspectedColumn.getActualColumnName());
|
||||
method.addJavaDocLine(sb.toString());
|
||||
|
||||
method.addJavaDocLine(" *");
|
||||
|
||||
Parameter parm = method.getParameters().get(0);
|
||||
sb.setLength(0);
|
||||
sb.append(" * @param ");
|
||||
sb.append(parm.getName());
|
||||
sb.append(" the value for ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
sb.append('.');
|
||||
sb.append(introspectedColumn.getActualColumnName());
|
||||
method.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(method, false);
|
||||
|
||||
method.addJavaDocLine(" */");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mybatis.generator.api.CommentGenerator#addClassComment(org.mybatis.generator.api.dom.java.InnerClass, org.mybatis.generator.api.IntrospectedTable, boolean)
|
||||
*/
|
||||
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
innerClass.addJavaDocLine("/**");
|
||||
innerClass.addJavaDocLine(" * This class was generated by MyBatis Generator.");
|
||||
|
||||
sb.append(" * This class corresponds to the database table ");
|
||||
sb.append(introspectedTable.getFullyQualifiedTable());
|
||||
innerClass.addJavaDocLine(sb.toString());
|
||||
|
||||
addJavadocTag(innerClass, markAsDoNotDelete);
|
||||
|
||||
innerClass.addJavaDocLine(" */");
|
||||
}
|
||||
}
|
||||
+17
-9
@@ -33,6 +33,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -54,16 +55,25 @@ public class TemplateCommentGenerator implements CommentGenerator {
|
||||
/**
|
||||
* 构造函数
|
||||
* @param templatePath 模板路径
|
||||
* @param useForDefault 未使用Comment插件,用作默认注释生成器
|
||||
*/
|
||||
public TemplateCommentGenerator(String templatePath) {
|
||||
|
||||
public TemplateCommentGenerator(String templatePath, boolean useForDefault) {
|
||||
try {
|
||||
File file = new File(templatePath);
|
||||
if (file.exists()) {
|
||||
// Xml 解析
|
||||
Document doc = new SAXReader().read(file);
|
||||
Document doc = null;
|
||||
if (useForDefault){
|
||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(templatePath);
|
||||
doc = new SAXReader().read(inputStream);
|
||||
} else {
|
||||
File file = new File(templatePath);
|
||||
if (file.exists()) {
|
||||
doc = new SAXReader().read(file);
|
||||
} else {
|
||||
logger.error("没有找到对应注释模板:" + templatePath);
|
||||
}
|
||||
}
|
||||
|
||||
// 遍历comment 节点
|
||||
// 遍历comment 节点
|
||||
if (doc != null){
|
||||
for (EnumNode node : EnumNode.values()){
|
||||
Element element = doc.getRootElement().elementByID(node.value());
|
||||
if (element != null){
|
||||
@@ -73,8 +83,6 @@ public class TemplateCommentGenerator implements CommentGenerator {
|
||||
templates.put(node, template);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("没有找到对应注释模板:" + templatePath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("注释模板XML解析失败!", e);
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template>
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* This method is called to add a file level comment to a generated java file. This method could be used to add a
|
||||
* general file comment (such as a copyright notice). However, note that the Java file merge function in Eclipse
|
||||
* does not deal with this comment. If you run the generator repeatedly, you will only retain the comment from the
|
||||
* initial run.
|
||||
* <p>
|
||||
*
|
||||
* The default implementation does nothing.
|
||||
*
|
||||
* @param compilationUnit
|
||||
* the compilation unit
|
||||
*/
|
||||
-->
|
||||
<comment ID="addJavaFileComment"></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* This method should add a suitable comment as a child element of the specified xmlElement to warn users that the
|
||||
* element was generated and is subject to regeneration.
|
||||
*
|
||||
* @param xmlElement
|
||||
* the xml element
|
||||
*/
|
||||
-->
|
||||
<comment ID="addComment"><![CDATA[
|
||||
<!--
|
||||
WARNING - ${mgb}
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* This method is called to add a comment as the first child of the root element. This method could be used to add a
|
||||
* general file comment (such as a copyright notice). However, note that the XML file merge function does not deal
|
||||
* with this comment. If you run the generator repeatedly, you will only retain the comment from the initial run.
|
||||
* <p>
|
||||
*
|
||||
* The default implementation does nothing.
|
||||
*
|
||||
* @param rootElement
|
||||
* the root element
|
||||
*/
|
||||
-->
|
||||
<comment ID="addRootComment"></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* This method should add a Javadoc comment to the specified field. The field is related to the specified table and
|
||||
* is used to hold the value of the specified column.
|
||||
* <p>
|
||||
*
|
||||
* <b>Important:</b> This method should add a the nonstandard JavaDoc tag "@mbg.generated" to the comment. Without
|
||||
* this tag, the Eclipse based Java merge feature will fail.
|
||||
*
|
||||
* @param field
|
||||
* the field
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
* @param introspectedColumn
|
||||
* the introspected column
|
||||
*/
|
||||
-->
|
||||
<comment ID="addFieldComment"><![CDATA[
|
||||
<#if introspectedColumn??>
|
||||
/**
|
||||
<#if introspectedColumn.remarks?? && introspectedColumn.remarks != ''>
|
||||
* Database Column Remarks:
|
||||
<#list introspectedColumn.remarks?split("\n") as remark>
|
||||
* ${remark}
|
||||
</#list>
|
||||
</#if>
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column ${introspectedTable.fullyQualifiedTable}.${introspectedColumn.actualColumnName}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
<#else>
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table ${introspectedTable.fullyQualifiedTable}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
</#if>
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds a comment for a model class. The Java code merger should
|
||||
* be notified not to delete the entire class in case any manual
|
||||
* changes have been made. So this method will always use the
|
||||
* "do not delete" annotation.
|
||||
*
|
||||
* Because of difficulties with the Java file merger, the default implementation
|
||||
* of this method should NOT add comments. Comments should only be added if
|
||||
* specifically requested by the user (for example, by enabling table remark comments).
|
||||
*
|
||||
* @param topLevelClass
|
||||
* the top level class
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
*/
|
||||
-->
|
||||
<comment ID="addModelClassComment"><![CDATA[
|
||||
/**
|
||||
<#if introspectedTable.remarks?? && introspectedTable.remarks != ''>
|
||||
* Database Table Remarks:
|
||||
<#list introspectedTable.remarks?split("\n") as remark>
|
||||
* ${remark}
|
||||
</#list>
|
||||
</#if>
|
||||
*
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table ${introspectedTable.fullyQualifiedTable}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds the inner class comment.
|
||||
*
|
||||
* @param innerClass
|
||||
* the inner class
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
*/
|
||||
-->
|
||||
<comment ID="addClassComment"><![CDATA[
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table ${introspectedTable.fullyQualifiedTable}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds the inner class comment.
|
||||
*
|
||||
* @param innerClass
|
||||
* the inner class
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
* @param markAsDoNotDelete
|
||||
* the mark as do not delete
|
||||
*/
|
||||
-->
|
||||
<comment ID="addClassComment"><![CDATA[
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table ${introspectedTable.fullyQualifiedTable}
|
||||
*
|
||||
* ${mgb}<#if markAsDoNotDelete?? && markAsDoNotDelete> do_not_delete_during_merge</#if>
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds the enum comment.
|
||||
*
|
||||
* @param innerEnum
|
||||
* the inner enum
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
*/
|
||||
-->
|
||||
<comment ID="addEnumComment"><![CDATA[
|
||||
/**
|
||||
* This enum was generated by MyBatis Generator.
|
||||
* This enum corresponds to the database table ${introspectedTable.fullyQualifiedTable}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds the interface comment.
|
||||
*
|
||||
* @param innerInterface
|
||||
* the inner interface
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
*/
|
||||
-->
|
||||
<comment ID="addInterfaceComment"><![CDATA[
|
||||
/**
|
||||
* This interface was generated by MyBatis Generator.
|
||||
* This interface corresponds to the database table ${introspectedTable.fullyQualifiedTable}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds the getter comment.
|
||||
*
|
||||
* @param method
|
||||
* the method
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
* @param introspectedColumn
|
||||
* the introspected column
|
||||
*/
|
||||
-->
|
||||
<comment ID="addGetterComment"><![CDATA[
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column ${introspectedTable.fullyQualifiedTable}.${introspectedColumn.actualColumnName}
|
||||
*
|
||||
* @return the value of ${introspectedTable.fullyQualifiedTable}.${introspectedColumn.actualColumnName}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds the setter comment.
|
||||
*
|
||||
* @param method
|
||||
* the method
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
* @param introspectedColumn
|
||||
* the introspected column
|
||||
*/
|
||||
-->
|
||||
<comment ID="addSetterComment"><![CDATA[
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column ${introspectedTable.fullyQualifiedTable}.${introspectedColumn.actualColumnName}
|
||||
*
|
||||
* @param ${method.parameters[0].name} the value for ${introspectedTable.fullyQualifiedTable}.${introspectedColumn.actualColumnName}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
|
||||
<!-- #############################################################################################################
|
||||
/**
|
||||
* Adds the general method comment.
|
||||
*
|
||||
* @param method
|
||||
* the method
|
||||
* @param introspectedTable
|
||||
* the introspected table
|
||||
*/
|
||||
-->
|
||||
<comment ID="addGeneralMethodComment"><![CDATA[
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table ${introspectedTable.fullyQualifiedTable}
|
||||
*
|
||||
* ${mgb}
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
]]></comment>
|
||||
</template>
|
||||
Reference in New Issue
Block a user