Commit 5e3dcd6e authored by lisong's avatar lisong

添加脚本

parent 134edd82
......@@ -2860,4 +2860,31 @@
create unique index uni on wl_equipment_standard (`type`, `equipment_id`, `org_code`);
</sql>
</changeSet>
<changeSet author="ls" id="20220601-1">
<comment>`getChildListdate`</comment>
<sql endDelimiter="#">
DROP FUNCTION IF EXISTS `getChildListdate`#
CREATE DEFINER=`root`@`%` FUNCTION `getChildListdate`(`p_id` VARCHAR(1000)) RETURNS varchar(5000) CHARSET latin1
BEGIN
DECLARE sTemp TEXT;
DECLARE sTempChd VARCHAR(5000);
SET sTemp='';
SET sTempChd = CAST(p_id AS CHAR);
WHILE sTempChd IS NOT NULL DO
SET sTemp = CONCAT(sTemp,',',sTempChd);
SELECT GROUP_CONCAT(distinct a.instance_id) INTO sTempChd FROM
(select wl_form_instance.instance_id ,wl_form_instance.field_value from wl_form_instance where wl_form_instance.group_type in('building','room','floor') and field_name='parentId') a
WHERE FIND_IN_SET(a.field_value,sTempChd) > 0;
END WHILE;
RETURN SUBSTRING(sTemp,LENGTH(CONCAT(',',p_id))+1);
END
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment