IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_shopconfig]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_shopconfig]
GO
create procedure [dbo].[mps_save_shopconfig] 
@dp_id int,
@dp_code varchar(30),
@dp_innercode varchar(20),
@dp_depart nvarchar(100),
@dp_fullname nvarchar(200),
@dp_order int,
@dp_level int,
@dp_dpstdid int,
@dp_fdpid int,
@dp_ffdpid int,
@dp_foreign int,
@dp_display nvarchar(200),
@dp_hassub int,
@dp_salebudget int,
@dp_feebudget int,
@dp_phone varchar(30),
@dp_province nvarchar(50),
@dp_municipal nvarchar(50),
@dp_county nvarchar(50),
@dp_location nvarchar(100),
@dp_note nvarchar(500),
@dp_category1 nvarchar(50),
@dp_category2 nvarchar(50),
@dp_category3 nvarchar(50),
@dp_longitude int,
@dp_latitude int,
@dp_opentime nvarchar(100),
@dp_news nvarchar(200),
@dp_status nvarchar(50),
@dp_key varchar(100),
@dp_isdepart int,
@dp_managearea nvarchar(50),
@dp_manager1 nvarchar(50),
@dp_mcuid1 int,
@dp_manager2 nvarchar(50),
@dp_mcuid2 int,
@dp_manager3 nvarchar(50),
@dp_mcuid3 int,
@dp_manager4 nvarchar(50),
@dp_mcuid4 int,
@dp_manager5 nvarchar(50),
@dp_mcuid5 int,
@dp_manager6 nvarchar(50),
@dp_mcuid6 int,
@dp_manager7 nvarchar(50),
@dp_mcuid7 int,
@dp_manager8 nvarchar(50),
@dp_mcuid8 int,
@dp_manager9 nvarchar(50),
@dp_mcuid9 int,
@dp_manager10 nvarchar(50),
@dp_mcuid10 int,
@dp_use int,
@dp_mcuid int,
@dp_manager nvarchar(50)
as
begin
    update mps_depart set 
dp_code = case when @dp_code='_none_' then dp_code else @dp_code end,
dp_innercode = case when @dp_innercode='_none_' then dp_innercode else @dp_innercode end,
dp_depart = case when @dp_depart='_none_' then dp_depart else @dp_depart end,
dp_fullname = case when @dp_fullname='_none_' then dp_fullname else @dp_fullname end,
dp_order = case when @dp_order=-999999999 then dp_order else @dp_order end,
dp_level = case when @dp_level=-999999999 then dp_level else @dp_level end,
dp_dpstdid = case when @dp_dpstdid=-999999999 then dp_dpstdid else @dp_dpstdid end,
dp_fdpid = case when @dp_fdpid=-999999999 then dp_fdpid else @dp_fdpid end,
dp_ffdpid = case when @dp_ffdpid=-999999999 then dp_ffdpid else @dp_ffdpid end,
dp_foreign = case when @dp_foreign=-999999999 then dp_foreign else @dp_foreign end,
dp_display = case when @dp_display='_none_' then dp_display else @dp_display end,
dp_hassub = case when @dp_hassub=-999999999 then dp_hassub else @dp_hassub end,
dp_salebudget = case when @dp_salebudget=-999999999 then dp_salebudget else @dp_salebudget end,
dp_feebudget = case when @dp_feebudget=-999999999 then dp_feebudget else @dp_feebudget end,
dp_phone = case when @dp_phone='_none_' then dp_phone else @dp_phone end,
dp_province = case when @dp_province='_none_' then dp_province else @dp_province end,
dp_municipal = case when @dp_municipal='_none_' then dp_municipal else @dp_municipal end,
dp_county = case when @dp_county='_none_' then dp_county else @dp_county end,
dp_location = case when @dp_location='_none_' then dp_location else @dp_location end,
dp_note = case when @dp_note='_none_' then dp_note else @dp_note end,
dp_category1 = case when @dp_category1='_none_' then dp_category1 else @dp_category1 end,
dp_category2 = case when @dp_category2='_none_' then dp_category2 else @dp_category2 end,
dp_category3 = case when @dp_category3='_none_' then dp_category3 else @dp_category3 end,
dp_longitude = case when @dp_longitude=-999999999 then dp_longitude else @dp_longitude end,
dp_latitude = case when @dp_latitude=-999999999 then dp_latitude else @dp_latitude end,
dp_opentime = case when @dp_opentime='_none_' then dp_opentime else @dp_opentime end,
dp_news = case when @dp_news='_none_' then dp_news else @dp_news end,
dp_status = case when @dp_status='_none_' then dp_status else @dp_status end,
dp_key = case when @dp_key='_none_' then dp_key else @dp_key end,
dp_isdepart = case when @dp_isdepart=-999999999 then dp_isdepart else @dp_isdepart end,
dp_managearea = case when @dp_managearea='_none_' then dp_managearea else @dp_managearea end,
dp_manager1 = case when @dp_manager1='_none_' then dp_manager1 else @dp_manager1 end,
dp_mcuid1 = case when @dp_mcuid1=-999999999 then dp_mcuid1 else @dp_mcuid1 end,
dp_manager2 = case when @dp_manager2='_none_' then dp_manager2 else @dp_manager2 end,
dp_mcuid2 = case when @dp_mcuid2=-999999999 then dp_mcuid2 else @dp_mcuid2 end,
dp_manager3 = case when @dp_manager3='_none_' then dp_manager3 else @dp_manager3 end,
dp_mcuid3 = case when @dp_mcuid3=-999999999 then dp_mcuid3 else @dp_mcuid3 end,
dp_manager4 = case when @dp_manager4='_none_' then dp_manager4 else @dp_manager4 end,
dp_mcuid4 = case when @dp_mcuid4=-999999999 then dp_mcuid4 else @dp_mcuid4 end,
dp_manager5 = case when @dp_manager5='_none_' then dp_manager5 else @dp_manager5 end,
dp_mcuid5 = case when @dp_mcuid5=-999999999 then dp_mcuid5 else @dp_mcuid5 end,
dp_manager6 = case when @dp_manager6='_none_' then dp_manager6 else @dp_manager6 end,
dp_mcuid6 = case when @dp_mcuid6=-999999999 then dp_mcuid6 else @dp_mcuid6 end,
dp_manager7 = case when @dp_manager7='_none_' then dp_manager7 else @dp_manager7 end,
dp_mcuid7 = case when @dp_mcuid7=-999999999 then dp_mcuid7 else @dp_mcuid7 end,
dp_manager8 = case when @dp_manager8='_none_' then dp_manager8 else @dp_manager8 end,
dp_mcuid8 = case when @dp_mcuid8=-999999999 then dp_mcuid8 else @dp_mcuid8 end,
dp_manager9 = case when @dp_manager9='_none_' then dp_manager9 else @dp_manager9 end,
dp_mcuid9 = case when @dp_mcuid9=-999999999 then dp_mcuid9 else @dp_mcuid9 end,
dp_manager10 = case when @dp_manager10='_none_' then dp_manager10 else @dp_manager10 end,
dp_mcuid10 = case when @dp_mcuid10=-999999999 then dp_mcuid10 else @dp_mcuid10 end,
dp_use = case when @dp_use=-999999999 then dp_use else @dp_use end,
dp_mcuid = case when @dp_mcuid=-999999999 then dp_mcuid else @dp_mcuid end,
dp_manager = case when @dp_manager='_none_' then dp_manager else @dp_manager end
    where dp_id=@dp_id
end