|
@@ -2,16 +2,19 @@ package com.siwei.apply.controller;
|
|
|
|
|
|
import com.siwei.apply.domain.Gyjsydscdj;
|
|
|
import com.siwei.apply.service.GyjsydscdjService;
|
|
|
+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;
|
|
|
+
|
|
|
/**
|
|
|
* 国有建设用地使用权首次登记 控制器
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/gyjsydscdj")
|
|
|
public class GyjsydscdjController {
|
|
|
-
|
|
|
@Autowired
|
|
|
private GyjsydscdjService gyjsydscdjService;
|
|
|
|
|
@@ -21,8 +24,15 @@ public class GyjsydscdjController {
|
|
|
* @param gyjsydscdj
|
|
|
*/
|
|
|
@PostMapping()
|
|
|
- public void add(@RequestBody Gyjsydscdj gyjsydscdj) {
|
|
|
- gyjsydscdjService.add(gyjsydscdj);
|
|
|
+ public R<Map> add(@RequestBody Gyjsydscdj gyjsydscdj) {
|
|
|
+ try {
|
|
|
+ String id = gyjsydscdjService.add(gyjsydscdj);
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("id", id);
|
|
|
+ return R.ok(map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -32,8 +42,13 @@ public class GyjsydscdjController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping()
|
|
|
- public Gyjsydscdj get(@PathVariable String id) {
|
|
|
- return gyjsydscdjService.get(id);
|
|
|
+ public R<Gyjsydscdj> get(@PathVariable String id) {
|
|
|
+ try {
|
|
|
+ Gyjsydscdj gyjsydscdj = gyjsydscdjService.get(id);
|
|
|
+ return R.ok(gyjsydscdj);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -42,7 +57,12 @@ public class GyjsydscdjController {
|
|
|
* @param gyjsydscdj
|
|
|
*/
|
|
|
@PutMapping()
|
|
|
- public void update(@RequestBody Gyjsydscdj gyjsydscdj) {
|
|
|
- gyjsydscdjService.update(gyjsydscdj);
|
|
|
+ public R<Void> update(@RequestBody Gyjsydscdj gyjsydscdj) {
|
|
|
+ try {
|
|
|
+ gyjsydscdjService.update(gyjsydscdj);
|
|
|
+ return R.ok();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|