From 9d1d3d01e434bb02c462e76e446158133f2adc5f Mon Sep 17 00:00:00 2001 From: cobb Date: Fri, 29 Jul 2022 17:30:48 +0800 Subject: [PATCH] fix --- src/components/HelloWorld.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index cacd07f..db545e1 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -193,7 +193,7 @@ export default { }, genCode() { let v = this.schema; - this.output["model"] = this.handleModelOutput(v); + this.output["model"] = this.handleModelOutput(v, this.isUnderScoreCase); this.output["service"] = this.handleServiceOutput(v); this.output["api"] = this.handleApiOutput(v); this.output["route"] = this.handleRouteOutput(v); @@ -220,7 +220,7 @@ export default { onSchemaChange(v) { this.jsonformat = v; this.schema = JSON.stringify(v, null, 2); - this.output["model"] = this.handleModelOutput(v); + this.output["model"] = this.handleModelOutput(v, this.isUnderScoreCase); this.output["service"] = this.handleServiceOutput(v); this.output["api"] = this.handleApiOutput(v); this.output["route"] = this.handleRouteOutput(v); @@ -473,7 +473,7 @@ export default { var result = oReq.responseText; //响应结果 return result; }, - handleModelOutput(v) { + handleModelOutput(v, isUnderScoreCase) { const tablePrefix = rmPrefix(v.title).prefix; var struct = this.getMyStruct(tablePrefix); console.log("struct", struct); @@ -670,7 +670,7 @@ export default { } if (key.indexOf("_time") > -1) { - if (this.isUnderScoreCase) { + if (isUnderScoreCase) { center += `${skey}Interval []interface{} \`json:"${key}|interval,omitempty" form:"${key}|interval"\`\n`; } else { center += `${skey}Interval []interface{} \`json:"${caseKey}|interval,omitempty" form:"${caseKey}|interval"\`\n`; @@ -699,7 +699,7 @@ export default { // id过滤掉,不能生成,List里面可以查询ID会有风险 if (key.indexOf("_id") > -1) { - if (this.isUnderScoreCase) { + if (isUnderScoreCase) { center += `${skey}In []${type} \`json:"${key}|in,omitempty" form:"${key}|in"\`\n`; } else { center += `${skey}In []${type} \`json:"${caseKey}|in,omitempty" form:"${caseKey}|in"\`\n`; @@ -719,7 +719,7 @@ export default { } if (requires.indexOf(key) > -1) { - if (this.isUnderScoreCase) { + if (isUnderScoreCase) { center += `${skey} ${type} \`json:"${key},omitempty" form:"${key}"\`\n`; } else { center += `${skey} ${type} \`json:"${caseKey},omitempty" form:"${caseKey}"\`\n`; @@ -746,7 +746,7 @@ export default { \n `; if (type == "string") { - if (this.isUnderScoreCase) { + if (isUnderScoreCase) { center += `${skey}Like ${type} \`json:"${key}|like,omitempty" form:"${key}|like"\`\n`; } else { center += `${skey}Like ${type} \`json:"${caseKey}|like,omitempty" form:"${caseKey}|like"\`\n`;