|
@@ -2,9 +2,13 @@ package com.siwei.apply.controller;
|
|
|
|
|
|
import com.siwei.apply.domain.Jsydghxk;
|
|
|
import com.siwei.apply.service.JsydghxkService;
|
|
|
+import com.siwei.common.core.domain.R;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* 建设用地规划许可 控制器
|
|
|
*/
|
|
@@ -15,17 +19,34 @@ public class JsydghxkController {
|
|
|
private JsydghxkService jsydghxkService;
|
|
|
|
|
|
@PostMapping("/add")
|
|
|
- public String add(@RequestBody Jsydghxk jsydghxk) {
|
|
|
- return jsydghxkService.add(jsydghxk);
|
|
|
+ public R<Map> add(@RequestBody Jsydghxk jsydghxk) {
|
|
|
+ try {
|
|
|
+ String id = jsydghxkService.add(jsydghxk);
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("id", id);
|
|
|
+ return R.ok(map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@GetMapping("/get/{id}")
|
|
|
- public Jsydghxk get(@PathVariable String id) {
|
|
|
- return jsydghxkService.get(id);
|
|
|
+ public R<Jsydghxk> get(@PathVariable String id) {
|
|
|
+ try {
|
|
|
+ Jsydghxk jsydghxk = jsydghxkService.get(id);
|
|
|
+ return R.ok(jsydghxk);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@PostMapping("/update")
|
|
|
- public void update(@RequestBody Jsydghxk jsydghxk) {
|
|
|
- jsydghxkService.update(jsydghxk);
|
|
|
+ public R<Void> update(@RequestBody Jsydghxk jsydghxk) {
|
|
|
+ try {
|
|
|
+ jsydghxkService.update(jsydghxk);
|
|
|
+ return R.ok();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|