优化代码生成器注释生成
This commit is contained in:
parent
71066b6d83
commit
19e2d1c03b
|
|
@ -14,4 +14,7 @@ public class GenConfig {
|
|||
// 是否去除表前缀
|
||||
public static Boolean isRemoveTablePrefix = true;
|
||||
|
||||
// 注释类型[top=顶, right=右]
|
||||
public static String notesType = "right";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public class VelocityUtil {
|
|||
velocityContext.put("entityName", StringUtil.uncapitalize(table.getEntityName()));
|
||||
velocityContext.put("moduleName", table.getModuleName());
|
||||
velocityContext.put("functionName", StringUtil.isNotEmpty(table.getFunctionName()) ? table.getFunctionName() : "【请填写功能名称】");
|
||||
velocityContext.put("notesType", GenConfig.notesType);
|
||||
velocityContext.put("table", table);
|
||||
velocityContext.put("columns", columns);
|
||||
velocityContext.put("dateFields", SqlConstants.COLUMN_TIME_NAME);
|
||||
|
|
@ -119,8 +120,8 @@ public class VelocityUtil {
|
|||
// templates.add("java/service.java.vm");
|
||||
// templates.add("java/serviceImpl.java.vm");
|
||||
// templates.add("java/validate.java.vm");
|
||||
templates.add("java/voList.java.vm");
|
||||
// templates.add("java/voDetail.java.vm");
|
||||
// templates.add("java/voList.java.vm");
|
||||
templates.add("java/voDetail.java.vm");
|
||||
// templates.add("vue/api.ts.vm");
|
||||
// templates.add("vue/edit.vue.vm");
|
||||
// if (GenConstants.TPL_CRUD.equals(genTpl)) {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,12 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}管理
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/${moduleName}")
|
||||
|
|
|
|||
|
|
@ -6,8 +6,12 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}实体
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Data
|
||||
public class ${EntityName} implements Serializable {
|
||||
|
|
@ -15,10 +19,13 @@ public class ${EntityName} implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if($notesType.equals("top"))
|
||||
// ${column.columnComment}
|
||||
#end
|
||||
#if($column.isPk)
|
||||
@TableId(value="${column.columnName}", type= IdType.AUTO)
|
||||
#end
|
||||
private ${column.javaType} ${column.javaField}; // ${column.columnComment}
|
||||
private ${column.javaType} ${column.javaField}; #if($notesType.equals("right"))// ${column.columnComment}#end
|
||||
#end
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,14 @@
|
|||
package ${packageName}.common.mapper.${moduleName};
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.${moduleName}.${EntityName};
|
||||
import ${packageName}.common.core.basics.IBaseMapper;
|
||||
import ${packageName}.common.entity.${moduleName}.${EntityName};
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}Mapper
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${EntityName}Mapper extends IBaseMapper<${EntityName}> {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,12 @@ import ${packageName}.common.core.PageResult;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}服务接口类
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
public interface I${EntityName}Service {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,12 @@ import org.springframework.util.Assert;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}实现类
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Service
|
||||
public class ${EntityName}ServiceImpl implements I${EntityName}Service {
|
||||
|
|
@ -52,7 +56,6 @@ public class ${EntityName}ServiceImpl implements I${EntityName}Service {
|
|||
#end
|
||||
#end
|
||||
## 设置基本的参数变量
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
#set($pageParam = "@param pageParam 分页参数")
|
||||
#set($searchparams = "@param params 搜索参数")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,26 @@
|
|||
package ${packageName}.admin.validate.${moduleName};
|
||||
|
||||
import com.mdd.common.validator.annotation.IDMust;
|
||||
import com.mdd.common.validator.annotation.IntegerContains;
|
||||
import ${packageName}.admin.validate.BaseParam;
|
||||
import ${packageName}.common.validator.annotation.IDMust;
|
||||
import ${packageName}.common.validator.annotation.IntegerContains;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}参数
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class ${EntityName}Param implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public interface create{}
|
||||
public interface update{}
|
||||
public interface delete{}
|
||||
public class ${EntityName}Param extends BaseParam {
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isInsert || $column.isEdit || $column.isPk==1)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${EntityName}Vo
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Data
|
||||
public class ${EntityName}DetailVo implements Serializable {
|
||||
|
|
@ -14,10 +18,13 @@ public class ${EntityName}DetailVo implements Serializable {
|
|||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isEdit==1 || $column.isPk==1)
|
||||
#if($notesType.equals("top"))
|
||||
// ${column.columnComment}
|
||||
#end
|
||||
#if($dateFields.contains($column.columnName))
|
||||
private String ${column.javaField}; // ${column.columnComment}
|
||||
#else
|
||||
private ${column.javaType} ${column.javaField}; // ${column.columnComment}
|
||||
private ${column.javaType} ${column.javaField}; #if($notesType.equals("right"))// ${column.columnComment}#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${EntityName}Vo
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Data
|
||||
public class ${EntityName}ListVo implements Serializable {
|
||||
|
|
@ -14,10 +18,13 @@ public class ${EntityName}ListVo implements Serializable {
|
|||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isList==1 || $column.isPk==1)
|
||||
#if($notesType.equals("top"))
|
||||
// ${column.columnComment}
|
||||
#end
|
||||
#if($dateFields.contains($column.columnName))
|
||||
private String ${column.javaField}; // ${column.columnComment}
|
||||
#else
|
||||
private ${column.javaType} ${column.javaField}; // ${column.columnComment}
|
||||
private ${column.javaType} ${column.javaField}; #if($notesType.equals("right"))// ${column.columnComment}#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
|
|
|
|||
Loading…
Reference in New Issue