mapper接口
public interface UserInfoMapper extends BaseMapper {
void countByType(String checkNo);
}
sql xml
注意这里的存储过程是有入参,无返回值的
xml version="1.0" encoding="UTF-8"?> DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xxx.mapper.UserInfoMapper"> <update id="countByType" parameterType="string" statementType="CALLABLE"> {call countByType(#{checkNo, mode=IN})} update> mapper>
存储过程创建语句
CREATE DEFINER=xxxxx
@
PROCEDURE countByType
(in in_batch_number varchar(32))
BEGIN
-- 定义变量
DECLARE var_batch_number VARCHAR(18);
-- 批次号如果有传入则使用传入的,没有则使用生成的
IF in_batch_number is null
THEN
SET var_batch_number = date_format(DATE_SUB(now(), INTERVAL 1 DAY), '%Y%m%d');
ELSE
SET var_batch_number = in_batch_number;
END IF;
-- 调用其它存储过程存储过程
call countByDate(var_batch_number);
END
Original: https://www.cnblogs.com/shamo89/p/16498720.html
Author: 夏威夷8080
Title: MyBatis Plus 里调用存储过程
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/543347/
转载文章受原作者版权保护。转载请注明原作者出处!