service.vm 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. package ${basePackage}.module.${table.moduleName}.service.${table.businessName};
  2. import java.util.*;
  3. import javax.validation.*;
  4. import ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo.*;
  5. import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
  6. ## 特殊:主子表专属逻辑
  7. #foreach ($subTable in $subTables)
  8. import ${basePackage}.module.${subTable.moduleName}.dal.dataobject.${subTable.businessName}.${subTable.className}DO;
  9. #end
  10. import ${PageResultClassName};
  11. /**
  12. * ${table.classComment} Service 接口
  13. *
  14. * @author ${table.author}
  15. */
  16. public interface ${table.className}Service {
  17. /**
  18. * 创建${table.classComment}
  19. *
  20. * @param createReqVO 创建信息
  21. * @return 编号
  22. */
  23. ${primaryColumn.javaType} create${simpleClassName}(@Valid ${sceneEnum.prefixClass}${table.className}CreateReqVO createReqVO);
  24. /**
  25. * 更新${table.classComment}
  26. *
  27. * @param updateReqVO 更新信息
  28. */
  29. void update${simpleClassName}(@Valid ${sceneEnum.prefixClass}${table.className}UpdateReqVO updateReqVO);
  30. /**
  31. * 删除${table.classComment}
  32. *
  33. * @param id 编号
  34. */
  35. void delete${simpleClassName}(${primaryColumn.javaType} id);
  36. /**
  37. * 获得${table.classComment}
  38. *
  39. * @param id 编号
  40. * @return ${table.classComment}
  41. */
  42. ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id);
  43. /**
  44. * 获得${table.classComment}分页
  45. *
  46. * @param pageReqVO 分页查询
  47. * @return ${table.classComment}分页
  48. */
  49. PageResult<${table.className}DO> get${simpleClassName}Page(${sceneEnum.prefixClass}${table.className}PageReqVO pageReqVO);
  50. /**
  51. * 获得${table.classComment}列表, 用于 Excel 导出
  52. *
  53. * @param exportReqVO 查询条件
  54. * @return ${table.classComment}列表
  55. */
  56. List<${table.className}DO> get${simpleClassName}List(${sceneEnum.prefixClass}${table.className}ExportReqVO exportReqVO);
  57. ## 特殊:主子表专属逻辑
  58. #foreach ($subTable in $subTables)
  59. #set ($index = $foreach.count - 1)
  60. #set ($subSimpleClassName = $subSimpleClassNames.get($index))
  61. #set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段
  62. #set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
  63. #set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
  64. #set ($subClassNameVar = $subClassNameVars.get($index))
  65. // ==================== 子表($subTable.classComment) ====================
  66. ## 情况一:MASTER_ERP 时,需要分查询页子表
  67. #if ( $table.templateType == 11 )
  68. /**
  69. * 获得${subTable.classComment}分页
  70. *
  71. * @param pageReqVO 分页查询
  72. * @param ${subJoinColumn.javaField} ${subJoinColumn.columnComment}
  73. * @return ${subTable.classComment}分页
  74. */
  75. PageResult<${subTable.className}DO> get${subSimpleClassName}Page(PageParam pageReqVO, ${subJoinColumn.javaType} ${subJoinColumn.javaField})
  76. ## 情况二:非 MASTER_ERP 时,需要列表查询子表
  77. #else
  78. #if ( $subTable.subJoinMany )
  79. /**
  80. * 获得${subTable.classComment}列表
  81. *
  82. * @param ${subJoinColumn.javaField} ${subJoinColumn.columnComment}
  83. * @return ${subTable.classComment}列表
  84. */
  85. List<${subTable.className}DO> get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField});
  86. #else
  87. /**
  88. * 获得${subTable.classComment}
  89. *
  90. * @param ${subJoinColumn.javaField} ${subJoinColumn.columnComment}
  91. * @return ${subTable.classComment}
  92. */
  93. ${subTable.className}DO get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField});
  94. #end
  95. #end
  96. ## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
  97. #if ( $table.templateType == 11 )
  98. /**
  99. * 创建${subTable.classComment}
  100. *
  101. * @param ${subClassNameVar} 创建信息
  102. * @return 编号
  103. */
  104. ${subPrimaryColumn.javaType} create${subSimpleClassName}(@Valid ${subTable.className}DO ${subClassNameVar});
  105. /**
  106. * 更新${subTable.classComment}
  107. *
  108. * @param ${subClassNameVar} 更新信息
  109. */
  110. void update${subSimpleClassName}(@Valid ${subTable.className}DO ${subClassNameVar});
  111. /**
  112. * 删除${subTable.classComment}
  113. *
  114. * @param id 编号
  115. */
  116. void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id);
  117. #end
  118. #end
  119. }