开启数据库语句批处理
url: jdbc:mysql://192.168.0.xxx:3306/xxx?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC&allowMultiQueries=true
重点:
allowMultiQueries=true
mysql 数据库开启批量执行sql_mysql 批量执行sql-CSDN博客
被调用的存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `myp2`(IN beautyName VARCHAR(20))
BEGINSELECT bo.*FROM boys boRIGHT JOIN beauty b ON bo.id = b.boyfriend_idWHERE b.name=beautyName;END
<select id="cunchu" resultType="java.util.Map">CALL myp2(#{item})</select>
2.带返回值的存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `myp6`(IN beautyName VARCHAR(20),OUT boyName VARCHAR(20))
BEGINSELECT bo.boyname INTO boynameFROM boys boRIGHT JOINbeauty b ON b.boyfriend_id = bo.idWHERE b.name=beautyName ;END
<select id="cunchu" resultType="java.util.Map">CALL myp6('小昭',@name);SELECT @name;</select>