Browse Source

fix

main
cobb 3 years ago
parent
commit
9d1d3d01e4
  1. 14
      src/components/HelloWorld.vue

14
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 {
// idListID
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`;

Loading…
Cancel
Save