CREATE DEFINER=`mysqladmin`@`%` FUNCTION `f_get_my_initiate_info`( ?? ?`i_proc_inst_id_` varchar ( 128 ), ?? ?`i_prodef_id_` varchar ( 64 ), ?? ?`i_type` varchar ( 64 ) ) RETURNS varchar(400) CHARSET utf8mb4 begin ?? ?declare o_activityid varchar ( 400 ); ?? ?declare?? ?o_activity_name varchar ( 400 ); ?? ?declare?? ?o_user_id varchar ( 400 ); ?? ?declare?? ?o_user_name varchar ( 400 ); ?? ?declare ?o_out_str varchar ( 400 ); ?? ?-- ?declare 每一个字段一次 ?? ??? ??? ??? ?select? ?? ??? ??? ??? ??? ?max(t.activity_name_) , ?? ??? ??? ??? ??? ?max(h.activityid_) , ?? ??? ??? ??? ??? ?max(h.assignee_) , ?? ??? ??? ??? ??? ?max(k.user_id_)? ?? ??? ??? ??? ?into ?? ?o_activity_name,o_activityid,o_user_id,o_user_name? ?? ??? ??? ??? ?-- select 和 into ?? ?? ??? ??? ? ?from act_ext_hi_activityinst t left join? ?? ??? ??? ? ?act_ext_ru_procinst_assignee h ?? ??? ??? ? ?on t.proc_inst_id_ = h.proc_inst_id and t.prodef_id_=h.prodef_id_ and t.activity_id_ = h.activityid_ ?? ??? ??? ? ?left join act_id_info k ?? ??? ??? ? ?on h.assignee_ = k.id_ ?? ??? ??? ? ?where t.seq_ in? ?? ??? ??? ? ?( ?? ??? ??? ? ??? ?select? ?? ??? ??? ??? ??? ? ?max(seq_) from act_ext_hi_activityinst t, act_id_info t2, act_id_membership t3, act_id_group t4 where t.assignee_ = t2.key_? ?? ??? ??? ??? ??? ? ?and t2.key_ = t3.key_? ?? ??? ??? ??? ??? ? ?and t3.group_id_ = t4.id_? ?? ??? ??? ??? ??? ? ?and t.proc_inst_id_ = i_proc_inst_id_ ?and t.prodef_id_ = i_prodef_id_ ?? ??? ??? ? ?); ?? ??? ??? ??? ? ?? ??? ??? ??? ? ?? ??? ?if i_type ='activityid' then ?set o_out_str = o_activityid ; -- if 条件 = ?? ??? ??? ?elseif(i_type ='activity_name') then ?set o_out_str = o_activity_name; -- elseif关键字 ?? ??? ??? ?elseif(i_type ='user_id')?? ?then ?set o_out_str = o_user_id; ?? ??? ??? ?elseif(i_type ='user_name')?? ?then ?set o_out_str = o_user_name;?? ? ?? ??? ?end if; ?? ??? ? ?? ?return o_out_str; ?? ? ?? ?end
|