|
@@ -0,0 +1,61 @@
|
|
|
+package com.siwei.apply.controller;
|
|
|
+
|
|
|
+import com.siwei.apply.domain.Tdgy;
|
|
|
+import com.siwei.apply.service.TdgyService;
|
|
|
+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("/tdgy")
|
|
|
+public class TdgyController {
|
|
|
+ @Autowired
|
|
|
+ private TdgyService tdgyService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加供地信息
|
|
|
+ */
|
|
|
+ @PostMapping()
|
|
|
+ public R<Map> add(@RequestBody Tdgy tdgy) {
|
|
|
+ try {
|
|
|
+ String id = tdgyService.add(tdgy);
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("id", id);
|
|
|
+ return R.ok(map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据 ID 获取供地信息
|
|
|
+ */
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public R<Tdgy> get(@PathVariable("id") String id) {
|
|
|
+ try {
|
|
|
+ Tdgy tdgy = tdgyService.get(id);
|
|
|
+ return R.ok(tdgy);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新供地信息(按非空字段更新)
|
|
|
+ */
|
|
|
+ @PutMapping("")
|
|
|
+ public R<Void> update(@RequestBody Tdgy tdgy) {
|
|
|
+ try {
|
|
|
+ tdgyService.update(tdgy);
|
|
|
+ return R.ok();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|