代码生成器:主子表,支持普通、内嵌、ERP 三种模式
This commit is contained in:
@@ -4,6 +4,10 @@ import java.util.*;
|
||||
import javax.validation.*;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
## 特殊:主子表专属逻辑
|
||||
#foreach ($subTable in $subTables)
|
||||
import ${basePackage}.module.${subTable.moduleName}.dal.dataobject.${subTable.businessName}.${subTable.className}DO;
|
||||
#end
|
||||
import ${PageResultClassName};
|
||||
|
||||
/**
|
||||
@@ -63,8 +67,26 @@ public interface ${table.className}Service {
|
||||
#foreach ($subTable in $subTables)
|
||||
#set ($index = $foreach.count - 1)
|
||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
||||
#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段
|
||||
#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
|
||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||
#set ($subClassNameVar = $subClassNameVars.get($index))
|
||||
|
||||
// ==================== 子表($subTable.classComment) ====================
|
||||
|
||||
## 情况一:MASTER_ERP 时,需要分查询页子表
|
||||
#if ( $table.templateType == 11 )
|
||||
/**
|
||||
* 获得${subTable.classComment}分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param ${subJoinColumn.javaField} ${subJoinColumn.columnComment}
|
||||
* @return ${subTable.classComment}分页
|
||||
*/
|
||||
PageResult<${subTable.className}DO> get${subSimpleClassName}Page(PageParam pageReqVO, ${subJoinColumn.javaType} ${subJoinColumn.javaField})
|
||||
|
||||
## 情况二:非 MASTER_ERP 时,需要列表查询子表
|
||||
#else
|
||||
#if ( $subTable.subJoinMany )
|
||||
/**
|
||||
* 获得${subTable.classComment}列表
|
||||
@@ -85,4 +107,30 @@ public interface ${table.className}Service {
|
||||
|
||||
#end
|
||||
#end
|
||||
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
||||
#if ( $table.templateType == 11 )
|
||||
/**
|
||||
* 创建${subTable.classComment}
|
||||
*
|
||||
* @param ${subClassNameVar} 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
${subPrimaryColumn.javaType} create${subSimpleClassName}(@Valid ${subTable.className}DO ${subClassNameVar});
|
||||
|
||||
/**
|
||||
* 更新${subTable.classComment}
|
||||
*
|
||||
* @param ${subClassNameVar} 更新信息
|
||||
*/
|
||||
void update${subSimpleClassName}(@Valid ${subTable.className}DO ${subClassNameVar});
|
||||
|
||||
/**
|
||||
* 删除${subTable.classComment}
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id);
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
Reference in New Issue
Block a user