YdysyxzController.java 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package com.siwei.apply.controller;
  2. import com.siwei.apply.domain.vo.YdysyxzUpdateVo;
  3. import com.siwei.apply.domain.vo.YdysyxzVo;
  4. import com.siwei.apply.service.YdysyxzService;
  5. import com.siwei.common.core.domain.R;
  6. import com.siwei.common.core.web.controller.BaseController;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.*;
  9. import java.util.HashMap;
  10. import java.util.Map;
  11. /**
  12. * 用地预审与选址 控制器
  13. */
  14. @RestController
  15. @RequestMapping("/ydysyxz")
  16. public class YdysyxzController extends BaseController {
  17. @Autowired
  18. private YdysyxzService ydysyxzService;
  19. /**
  20. * 添加用地预审与选址信息
  21. */
  22. @PostMapping()
  23. public R<Map> Add(@RequestBody YdysyxzVo ydysyxzVo) {
  24. try {
  25. String id = ydysyxzService.add(ydysyxzVo);
  26. Map<String, String> map = new HashMap<>();
  27. map.put("id", id);
  28. return R.ok(map);
  29. } catch (Exception e) {
  30. return R.fail(e.getMessage());
  31. }
  32. }
  33. /**
  34. * 获取用地预审与选址信息
  35. *
  36. * @param id 项目ID
  37. * @return 用地预审与选址信息
  38. */
  39. @GetMapping("/{id}")
  40. public R<Map> Get(@PathVariable String id) {
  41. try {
  42. Map<String, Object> map = new HashMap<>();
  43. map.put("ydysyxz", ydysyxzService.get(id));
  44. return R.ok(map);
  45. } catch (Exception e) {
  46. return R.fail(e.getMessage());
  47. }
  48. }
  49. /**
  50. * 更新用地预审与选址信息
  51. *
  52. * @param ydysyxzUpdateVo 用地预审与选址视图对象
  53. * @return 操作结果
  54. */
  55. @PutMapping()
  56. public R<Void> Update(@RequestBody YdysyxzUpdateVo ydysyxzUpdateVo) {
  57. try {
  58. ydysyxzService.update(ydysyxzUpdateVo);
  59. return R.ok();
  60. } catch (Exception e) {
  61. return R.fail(e.getMessage());
  62. }
  63. }
  64. }