@@ -37,13 +37,13 @@ public class ${modelNameUpperCamel}Controller {
3737 */
3838 @GetMapping
3939 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) {
4141 page = 1;
4242 rows = 10;
4343 }
4444 PageHelper.startPage(page, rows);
4545 List<${modelNameUpperCamel} > list = ${modelNameLowerCamel} Service.selectAll();
46- if(list == null || list.size() <= 0){
46+ if (list == null || list.size() <= 0) {
4747 throw new CustomException("查询失败(Query Failure)");
4848 }
4949 PageInfo<${modelNameUpperCamel} > pageInfo = new PageInfo<${modelNameUpperCamel} >(list);
@@ -61,7 +61,7 @@ public class ${modelNameUpperCamel}Controller {
6161 @GetMapping("/{id}")
6262 public ResponseBean detail(@PathVariable Integer id) {
6363 ${modelNameUpperCamel} ${modelNameLowerCamel} = ${modelNameLowerCamel} Service.selectByPrimaryKey(id);
64- if(${modelNameLowerCamel} == null){
64+ if (${modelNameLowerCamel} == null) {
6565 throw new CustomException("查询失败(Query Failure)");
6666 }
6767 return new ResponseBean(HttpStatus.OK.value(), "查询成功(Query was successful)", ${modelNameLowerCamel} );
@@ -75,7 +75,7 @@ public class ${modelNameUpperCamel}Controller {
7575 @PostMapping
7676 public ResponseBean add(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel} ) {
7777 int count = ${modelNameLowerCamel} Service.insert(${modelNameLowerCamel} );
78- if(count <= 0){
78+ if (count <= 0) {
7979 throw new CustomException("新增失败(Insert Failure)");
8080 }
8181 return new ResponseBean(200, "新增成功(Insert Success)", ${modelNameLowerCamel} );
@@ -89,7 +89,7 @@ public class ${modelNameUpperCamel}Controller {
8989 @PutMapping
9090 public ResponseBean update(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel} ) {
9191 int count = ${modelNameLowerCamel} Service.updateByPrimaryKeySelective(${modelNameLowerCamel} );
92- if(count <= 0){
92+ if (count <= 0) {
9393 throw new CustomException("更新失败(Update Failure)");
9494 }
9595 return new ResponseBean(200, "更新成功(Update Success)", ${modelNameLowerCamel} );
@@ -103,7 +103,7 @@ public class ${modelNameUpperCamel}Controller {
103103 @DeleteMapping("/{id}")
104104 public ResponseBean delete(@PathVariable Integer id) {
105105 int count = ${modelNameLowerCamel} Service.deleteByPrimaryKey(id);
106- if(count <= 0){
106+ if (count <= 0) {
107107 throw new CustomException("删除失败,ID不存在(Deletion Failed. ID does not exist.)");
108108 }
109109 return new ResponseBean(200, "删除成功(Delete Success)", null);
0 commit comments