package com.liu.susu.message.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liu.susu.message.mapper.ProcMapper;
import com.liu.susu.message.vo.StuVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* description
* @author susu
**/
@Slf4j
@RestController
@RequestMapping("/proc/")
@Api(tags = "存储过程")
@ApiSupport(author = "披荆斩棘",order = 3)
public class ProcController {
@Autowired
private ProcMapper procMapper;
//////////////////////////////////1.无参//////////////////////////////
@ApiOperationSupport(order = 1)
@ApiOperation("1->无参测试(spInsertStuTest)")
@GetMapping("/spInsertStuTest")
public String spInsertStuTest(){
procMapper.spInsertStuTest();
return "ok";
}
@ApiOperationSupport(order = 2)
@ApiOperation("2->无参测试XML(spInsertStuTest)")
@GetMapping("/spInsertStuTest_xml")
public String spInsertStuTest_xml(){
procMapper.spInsertStuTest_xml();
log.info("测试xml无参ok");
return "测试xml无参ok";
}
//////////////////////////////////2.入参//////////////////////////////
@ApiOperationSupport(order = 3)
@ApiOperation("3->入参测试(spInsertStuByName)")
@GetMapping("/spInsertStuByName")
public String spInsertStuByName(@RequestParam("stuId") String stuId,
@RequestParam("stuName") String stuName){
procMapper.spInsertStuByName_1(stuId,stuName);
log.info("3->入参测试ok");
return "3->入参测试";
}
@ApiOperationSupport(order = 3)
@ApiOperation("3->入参测试spInsertStuByName_3(spInsertStuByName)")
@PostMapping("/spInsertStuByName_3")
public String spInsertStuByName_3(@RequestBody StuVo data){
procMapper.spInsertStuByName_3(data);
log.info("3->入参测试spInsertStuByName_3->ok");
return "3->入参测试spInsertStuByName_3->ok";
}
@ApiOperationSupport(order = 4)
@ApiOperation("4->入参测试xml(spInsertStuByName)")
@GetMapping("/spInsertStuByName_xml")
public String spInsertStuByName_xml(@RequestParam("stuId") String stuId,
@RequestParam("stuName") String stuName){
procMapper.spInsertStuByName_xml(stuId,stuName);
log.info("4->入参测试xml->ok");
return "4->入参测试xml->ok";
}
//////////////////////////////////3.出参//////////////////////////////
@ApiOperationSupport(order = 5)
@ApiOperation("5->出参测试xml(spInsertStuOut_xml)")
@GetMapping("/spInsertStuOut_xml")
public String spInsertStuOut_xml(){
Map map = new HashMap<>();
procMapper.spInsertStuOut_xml(map);
log.info("5->出参测试xml->ok,返回结果map为->{}",map);
return "5->出参测试xml->ok";
}
@ApiOperationSupport(order = 6)
@ApiOperation("6->出参测试(注解)(spInsertStuOut)")
@GetMapping("/spInsertStuOut")
public String spInsertStuOut(){
Map map = new HashMap<>();
procMapper.spInsertStuOut(map);
log.info("6->出参测试(注解)->ok,返回结果map为->{}",map);
return "6->出参测试(注解)->ok";
}
/////////////////////////////////4.入参和出参的/////////////////////////////////////////////
@ApiOperationSupport(order = 7)
@ApiOperation("7->入参和出参测试xml(spInsertStuInAndOut_xml)")
@GetMapping("/spInsertStuInAndOut_xml")
public String spInsertStuInAndOut_xml(){
Map map = new HashMap<>();
map.put("stuId","C-10001");
map.put("stuName","测试in-out");
procMapper.spInsertStuInAndOut_xml(map);
log.info("7->入参和出参测试xml->ok,返回结果map为->{}",map);
return "7->入参和出参测试xml->ok";
}
@ApiOperationSupport(order = 8)
@ApiOperation("8->入参和出参测试xml(spInsertStuInAndOut_2_xml)")
@GetMapping("/spInsertStuInAndOut_2_xml")
public String spInsertStuInAndOut_2_xml(@RequestParam("stuId") String stuId,
@RequestParam("stuName") String stuName){
Map map = new HashMap<>();
procMapper.spInsertStuInAndOut_2_xml(stuId,stuName,map);
log.info("8->spInsertStuInAndOut_2_xml->ok,返回结果map为->{}",map);
return "8->spInsertStuInAndOut_2_xml->ok";
}
@ApiOperationSupport(order = 9)
@ApiOperation("9->入参和出参测试(spInsertStuInAndOut)")
@PostMapping("/spInsertStuInAndOut")
public String spInsertStuInAndOut(@RequestBody StuVo data){
procMapper.spInsertStuInAndOut(data);
log.info("9->入参和出参测试->ok,返回结果data为->{}",data);
return "9->入参和出参测试->ok";
}
@ApiOperationSupport(order = 10)
@ApiOperation("10->入参和出参测试(spInsertStuInAndOut_2)")
@PostMapping("/spInsertStuInAndOut_2")
public String spInsertStuInAndOut_2(@RequestBody StuVo data){
Map<String, StuVo> stuVoMap = new HashMap<>();
Map mapResult = new HashMap<>();
// procMapper.spInsertStuInAndOut_2(data,mapResult);//不能映射出参结果
procMapper.spInsertStuInAndOut_3(data,mapResult);//可以映射出参结果
System.out.println(data);
log.info("10->入参和出参测试->ok,返回结果mapResult为->{}",mapResult);
return "10->入参和出参测试->ok";
}
/////////////////////////////////5.结果集的/////////////////////////////////////////////
@ApiOperationSupport(order = 11)
@ApiOperation("11->入参和出参测试(getStuTestList_xml)")
@GetMapping("/getStuTestList_xml")
public String getStuTestList_xml(){
Map<String, StuVo> stuVoMap = new HashMap<>();
Map map = new HashMap<>();
procMapper.getStuTestList_xml(map);
log.info("11->结果集测试->ok,返回结果mapResult为->{}",map);
return "11->结果集测试->ok";
}
}
mybatis调用Oracle存储过程(无参、有入出参)等各种情况例子的详细使用方法
版权申诉
5星 · 超过95%的资源 107 浏览量
2022-11-13
17:46:22
上传
评论 1
收藏 10KB ZIP 举报
@素素~
- 粉丝: 1w+
- 资源: 89
最新资源
- 3122080306 邹子轩 实验报告二.docx
- 基于STM32 NUCLEO板设计彩色LED照明灯(纯cubeMX开发)(大赛作品,文档完整,可直接运行)
- 发那科工业机器人保养大全
- Sphere.h
- REMD固有时间尺度分解信号分量可视化(Matlab完整源码和数据)
- 嵌入式系统双单片机STC89C52+STC15W104多功能学习板电路图可扩展 适用于单片机初学者和教学
- 基于STM32蓝牙控制小车系统设计(硬件+源代码+论文)大赛作品
- XILINXFPGA源码基于Spartan3火龙刀系列FPGA开发板VGA测试例程
- Java聊天室的设计与实现【尚学堂·百战程序员】
- python中matplotlib教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈