From c47de5f834f391c34ffd7f36fd3afd8e7cd73aed Mon Sep 17 00:00:00 2001 From: xlsea Date: Fri, 6 Sep 2024 14:18:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=A8=A1=E6=9D=BF(api=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=92=8Cindex=E9=A1=B5=E9=9D=A2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/soy.index.vue.vm | 150 +++++++++++++++++++++++++++++++ template/typings/soy.api.d.ts.vm | 39 ++++++++ 2 files changed, 189 insertions(+) create mode 100644 template/soy.index.vue.vm create mode 100644 template/typings/soy.api.d.ts.vm diff --git a/template/soy.index.vue.vm b/template/soy.index.vue.vm new file mode 100644 index 00000000..c4dfccc1 --- /dev/null +++ b/template/soy.index.vue.vm @@ -0,0 +1,150 @@ + + + + + diff --git a/template/typings/soy.api.d.ts.vm b/template/typings/soy.api.d.ts.vm new file mode 100644 index 00000000..2c17d7be --- /dev/null +++ b/template/typings/soy.api.d.ts.vm @@ -0,0 +1,39 @@ +#set($ModuleName=$moduleName.substring(0, 1).toUpperCase() + $moduleName.substring(1)) +/** + * namespace ${ModuleName} + * + * backend api module: "${ModuleName}" + */ +namespace ${ModuleName} { + /** ${businessName} */ + type ${ClassName} = Common.CommonRecord<{ + #foreach($column in $columns) + /** $column.columnComment */ + $column.javaField:#if($column.javaField.indexOf("id") != -1 || $column.javaField.indexOf("Id") != -1) CommonType.IdType; #elseif($column.javaType == 'Long' || $column.javaType == 'Integer' || $column.javaType == 'Double' || $column.javaType == 'Float' || $column.javaType == 'BigDecimal') number; #elseif($column.javaType == 'Boolean') boolean; #else string; #end + #end + }>; + + /** ${businessName} search params */ + type ${BusinessName}SearchParams = CommonType.RecordNullable< + Pick< + Api.${ModuleName}.${BusinessName}, + #foreach($column in $columns) + #if($column.query) + #set($dictType=$column.dictType) + #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if($foreach.hasNext) | #end ' ${column.javaField}' + #end + #end + > & + CommonSearchParams + >; + + /** ${businessName} list */ + type ${BusinessName}List = Common.PaginatingQueryRecord<${BusinessName}>; +}