♻️ 重构代码 . R.ok R.failed
This commit is contained in:
1 parent
8affb5519e
commit
0ca10e1adc
43 files changed
+231
-249
No files matched your search
@@ -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}));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user