一 . 数据库中创建存储过程,并查看创建结果

1.创建存储过程

DROP procedure IF EXISTS net_procedure_request;
DELIMITER $$
CREATE procedure net_procedure_request(in select_type varchar(99))
BEGIN
IF select_type='' THEN
select client_ip,request_size_all,from_unixtime(start_time,'%Y年%m月%d日-%H时:%i分:%S秒') as startTime from net_table_request;
ELSEIF select_type='' THEN
select client_ip,request_size_all,from_unixtime(start_time,'%Y年%m月%d日-%H时:%i分') as startTime from net_table_request;
ELSEIF select_type='' THEN
select client_ip,request_size_all,from_unixtime(start_time,'%Y年%m月%d日-%H时') as startTime from net_table_request;
END IF;
END$$
DELIMITER ;

2.查看创建存储过程结果

show procedure status;

3.导出创建存储过程的语句

show create procedure net_procedure_request;

4.数据库调用存储过程

set @select_type='';
call net_procedure_request(@select_type);

二 . MyBatis中调用存储过程

<select id="getInfo" statementType="CALLABLE" resultMap="infoResultMap" parameterType="java.util.HashMap">
{call net_procedure_request(#{select_type,mode=IN,jdbcType=VARCHAR},#{client_ip,mode=IN,jdbcType=VARCHAR})}
</select>

注意:select标签中一定要加《statementType=“CALLABLE”》。

最新文章

  1. LinkedHashMap及其源码分析
  2. python--文件删除、判断目录存在、字符串替换
  3. Mysql5.7版本编译安装及配置
  4. PHP基础16:多维数组
  5. 编译busybox-1.24.1 制作文件系统
  6. 利用Nginx+Mono+Fastcgi代替IIS对Asp.Net进行反向代理
  7. Flex 列表控件中的操作
  8. css 所有选择器
  9. 在虚拟机的linux中利用VMware Tools实现与windows共享文件
  10. CSAPP:Binary Bomb
  11. poj2484--A Funny♂Game
  12. Libev学习笔记4
  13. 青云B轮获2000万美元VC的背后逻辑:用技术超越巨头
  14. Android5.1源码Xposed框架编译
  15. python爬虫实战 获取豆瓣排名前250的电影信息--基于正则表达式
  16. LeetCode 单链表专题 (一)
  17. fatal error LNK1120: 11 unresolved externals
  18. 事件Event实现消费者模型
  19. Monent.js:强大的日期处理类库
  20. 6.翻译:EF基础系列---什么是EF中的实体?

热门文章

  1. jeecg的开发api接口之旅(http)
  2. 装新的python3.7时ModuleNotFoundError: No module named &#39;_ctypes&#39;
  3. binlog2sql安装
  4. 最新my.cnf可用于5.6&amp;5.7
  5. pip---cannot import name main解决方案
  6. 关于bat文件的批处理
  7. 2019-ACM-CCPC-Online-Contest
  8. wireshark 抓包再利用TCP socket发送包里的payload是可以实现登陆的
  9. LGOJP2831 愤怒的小鸟
  10. mysql 杂记 —— 时区问题