|
@@ -1,41 +1,57 @@
|
|
|
package com.example.demo.controllers;
|
|
package com.example.demo.controllers;
|
|
|
|
|
|
|
|
-import com.example.demo.bean.Poi;
|
|
|
|
|
|
|
+import com.example.demo.pojo.Poi;
|
|
|
|
|
+import com.example.demo.vo.PoiVo;
|
|
|
|
|
+import com.example.demo.vo.Result;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import lombok.var;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
@RestController
|
|
@RestController
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@RequestMapping("/poi")
|
|
@RequestMapping("/poi")
|
|
|
public class PoiController {
|
|
public class PoiController {
|
|
|
|
|
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
|
- public String list(@RequestParam(defaultValue = "1") int pageNum,@RequestParam(defaultValue = "1") int pageSize){
|
|
|
|
|
- String test = "pageNum:"+pageNum+" "+"pageSize:"+pageSize;
|
|
|
|
|
- log.info(test);
|
|
|
|
|
- return test;
|
|
|
|
|
|
|
+ public Result list(@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "1") int pageSize){
|
|
|
|
|
+ var poi1 = new PoiVo();
|
|
|
|
|
+ poi1.name = "张三";
|
|
|
|
|
+ poi1.description = "123";
|
|
|
|
|
+
|
|
|
|
|
+ var poi2 = new PoiVo();
|
|
|
|
|
+ poi2.name = "李四";
|
|
|
|
|
+ poi2.description = "1234";
|
|
|
|
|
+ List<PoiVo> poiList = new ArrayList<>();
|
|
|
|
|
+ poiList.add(poi1);
|
|
|
|
|
+ poiList.add(poi2);
|
|
|
|
|
+ return Result.success(poiList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/detail/{id}")
|
|
@GetMapping("/detail/{id}")
|
|
|
- public String detail(@PathVariable int id){
|
|
|
|
|
- log.info(String.valueOf(id));
|
|
|
|
|
- return String.valueOf(id);
|
|
|
|
|
|
|
+ public Result detail(@PathVariable int id){
|
|
|
|
|
+ var poi1 = new PoiVo();
|
|
|
|
|
+ poi1.name = "张三";
|
|
|
|
|
+ poi1.description = "123";
|
|
|
|
|
+ List<PoiVo> poiList = new ArrayList<>();
|
|
|
|
|
+ poiList.add(poi1);
|
|
|
|
|
+ return Result.success(poiList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
|
- public String add(@RequestBody Poi info){
|
|
|
|
|
- log.info("name={} description={}",info.name,info.description);
|
|
|
|
|
- return "this is add";
|
|
|
|
|
|
|
+ public Result add(@RequestBody Poi info){
|
|
|
|
|
+ return Result.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PutMapping("/edit")
|
|
@PutMapping("/edit")
|
|
|
- public String edit(@RequestBody Poi info){
|
|
|
|
|
- log.info("name={} description={}",info.name,info.description);
|
|
|
|
|
- return "this is edit";
|
|
|
|
|
|
|
+ public Result edit(@RequestBody Poi info){
|
|
|
|
|
+ return Result.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping("/del/{id}")
|
|
@DeleteMapping("/del/{id}")
|
|
|
- public String del(){
|
|
|
|
|
- return "this is del";
|
|
|
|
|
|
|
+ public Result del(){
|
|
|
|
|
+ return Result.success();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|