一、添加增加接口
@ApiResponses(value = {
@ApiResponse(code = 200, message = "接口返回成功状态"),
@ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
})
@ApiOperation(value = "新增数据", notes = "访问此接口,返回hello语句,测试接口")
@PostMapping(value = "/insertSelective")
public void insertSelective(@RequestBody UserInfo userInfo) {
userInfoService.insertSelective(userInfo);
}
二、修改接口
@ApiResponses(value = {
@ApiResponse(code = 200, message = "接口返回成功状态"),
@ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
})
@ApiOperation(value = "修改数据", notes = "访问此接口,返回hello语句,测试接口")
@PostMapping(value = "/updateByPrimaryKeySelective")
public void updateByPrimaryKeySelective(@RequestBody UserInfo userInfo) {
userInfoService.updateByPrimaryKeySelective(userInfo);
}
三、查询接口
@ApiResponses(value = {
@ApiResponse(code = 200, message = "接口返回成功状态"),
@ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
})
@ApiOperation(value = "按条件查询", notes = "访问此接口,返回hello语句,测试接口")
@PostMapping(value = "/selectByStudentSelective")
public List<UserInfo> selectByStudentSelective(@RequestBody UserInfo userInfo) throws ServletException, IOException { return userInfoService.selectByStudentSelective(userInfo);
}
四、删除数据
@ApiResponses(value = {
@ApiResponse(code = 200, message = "接口返回成功状态"),
@ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
})
@ApiOperation(value = "删除数据", notes = "访问此接口,返回hello语句,测试接口")
@PostMapping(value = "/removeUser")
public int removeUser(@RequestBody UserInfo userInfo) {
return userInfoService.removeUser(userInfo);
}
五、注意
其中,删除和修改的语法跟mysql和oracle略有不同,请注意
六、源码