![image.png](https://img-blog.csdnimg.cn/img_convert/8b81576eaaa94715f9913550f040d985.png)
1.1、代码编写
Demo类
import com.course.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Log4j
@RestController
@Api(value = "v1",tags = "这是我的第一个版本的demo")
@RequestMapping("v1")
public class Demo {
@Autowired
private SqlSessionTemplate template;
@RequestMapping(value = "/getUserCount",method = RequestMethod.GET)
@ApiOperation(value = "可以获取到用户数",httpMethod = "GET")
public int getUserCount(){
return template.selectOne("getUserCount");
}
@RequestMapping(value = "/addUser",method = RequestMethod.POST)
public int addUser(@RequestBody User user){
int result = template.insert("addUser",user);
return result;
}
@RequestMapping(value = "/updateUser",method = RequestMethod.POST)
public int updateUser(@RequestBody User