Commit 5cf7a0e1 by 朱瑞泽

增加提示

parent b63329c1
package com.gic.demo.helper.generator; package com.gic.demo.helper.deploy;
import com.gic.deploy.DeployHelper; import com.gic.deploy.DeployHelper;
import com.gic.deploy.config.DeployType; import com.gic.deploy.config.DeployType;
......
...@@ -8,9 +8,7 @@ import org.mybatis.generator.api.dom.xml.XmlElement; ...@@ -8,9 +8,7 @@ import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.config.PropertyRegistry; import org.mybatis.generator.config.PropertyRegistry;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.Properties;
import java.util.Set;
import static org.mybatis.generator.internal.util.StringUtility.isTrue; import static org.mybatis.generator.internal.util.StringUtility.isTrue;
...@@ -140,7 +138,31 @@ public class MyCommentGenerator implements CommentGenerator { ...@@ -140,7 +138,31 @@ public class MyCommentGenerator implements CommentGenerator {
topLevelClass.addJavaDocLine(" */"); topLevelClass.addJavaDocLine(" */");
} }
private final static String MAPPER_METHOD_DOC = "/**\n" +
" * %s\n" +
" *\n" +
" * @param %s %s\n" +
" * @return %s\n" +
" */";
private final static Map<String, String[]> MAPPER_METHOD_DOC_MAP;
static {
MAPPER_METHOD_DOC_MAP = new HashMap<>();
MAPPER_METHOD_DOC_MAP.put("deleteByPrimaryKey", new String[]{"根据主键删除", "主键", "更新条目数"});
MAPPER_METHOD_DOC_MAP.put("insert", new String[]{"插入一条记录", "实体对象", "更新条目数"});
MAPPER_METHOD_DOC_MAP.put("insertSelective", new String[]{"动态插入一条记录", "实体对象", "更新条目数"});
MAPPER_METHOD_DOC_MAP.put("selectByPrimaryKey", new String[]{"根据主键查询", "主键", "实体对象"});
MAPPER_METHOD_DOC_MAP.put("updateByPrimaryKeySelective", new String[]{"根据主键动态更新记录", "实体对象", "更新条目数"});
MAPPER_METHOD_DOC_MAP.put("updateByPrimaryKeyWithBLOBs", new String[]{"根据主键更新记录,包括二进制大对象", "实体对象", "更新条目数"});
MAPPER_METHOD_DOC_MAP.put("updateByPrimaryKey", new String[]{"根据主键更新记录", "实体对象", "更新条目数"});
}
public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) { public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) {
if (MAPPER_METHOD_DOC_MAP.containsKey(method.getName())) {
String[] strings = MAPPER_METHOD_DOC_MAP.get(method.getName());
method.addJavaDocLine(String.format(MAPPER_METHOD_DOC, strings[0], method.getParameters().iterator().next().getName(), strings[1], strings[2]));
}
} }
public void addGetterComment(Method method, IntrospectedTable introspectedTable, public void addGetterComment(Method method, IntrospectedTable introspectedTable,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment