UPDATE `zh_stage_pay` sp
  LEFT JOIN `zh_stage` s ON sp.sid = s.id
  LEFT JOIN `zh_pay` p ON sp.pid = p.id
  SET sp.`pre_used` = 1
  WHERE (sp.`start_stage_order` < s.`order` OR ((not IsNULL(sp.pre_tp)) AND sp.pre_tp) AND sp.`pre_used` = 0 AND p.`ptype` = 1;

ALTER TABLE `zh_stage_detail`
ADD COLUMN `pos_name`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '计量单元名称' AFTER `position`;