|
@@ -0,0 +1,76 @@
|
|
|
+package com.siwei.apply.controller;
|
|
|
+
|
|
|
+import com.siwei.apply.domain.LandOneCode;
|
|
|
+import com.siwei.apply.service.LandOneCodeService;
|
|
|
+import com.siwei.common.core.domain.R;
|
|
|
+import com.siwei.common.core.web.controller.BaseController;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 土地统一编码 控制器
|
|
|
+ * 提供基础的增删改查接口
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/landOneCode")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class LandOneCodeController extends BaseController {
|
|
|
+
|
|
|
+ private final LandOneCodeService service;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ */
|
|
|
+ @PostMapping()
|
|
|
+ public R<Map<String, String>> add(@RequestBody LandOneCode body) {
|
|
|
+ try {
|
|
|
+ String id = service.add(body);
|
|
|
+ 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<LandOneCode> getById(@PathVariable String id) {
|
|
|
+ try {
|
|
|
+ return R.ok(service.getById(id));
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新(按ID)
|
|
|
+ */
|
|
|
+ @PutMapping()
|
|
|
+ public R<Void> update(@RequestBody LandOneCode body) {
|
|
|
+ try {
|
|
|
+ service.update(body);
|
|
|
+ return R.ok();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除(按ID)
|
|
|
+ */
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
+ public R<Void> delete(@PathVariable String id) {
|
|
|
+ try {
|
|
|
+ service.deleteById(id);
|
|
|
+ return R.ok();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return R.fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|