|
@@ -47,12 +47,13 @@ export default {
|
|
|
},
|
|
|
mounted: function() {
|
|
|
},
|
|
|
- props: ["sys", "schema", "table"],
|
|
|
+ props: ["sys", "schema", "table","tableName"],
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
getData() {
|
|
|
+ const origin = Location.origin
|
|
|
Axios.get(
|
|
|
- `${window.location.origin}/${this.sys}/--database-doc--/table-info?schema=${
|
|
|
+ `/${this.sys}/--database-doc--/table-info?schema=${
|
|
|
this.schema
|
|
|
}&table=${this.table}`,
|
|
|
{}
|
|
@@ -64,7 +65,7 @@ export default {
|
|
|
genEntrty() {
|
|
|
this.getUrlData();
|
|
|
let strBuild = new SStringBuilder();
|
|
|
- const table = this.toHump(this.urlObj.urlType);
|
|
|
+ const table = this.toHump(this.table);
|
|
|
strBuild.append(
|
|
|
`package cn.sagacloud.server.datacenter.models.entities
|
|
|
|
|
@@ -79,16 +80,16 @@ import javax.persistence.Id
|
|
|
import javax.persistence.Table
|
|
|
|
|
|
/**
|
|
|
- * ${this.urlObj.urlName}信息实体类
|
|
|
+ * ${this.tableName}信息实体类
|
|
|
*
|
|
|
* @author 自动生成
|
|
|
*/
|
|
|
@ApiModel(description = "资产信息实体类")
|
|
|
-@Table(name = "${this.schema}.${this.urlObj.urlType}")
|
|
|
+@Table(name = "${this.schema}.${this.table}")
|
|
|
open class ${table} : BaseInfo(),Comparator<${table}> {
|
|
|
`
|
|
|
);
|
|
|
- this.tableData.forEach(element => {
|
|
|
+ this.tableData.ColumnList.forEach(element => {
|
|
|
strBuild.append(` /** ${element.Description} */`);
|
|
|
if (element.Nullable == "YES") {
|
|
|
strBuild.append(
|
|
@@ -115,11 +116,11 @@ open class ${table} : BaseInfo(),Comparator<${table}> {
|
|
|
genControler() {
|
|
|
this.getUrlData();
|
|
|
let strBuild = new SStringBuilder();
|
|
|
- const className = `${this.toHump(this.urlObj.urlType)}Controller`;
|
|
|
+ const className = `${this.toHump(this.table)}Controller`;
|
|
|
strBuild.append(`package cn.sagacloud.server.datacenter.controllers
|
|
|
|
|
|
import cn.sagacloud.server.datacenter.models.entities.Property
|
|
|
-import cn.sagacloud.server.datacenter.services.PropertyService
|
|
|
+import cn.sagacloud.server.datacenter.services.${this.toHump(this.table)}Service
|
|
|
import com.sybotan.base.extensions.toJson
|
|
|
import com.sybotan.database.SFilter
|
|
|
import com.sybotan.service.SPageContext
|
|
@@ -141,74 +142,79 @@ import org.springframework.web.bind.annotation.RestController
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * ${this.urlObj.urlName}接口
|
|
|
+ * ${this.tableName}接口
|
|
|
*
|
|
|
* @author 自动生成
|
|
|
*/
|
|
|
-@Api(tags = ["${this.urlObj.urlName}"])
|
|
|
+@Api(tags = ["${this.tableName}"])
|
|
|
@RestController
|
|
|
-@RequestMapping("/object/${this.urlObj.urlType}")
|
|
|
+@RequestMapping("/object/${this.table}")
|
|
|
open class ${className} {
|
|
|
companion object {
|
|
|
/** 日志 */
|
|
|
private val logger = LoggerFactory.getLogger(${className}::class.java)
|
|
|
} // Companion object
|
|
|
|
|
|
+
|
|
|
+ /** 服务 */
|
|
|
+ val service = SBaseService(SMybatisDao(${this.toHump(this.table)}::class.java))
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
- * 创建${this.urlObj.urlName}
|
|
|
+ * 创建${this.tableName}
|
|
|
*
|
|
|
- * @param request ${this.urlObj.urlName}对象列表
|
|
|
+ * @param request ${this.tableName}对象列表
|
|
|
* @return 创建结果信息
|
|
|
*/
|
|
|
- @ApiOperation(value = "创建${this.urlObj.urlName}信息", notes = "")
|
|
|
+ @ApiOperation(value = "创建${this.tableName}信息", notes = "")
|
|
|
@PostMapping(value = ["/create"])
|
|
|
fun create(@RequestBody request: SCreateRequest<${this.toHump(
|
|
|
this.table
|
|
|
)}>): SCreateResponse<${this.toHump(this.table)}> {
|
|
|
|
|
|
- return PropertyService.createList( request)
|
|
|
+ return service.createList( request)
|
|
|
} // Function create()
|
|
|
|
|
|
/**
|
|
|
- * 根据id删除${this.urlObj.urlName}
|
|
|
+ * 根据id删除${this.tableName}
|
|
|
*
|
|
|
* @param idList id数组
|
|
|
* @return 删除的结果信息
|
|
|
*/
|
|
|
- @ApiOperation(value = "根据id删除${this.urlObj.urlName}信息", notes = "")
|
|
|
+ @ApiOperation(value = "根据id删除${this.tableName}信息", notes = "")
|
|
|
@PostMapping(value = ["/delete"])
|
|
|
fun delete(@RequestBody idList: ArrayList<${this.toHump(
|
|
|
this.table
|
|
|
)}>): SBaseResponse {
|
|
|
- return PropertyService.deleteByKeysList(idList)
|
|
|
+ return service.deleteByKeysList(idList)
|
|
|
} // Function delete()
|
|
|
|
|
|
/**
|
|
|
- * 更新${this.urlObj.urlName}信息
|
|
|
+ * 更新${this.tableName}信息
|
|
|
*
|
|
|
* @param request 更新的内容对象
|
|
|
* @return 更新的结果
|
|
|
*/
|
|
|
- @ApiOperation(value = "更新${this.urlObj.urlName}信息", notes = "")
|
|
|
+ @ApiOperation(value = "更新${this.tableName}信息", notes = "")
|
|
|
@PostMapping(value = ["/update"])
|
|
|
fun update(@RequestBody request: SUpdateRequest<${this.toHump(
|
|
|
this.table
|
|
|
)}>): SBaseResponse {
|
|
|
- return PropertyService.updateList(request)
|
|
|
+ return service.updateList(request)
|
|
|
} // Function update()
|
|
|
|
|
|
/**
|
|
|
- * 查询${this.urlObj.urlName}信息
|
|
|
+ * 查询${this.tableName}信息
|
|
|
*
|
|
|
* @param request 查询信息条件
|
|
|
* @return 查询结果
|
|
|
*/
|
|
|
- @ApiOperation(value = "查询${this.urlObj.urlName}信息", notes="")
|
|
|
+ @ApiOperation(value = "查询${this.tableName}信息", notes="")
|
|
|
@PostMapping(value = ["/query"])
|
|
|
fun query(@RequestBody request: SQueryRequest): SQueryResponse<${this.toHump(
|
|
|
this.table
|
|
|
)}> {
|
|
|
- return PropertyService.pageQuery(request)
|
|
|
+ return service.pageQuery(request)
|
|
|
} // Function query()
|
|
|
|
|
|
/**
|
|
@@ -217,11 +223,11 @@ open class ${className} {
|
|
|
@ApiOperation(value = "根据条件查询统计数量", notes = "")
|
|
|
@PostMapping(value = ["/count"])
|
|
|
fun count(@RequestBody request: SCountRequest): SCountResponse {
|
|
|
- return PropertyService.count(request)
|
|
|
+ return servicee.count(request)
|
|
|
} // Function count()
|
|
|
`);
|
|
|
strBuild.append(`} // Class ${className}`);
|
|
|
- // this.download(`${className}.kt`, strBuild.toString());
|
|
|
+ this.download(`${className}.kt`, strBuild.toString());
|
|
|
},
|
|
|
// 数据包类型到实体类的转换
|
|
|
typeToName(name) {
|
|
@@ -262,7 +268,7 @@ open class ${className} {
|
|
|
},
|
|
|
// 获取路径名称以及路径type
|
|
|
getUrlData() {
|
|
|
- const dataArr = window.location.href.split("#")[1].split("-");
|
|
|
+ const dataArr = Location.href.split("#")[1].split("-");
|
|
|
let obj = {};
|
|
|
if (dataArr.length == 2) {
|
|
|
obj = {
|