## 气瓶模块 ### 存储过程 ~~~ CREATE DEFINER=`root`@`%` FUNCTION `getParList`(rootId BIGINT) RETURNS bigint(20) BEGIN DECLARE sTemp BIGINT; DECLARE sTempPar BIGINT; DECLARE sTempId BIGINT; SET sTemp = NULL; SET sTempPar =rootId; SET sTempId =rootId; #循环递归 WHILE sTempPar<>-1 DO SET sTempId =sTempPar; SELECT parent_id INTO sTempPar FROM qp_air_goods_config where id=sTempPar; END WHILE; SELECT config_id INTO sTemp FROM qp_air_goods_config where id=sTempId; RETURN sTemp; END ~~~ --- > 注意:如果创建存储过程失败且提示中包含 log_bin_trust_function_creators 字样的文本,请执行下方sql修改mysql设置 ~~~ show variables like 'log_bin_trust_function_creators'; set global log_bin_trust_function_creators=1 ~~~