123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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());
- }
- }
- }
|