|
@@ -44,7 +44,7 @@ export default {
|
|
components: {},
|
|
components: {},
|
|
created: function() {
|
|
created: function() {
|
|
this.getData();
|
|
this.getData();
|
|
- this.getUrlData();
|
|
|
|
|
|
+ // this.getUrlData();
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
// alert(this.schema);
|
|
// alert(this.schema);
|
|
@@ -64,8 +64,9 @@ export default {
|
|
},
|
|
},
|
|
//生成实体类
|
|
//生成实体类
|
|
genEntrty() {
|
|
genEntrty() {
|
|
|
|
+ this.getUrlData();
|
|
let strBuild = new SStringBuilder();
|
|
let strBuild = new SStringBuilder();
|
|
- const table = this.toHump(this.table);
|
|
|
|
|
|
+ const table = this.toHump(this.urlObj.urlType);
|
|
strBuild.append(
|
|
strBuild.append(
|
|
`package cn.sagacloud.server.datacenter.models.entities
|
|
`package cn.sagacloud.server.datacenter.models.entities
|
|
|
|
|
|
@@ -80,12 +81,12 @@ import javax.persistence.Id
|
|
import javax.persistence.Table
|
|
import javax.persistence.Table
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 资产信息实体类
|
|
|
|
|
|
+ * ${this.urlObj.urlName}信息实体类
|
|
*
|
|
*
|
|
* @author 自动生成
|
|
* @author 自动生成
|
|
*/
|
|
*/
|
|
@ApiModel(description = "资产信息实体类")
|
|
@ApiModel(description = "资产信息实体类")
|
|
-@Table(name = "${this.schema}.${table}")
|
|
|
|
|
|
+@Table(name = "${this.schema}.${this.urlObj.urlType}")
|
|
open class ${table} : BaseInfo(),Comparator<${table}> {
|
|
open class ${table} : BaseInfo(),Comparator<${table}> {
|
|
`
|
|
`
|
|
);
|
|
);
|
|
@@ -102,7 +103,7 @@ open class ${table} : BaseInfo(),Comparator<${table}> {
|
|
}
|
|
}
|
|
strBuild.append(` @Column(name = "${element.ColumnName}")`);
|
|
strBuild.append(` @Column(name = "${element.ColumnName}")`);
|
|
strBuild.append(
|
|
strBuild.append(
|
|
- ` var ${this.toHump(element.ColumnName)}: ${this.typeToName(
|
|
|
|
|
|
+ ` var ${this.toSmallHump(element.ColumnName)}: ${this.typeToName(
|
|
element.ColumnType
|
|
element.ColumnType
|
|
)}? = null\n`
|
|
)}? = null\n`
|
|
);
|
|
);
|
|
@@ -113,6 +114,7 @@ open class ${table} : BaseInfo(),Comparator<${table}> {
|
|
},
|
|
},
|
|
//生成接口类
|
|
//生成接口类
|
|
genControler() {
|
|
genControler() {
|
|
|
|
+ this.getUrlData();
|
|
let strBuild = new SStringBuilder();
|
|
let strBuild = new SStringBuilder();
|
|
const className = `${this.toHump(this.urlObj.urlType)}Controller`;
|
|
const className = `${this.toHump(this.urlObj.urlType)}Controller`;
|
|
strBuild.append(`package cn.sagacloud.server.datacenter.controllers
|
|
strBuild.append(`package cn.sagacloud.server.datacenter.controllers
|
|
@@ -161,9 +163,9 @@ open class ${className} {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "创建${this.urlObj.urlName}信息", notes = "")
|
|
@ApiOperation(value = "创建${this.urlObj.urlName}信息", notes = "")
|
|
@PostMapping(value = ["/create"])
|
|
@PostMapping(value = ["/create"])
|
|
- fun create(@RequestBody request: SCreateRequest<${this.typeToName(
|
|
|
|
- this.urlObj.urlType
|
|
|
|
- )}>): SCreateResponse<${this.typeToName(this.urlObj.urlType)}> {
|
|
|
|
|
|
+ fun create(@RequestBody request: SCreateRequest<${this.toHump(
|
|
|
|
+ this.table
|
|
|
|
+ )}>): SCreateResponse<${this.toHump(this.table)}> {
|
|
|
|
|
|
return PropertyService.createList( request)
|
|
return PropertyService.createList( request)
|
|
} // Function create()
|
|
} // Function create()
|
|
@@ -176,8 +178,8 @@ open class ${className} {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "根据id删除${this.urlObj.urlName}信息", notes = "")
|
|
@ApiOperation(value = "根据id删除${this.urlObj.urlName}信息", notes = "")
|
|
@PostMapping(value = ["/delete"])
|
|
@PostMapping(value = ["/delete"])
|
|
- fun delete(@RequestBody idList: ArrayList<${this.typeToName(
|
|
|
|
- this.urlObj.urlType
|
|
|
|
|
|
+ fun delete(@RequestBody idList: ArrayList<${this.toHump(
|
|
|
|
+ this.table
|
|
)}>): SBaseResponse {
|
|
)}>): SBaseResponse {
|
|
return PropertyService.deleteByKeysList(idList)
|
|
return PropertyService.deleteByKeysList(idList)
|
|
} // Function delete()
|
|
} // Function delete()
|
|
@@ -190,8 +192,8 @@ open class ${className} {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "更新${this.urlObj.urlName}信息", notes = "")
|
|
@ApiOperation(value = "更新${this.urlObj.urlName}信息", notes = "")
|
|
@PostMapping(value = ["/update"])
|
|
@PostMapping(value = ["/update"])
|
|
- fun update(@RequestBody request: SUpdateRequest<${this.typeToName(
|
|
|
|
- this.urlObj.urlType
|
|
|
|
|
|
+ fun update(@RequestBody request: SUpdateRequest<${this.toHump(
|
|
|
|
+ this.table
|
|
)}>): SBaseResponse {
|
|
)}>): SBaseResponse {
|
|
return PropertyService.updateList(request)
|
|
return PropertyService.updateList(request)
|
|
} // Function update()
|
|
} // Function update()
|
|
@@ -204,8 +206,8 @@ open class ${className} {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "查询${this.urlObj.urlName}信息", notes="")
|
|
@ApiOperation(value = "查询${this.urlObj.urlName}信息", notes="")
|
|
@PostMapping(value = ["/query"])
|
|
@PostMapping(value = ["/query"])
|
|
- fun query(@RequestBody request: SQueryRequest): SQueryResponse<${this.typeToName(
|
|
|
|
- this.urlObj.urlType
|
|
|
|
|
|
+ fun query(@RequestBody request: SQueryRequest): SQueryResponse<${this.toHump(
|
|
|
|
+ this.table
|
|
)}> {
|
|
)}> {
|
|
return PropertyService.pageQuery(request)
|
|
return PropertyService.pageQuery(request)
|
|
} // Function query()
|
|
} // Function query()
|
|
@@ -220,7 +222,8 @@ open class ${className} {
|
|
} // Function count()
|
|
} // Function count()
|
|
`);
|
|
`);
|
|
strBuild.append(`} // Class ${className}`);
|
|
strBuild.append(`} // Class ${className}`);
|
|
- this.download(`${className}.kt`, strBuild.toString());
|
|
|
|
|
|
+ console.log("className", className);
|
|
|
|
+ // this.download(`${className}.kt`, strBuild.toString());
|
|
},
|
|
},
|
|
// 数据包类型到实体类的转换
|
|
// 数据包类型到实体类的转换
|
|
typeToName(name) {
|
|
typeToName(name) {
|
|
@@ -251,13 +254,37 @@ open class ${className} {
|
|
}
|
|
}
|
|
return arr.join("");
|
|
return arr.join("");
|
|
},
|
|
},
|
|
|
|
+ //转小驼峰
|
|
|
|
+ toSmallHump(str) {
|
|
|
|
+ var arr = str.split("_");
|
|
|
|
+ for (var i = 1; i < arr.length; i++) {
|
|
|
|
+ arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].substring(1);
|
|
|
|
+ }
|
|
|
|
+ return arr.join("");
|
|
|
|
+ },
|
|
// 获取路径名称以及路径type
|
|
// 获取路径名称以及路径type
|
|
getUrlData() {
|
|
getUrlData() {
|
|
const dataArr = window.location.href.split("#")[1].split("-");
|
|
const dataArr = window.location.href.split("#")[1].split("-");
|
|
- const obj = {
|
|
|
|
- urlType: dataArr[1],
|
|
|
|
- urlName: decodeURIComponent(dataArr[0])
|
|
|
|
- };
|
|
|
|
|
|
+ let obj = {};
|
|
|
|
+ if (dataArr.length == 2) {
|
|
|
|
+ obj = {
|
|
|
|
+ urlType: dataArr[1],
|
|
|
|
+ urlName: decodeURIComponent(dataArr[0])
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ let urlName = "";
|
|
|
|
+ let lengthNum = dataArr.length;
|
|
|
|
+ dataArr.forEach((item, i) => {
|
|
|
|
+ if (i + 2 <= lengthNum) {
|
|
|
|
+ urlName = urlName + "-" + item;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ obj = {
|
|
|
|
+ urlType: dataArr[lengthNum-1],
|
|
|
|
+ urlName: decodeURIComponent(urlName)
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
this.urlObj = obj;
|
|
this.urlObj = obj;
|
|
},
|
|
},
|
|
// 下载文件
|
|
// 下载文件
|