Java Code Examples for org.mybatis.generator.api.dom.java.Field#addJavaDocLine()

The following examples show how to use org.mybatis.generator.api.dom.java.Field#addJavaDocLine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommentGenerator.java    From HIS with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 2
Source File: CommentGenerator.java    From HIS with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 3
Source File: DefaultCommentGenerator.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
    if (suppressAllComments) {
        return;
    }

    StringBuilder sb = new StringBuilder();

    field.addJavaDocLine("/**"); //$NON-NLS-1$
    field
            .addJavaDocLine(" * This field was generated by MyBatis Generator."); //$NON-NLS-1$

    sb.append(" * This field corresponds to the database table "); //$NON-NLS-1$
    sb.append(introspectedTable.getFullyQualifiedTable());
    field.addJavaDocLine(sb.toString());

    addJavadocTag(field, false);

    field.addJavaDocLine(" */"); //$NON-NLS-1$
}
 
Example 4
Source File: CommentGenerator.java    From HIS with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 5
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 6
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 7
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 8
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 9
Source File: CommentGenerator.java    From HIS with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 10
Source File: CommentGenerator.java    From mall with Apache License 2.0 6 votes vote down vote up
/**
     * 给字段添加注释
     */
    @Override
    public void addFieldComment(Field field, IntrospectedTable introspectedTable,
                                IntrospectedColumn introspectedColumn) {
        String remarks = introspectedColumn.getRemarks();
        //根据参数和备注信息判断是否添加备注信息
        if(addRemarkComments&&StringUtility.stringHasValue(remarks)){
//            addFieldJavaDoc(field, remarks);
            //数据库中特殊字符需要转义
            if(remarks.contains("\"")){
                remarks = remarks.replace("\"","'");
            }
            //给model的字段添加swagger注解
            field.addJavaDocLine("@ApiModelProperty(value = \""+remarks+"\")");
        }
    }
 
Example 11
Source File: WrapObjectPlugin.java    From mybatis-generator-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
	if (tableMatches(introspectedTable)) {
		FullyQualifiedJavaType type = new FullyQualifiedJavaType(objectClass.getName());
		Field field = new Field(objectFieldName, type);
		field.setVisibility(JavaVisibility.PROTECTED);
		field.setInitializationString(String.format("new %s()", objectClass.getSimpleName()));

		field.addJavaDocLine("/**");
		field.addJavaDocLine(" * This field was generated by MyBatis Generator.");
		field.addJavaDocLine(" * This field corresponds to the wrapped object.");
		field.addJavaDocLine(" *");
		field.addJavaDocLine(" * @mbggenerated");
		field.addJavaDocLine(" */");

		topLevelClass.addField(field);
		topLevelClass.addImportedType(type);
	}

	return true;
}
 
Example 12
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}
 
Example 13
Source File: MySQLCommentGenerator.java    From mbg-comment with MIT License 5 votes vote down vote up
@Override
public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
    // 获取列注释
    String remarks = introspectedColumn.getRemarks();
    field.addJavaDocLine("/**");
    field.addJavaDocLine(" * " + remarks);
    field.addJavaDocLine(" */");
}
 
Example 14
Source File: CommentGenerator.java    From HIS with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}
 
Example 15
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}
 
Example 16
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}
 
Example 17
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}
 
Example 18
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}
 
Example 19
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}
 
Example 20
Source File: CommentGenerator.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
/**
 * 给model的字段添加注释
 */
private void addFieldJavaDoc(Field field, String remarks) {
    //文档注释开始
    field.addJavaDocLine("/**");
    //获取数据库字段的备注信息
    String[] remarkLines = remarks.split(System.getProperty("line.separator"));
    for(String remarkLine:remarkLines){
        field.addJavaDocLine(" * "+remarkLine);
    }
    addJavadocTag(field, false);
    field.addJavaDocLine(" */");
}