首页 > 其他分享 >后端接口实现

后端接口实现

时间:2024-04-09 22:35:25浏览次数:19  
标签:metroInfoService ok String 实现 接口 ResponseEntity sid return

所花时间:6小时

代码量:600

搏客量:1

package com.example.metroinfo.controller;

import com.example.metroinfo.model.MetroSystem;
import com.example.metroinfo.service.MetroInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/metro")
public class MetroSystemController {
    @Autowired
    MetroInfoService metroInfoService;
    @PostMapping
    ResponseEntity<?> addMetroSystem(@RequestBody MetroSystem metroSystem)  {
        return ResponseEntity.ok(metroInfoService.addMetroSystem(metroSystem));
    }
    @GetMapping("/{sid}")
    ResponseEntity<?> getMetroSystem(@PathVariable String sid) {
        return ResponseEntity.ok(metroInfoService.getMetroSystem(sid));
    }
    @GetMapping("/{sid}/search/route")
    ResponseEntity<?> searchShortestPath(@PathVariable String sid, @RequestParam String from,@RequestParam String to) {
        return ResponseEntity.ok(metroInfoService.searchShortestPath(sid,from,to));
    }
    @GetMapping("/{sid}/search/line")
    ResponseEntity<?> searchByLine(@PathVariable String sid,@RequestParam String lNum) {
        return ResponseEntity.ok(metroInfoService.searchByLine(sid,lNum));
    }
    @GetMapping("/find/system")
    ResponseEntity<?> findMetroSystemByName() {
        return ResponseEntity.ok(metroInfoService.findAllMetroSystem());
    }
    @GetMapping("/{sid}/find/station")
    ResponseEntity<?> findMetroStation(@PathVariable String sid, @RequestParam String stName) {
        return ResponseEntity.ok(metroInfoService.findStationByStationNameContaining(sid,stName));
    }
}

标签:metroInfoService,ok,String,实现,接口,ResponseEntity,sid,return
From: https://www.cnblogs.com/muzhaodi/p/18125020

相关文章

  • consul:啥?我被优化没了?AgileConfig+Yarp替代Ocelot+Consul实现服务发现和自动网关配置
    现在软件就业环境不景气,各行各业都忙着裁员优化。作为一个小开发,咱也不能光等着别人来优化咱,也得想办法优化下自己。就拿手头上的工作来说吧,我发现我的微服务应用里,既有AgileConfig这个日志组件,又有一个Consul服务发现组件。本来吧他俩也没啥事,各干个的。但是,我在操作AgileConfig......
  • Java基于微信小程序的校园外卖平台设计与实现,附源码
    博主介绍:✌程序员徐师兄、7年大厂程序员经历。全网粉丝12w+、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌......
  • leetcode热题HOT 208. 实现 Trie (前缀树)
    一、问题描述:Trie(发音类似“try”)或者说前缀树是一种树形数据结构,用于高效地存储和检索字符串数据集中的键。这一数据结构有相当多的应用情景,例如自动补完和拼写检查。请你实现Trie类:Trie()初始化前缀树对象。voidinsert(Stringword)向前缀树中插入字符串wor......
  • 抽象和接口
    usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceis和as{classProgram{staticvoidMain(string[]args){//is是来判断值是否是指定类型的,返回的是布尔值doublei......
  • 基于JAVA Springboot + Vue 前端后分离 实现【考研资讯平台】(内附设计LW + PPT+ 源码
    项目名称项目名称:考研资讯平台项目技术栈该项目采用了以下核心技术栈:后端框架/库:SpringBoot数据库:MySQL前端技术:Vue.js(前后端分离)项目展示5.1学生前台功能模块5.1.2首页在系统首页可以查看以下内容:首页考研资讯报考指南资料信息论坛信息我的跳转到后台购物......
  • 基于JAVA Springboot + Vue 前端后分离 实现【教师人事档案管理系统】(内附设计LW + PP
    项目名称项目名称:教师人事档案管理系统项目技术栈该项目采用了以下核心技术栈:后端框架/库:Java数据库:MySQL前端技术:Vue.js(前后端分离)开发工具:Eclipse项目展示5.1前台功能模块前台首页在教师人事档案管理系统首页可以查看以下内容:首页培训信息系统公告个人中心......
  • 【CRC校验方法】+【FPGA实现(发送端)】
    书接上回:https://www.cnblogs.com/VerweileDoch/p/18105959发送端的逻辑和接收端类似,但是需要进行八位内的逆运算和取反:always@(posedgesys_clk)beginif(sys_rst_n==1'b0)beginr1_crc_value<=32'h0;endelseif(crc_cycle==1'b1......
  • 机器学习常见的sampling策略 附PyTorch实现
    简单的采样策略首先介绍三种简单采样策略:Instance-balancedsampling,实例平衡采样。Class-balancedsampling,类平衡采样。Square-rootsampling,平方根采样。它们可抽象为:\[p_j=\frac{n_j^q}{\sum_{i=1}^Cn_i^q},\]\(p_j\)表示从j类采样数据的概率;\(C\)表示类别数量......
  • springboot3使用自定义注解+AOP+redis优雅实现防重复提交
     ⛰️个人主页:   蒾酒......
  • 突破编程_C++_网络编程(Windows 套接字(API 接口(2)))
    1TCP连接管理1.1connect函数connect函数用于发起一个TCP连接请求到远程服务器。这个函数通常用于客户端套接字,以建立与服务器的连接。(1)函数原型intconnect(SOCKETs,conststructsockaddr*name,intnamelen);(2)参数说明s:一个已创建但未连接的套接字描述符......