zoukankan      html  css  js  c++  java
  • Springboot+Mybatis+Clickhouse+jsp 搭建单体应用项目(三)(添加增删改查)

    一、添加增加接口

    1  @ApiResponses(value = {
    2             @ApiResponse(code = 200, message = "接口返回成功状态"),
    3             @ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
    4     })
    5     @ApiOperation(value = "新增数据", notes = "访问此接口,返回hello语句,测试接口")
    6     @PostMapping(value = "/insertSelective")
    7     public void insertSelective(@RequestBody UserInfo userInfo) {
    8         userInfoService.insertSelective(userInfo);
    9     }
    View Code

    二、修改接口

    1     @ApiResponses(value = {
    2             @ApiResponse(code = 200, message = "接口返回成功状态"),
    3             @ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
    4     })
    5     @ApiOperation(value = "修改数据", notes = "访问此接口,返回hello语句,测试接口")
    6     @PostMapping(value = "/updateByPrimaryKeySelective")
    7     public void updateByPrimaryKeySelective(@RequestBody UserInfo userInfo) {
    8         userInfoService.updateByPrimaryKeySelective(userInfo);
    9     }
    View Code

    三、查询接口

     1  @ApiResponses(value = {
     2             @ApiResponse(code = 200, message = "接口返回成功状态"),
     3             @ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
     4     })
     5     @ApiOperation(value = "按条件查询", notes = "访问此接口,返回hello语句,测试接口")
     6     @PostMapping(value = "/selectByStudentSelective")
     7     public List<UserInfo> selectByStudentSelective(@RequestBody UserInfo userInfo) throws ServletException, IOException {
     8 
     9         return userInfoService.selectByStudentSelective(userInfo);
    10     }
    View Code

    四、删除数据

    1  @ApiResponses(value = {
    2             @ApiResponse(code = 200, message = "接口返回成功状态"),
    3             @ApiResponse(code = 500, message = "接口返回未知错误,请联系开发人员调试")
    4     })
    5     @ApiOperation(value = "删除数据", notes = "访问此接口,返回hello语句,测试接口")
    6     @PostMapping(value = "/removeUser")
    7     public int removeUser(@RequestBody UserInfo userInfo) {
    8         return userInfoService.removeUser(userInfo);
    9     }
    View Code

    五、注意

    其中,删除和修改的语法跟mysql和oracle略有不同,请注意

    六、源码

    https://gitee.com/liuyangfirst/springboot-clickhouse.git

  • 相关阅读:
    C++ 编译时字符串加密
    c#自动修复缺损和不规范的html
    C#下载网络资源(网页或文件)
    yum install 命令下载安装离线包
    C# Sql Server 数据库 传递 表值参数
    cximage 裁剪图片并背景透明
    centos 7.5 编译并运行 opencv 4.5.1 c++
    c++ freeimage 指定颜色透明
    c++ string 大小写转换
    opencv 裁剪图像
  • 原文地址:https://www.cnblogs.com/liuyangfirst/p/13435598.html
Copyright © 2011-2022 走看看