insert into business_wechat_menu(
pagepath,operate,app_id,menu_level,menu_name,menu_type,menu_value,b_id,community_id,wechat_menu_id
) values (
#{pagepath},#{operate},#{appId},#{menuLevel},#{menuName},#{menuType},#{menuValue},#{bId},#{communityId},#{wechatMenuId}
)
insert into wechat_menu(
pagepath,app_id,menu_level,menu_name,menu_type,menu_value,status_cd,b_id,community_id,wechat_menu_id
) select t.pagepath,t.app_id,t.menu_level,t.menu_name,t.menu_type,t.menu_value,'0',t.b_id,t.community_id,t.wechat_menu_id from business_wechat_menu t where 1=1
and t.pagepath= #{pagepath}
and t.operate= 'ADD'
and t.app_id= #{appId}
and t.menu_level= #{menuLevel}
and t.menu_name= #{menuName}
and t.menu_type= #{menuType}
and t.menu_value= #{menuValue}
and t.b_id= #{bId}
and t.community_id= #{communityId}
and t.wechat_menu_id= #{wechatMenuId}
update wechat_menu t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.pagepath= #{pagepath}
, t.app_id= #{appId}
, t.menu_level= #{menuLevel}
, t.menu_name= #{menuName}
, t.menu_type= #{menuType}
, t.menu_value= #{menuValue}
, t.community_id= #{communityId}
where 1=1
and t.b_id= #{bId}
and t.wechat_menu_id= #{wechatMenuId}