@@ -37,13 +37,13 @@ public class ${modelNameUpperCamel}Controller {
37
37
*/
38
38
@GetMapping
39
39
public ResponseBean list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
40
- if(page <= 0 || rows <= 0){
40
+ if (page <= 0 || rows <= 0) {
41
41
page = 1;
42
42
rows = 10;
43
43
}
44
44
PageHelper.startPage(page, rows);
45
45
List<${modelNameUpperCamel} > list = ${modelNameLowerCamel} Service.selectAll();
46
- if(list == null || list.size() <= 0){
46
+ if (list == null || list.size() <= 0) {
47
47
throw new CustomException("查询失败(Query Failure)");
48
48
}
49
49
PageInfo<${modelNameUpperCamel} > pageInfo = new PageInfo<${modelNameUpperCamel} >(list);
@@ -61,7 +61,7 @@ public class ${modelNameUpperCamel}Controller {
61
61
@GetMapping("/{id}")
62
62
public ResponseBean detail(@PathVariable Integer id) {
63
63
${modelNameUpperCamel} ${modelNameLowerCamel} = ${modelNameLowerCamel} Service.selectByPrimaryKey(id);
64
- if(${modelNameLowerCamel} == null){
64
+ if (${modelNameLowerCamel} == null) {
65
65
throw new CustomException("查询失败(Query Failure)");
66
66
}
67
67
return new ResponseBean(HttpStatus.OK.value(), "查询成功(Query was successful)", ${modelNameLowerCamel} );
@@ -75,7 +75,7 @@ public class ${modelNameUpperCamel}Controller {
75
75
@PostMapping
76
76
public ResponseBean add(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel} ) {
77
77
int count = ${modelNameLowerCamel} Service.insert(${modelNameLowerCamel} );
78
- if(count <= 0){
78
+ if (count <= 0) {
79
79
throw new CustomException("新增失败(Insert Failure)");
80
80
}
81
81
return new ResponseBean(200, "新增成功(Insert Success)", ${modelNameLowerCamel} );
@@ -89,7 +89,7 @@ public class ${modelNameUpperCamel}Controller {
89
89
@PutMapping
90
90
public ResponseBean update(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel} ) {
91
91
int count = ${modelNameLowerCamel} Service.updateByPrimaryKeySelective(${modelNameLowerCamel} );
92
- if(count <= 0){
92
+ if (count <= 0) {
93
93
throw new CustomException("更新失败(Update Failure)");
94
94
}
95
95
return new ResponseBean(200, "更新成功(Update Success)", ${modelNameLowerCamel} );
@@ -103,7 +103,7 @@ public class ${modelNameUpperCamel}Controller {
103
103
@DeleteMapping("/{id}")
104
104
public ResponseBean delete(@PathVariable Integer id) {
105
105
int count = ${modelNameLowerCamel} Service.deleteByPrimaryKey(id);
106
- if(count <= 0){
106
+ if (count <= 0) {
107
107
throw new CustomException("删除失败,ID不存在(Deletion Failed. ID does not exist.)");
108
108
}
109
109
return new ResponseBean(200, "删除成功(Delete Success)", null);
0 commit comments