mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-13 14:09:00 +08:00
♻️ 重构代码 . R.ok R.failed
This commit is contained in:
1 parent
8affb5519e
commit
0ca10e1adc
43 files changed
+231
-249
No files matched your search
+6
-6
@@ -47,7 +47,7 @@ public class SysDsConfController {
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R getSysDatasourceConfPage(Page page, SysDatasourceConf sysDatasourceConf) {
|
||||
return new R<>(sysDatasourceConfService.page(page, Wrappers.query(sysDatasourceConf)));
|
||||
return R.ok(sysDatasourceConfService.page(page, Wrappers.query(sysDatasourceConf)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ public class SysDsConfController {
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R list() {
|
||||
return new R<>(sysDatasourceConfService.list());
|
||||
return R.ok(sysDatasourceConfService.list());
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class SysDsConfController {
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R getById(@PathVariable("id") Integer id) {
|
||||
return new R<>(sysDatasourceConfService.getById(id));
|
||||
return R.ok(sysDatasourceConfService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ public class SysDsConfController {
|
||||
@SysLog("新增数据源表")
|
||||
@PostMapping
|
||||
public R save(@RequestBody SysDatasourceConf sysDatasourceConf) {
|
||||
return new R<>(sysDatasourceConfService.saveDsByEnc(sysDatasourceConf));
|
||||
return R.ok(sysDatasourceConfService.saveDsByEnc(sysDatasourceConf));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ public class SysDsConfController {
|
||||
@SysLog("修改数据源表")
|
||||
@PutMapping
|
||||
public R updateById(@RequestBody SysDatasourceConf sysDatasourceConf) {
|
||||
return new R<>(sysDatasourceConfService.updateDsByEnc(sysDatasourceConf));
|
||||
return R.ok(sysDatasourceConfService.updateDsByEnc(sysDatasourceConf));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ public class SysDsConfController {
|
||||
@SysLog("删除数据源表")
|
||||
@DeleteMapping("/{id}")
|
||||
public R removeById(@PathVariable Integer id) {
|
||||
return new R<>(sysDatasourceConfService.removeById(id));
|
||||
return R.ok(sysDatasourceConfService.removeById(id));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class SysGeneratorController {
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R getPage(Page page, String tableName, Integer id) {
|
||||
return new R<>(sysGeneratorService.getPage(page, tableName, id));
|
||||
return R.ok(sysGeneratorService.getPage(page, tableName, id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ${className}Controller {
|
||||
*/
|
||||
@GetMapping("/page" )
|
||||
public R get${className}Page(Page page, ${className} ${classname}) {
|
||||
return new R<>(${classname}Service.page(page, Wrappers.query(${classname})));
|
||||
return R.ok(${classname}Service.page(page, Wrappers.query(${classname})));
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ${className}Controller {
|
||||
*/
|
||||
@GetMapping("/{${pk.lowerAttrName}}" )
|
||||
public R getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) {
|
||||
return new R<>(${classname}Service.getById(${pk.lowerAttrName}));
|
||||
return R.ok(${classname}Service.getById(${pk.lowerAttrName}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class ${className}Controller {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_add')" )
|
||||
public R save(@RequestBody ${className} ${classname}) {
|
||||
return new R<>(${classname}Service.save(${classname}));
|
||||
return R.ok(${classname}Service.save(${classname}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +88,7 @@ public class ${className}Controller {
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_edit')" )
|
||||
public R updateById(@RequestBody ${className} ${classname}) {
|
||||
return new R<>(${classname}Service.updateById(${classname}));
|
||||
return R.ok(${classname}Service.updateById(${classname}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ public class ${className}Controller {
|
||||
@DeleteMapping("/{${pk.lowerAttrName}}" )
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_del')" )
|
||||
public R removeById(@PathVariable ${pk.attrType} ${pk.lowerAttrName}) {
|
||||
return new R<>(${classname}Service.removeById(${pk.lowerAttrName}));
|
||||
return R.ok(${classname}Service.removeById(${pk.lowerAttrName}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,6 +83,8 @@
|
||||
this.tableData = response.data.data.records
|
||||
this.page.total = response.data.data.total
|
||||
this.tableLoading = false
|
||||
}).catch(() => {
|
||||
this.listLoading=false
|
||||
})
|
||||
},
|
||||
rowDel: function (row, index) {
|
||||
@@ -101,7 +103,6 @@
|
||||
type: 'success'
|
||||
})
|
||||
this.getList(this.page)
|
||||
}).catch(function (err) {
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -111,7 +112,7 @@
|
||||
* @param done 为表单关闭函数
|
||||
*
|
||||
**/
|
||||
handleUpdate: function (row, index, done) {
|
||||
handleUpdate: function (row, index, done,loading) {
|
||||
putObj(row).then(data => {
|
||||
this.tableData.splice(index, 1, Object.assign({}, row))
|
||||
this.$message({
|
||||
@@ -121,7 +122,9 @@
|
||||
})
|
||||
done()
|
||||
this.getList(this.page)
|
||||
})
|
||||
}).catch(() => {
|
||||
loading();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @title 数据添加
|
||||
@@ -129,7 +132,7 @@
|
||||
* @param done 为表单关闭函数
|
||||
*
|
||||
**/
|
||||
handleSave: function (row, done) {
|
||||
handleSave: function (row, done,loading) {
|
||||
addObj(row).then(data => {
|
||||
this.tableData.push(Object.assign({}, row))
|
||||
this.$message({
|
||||
@@ -139,7 +142,9 @@
|
||||
})
|
||||
done()
|
||||
this.getList(this.page)
|
||||
})
|
||||
}).catch(() => {
|
||||
loading();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 搜索回调
|
||||
|
||||
Reference in new issue
Block a user