定义好部门与操作员

可以对以下参数进行传值

declare @bm varchar(10)

declare @username varchar(10)

select @bm=c.bm  from hr_bmzhygw a (nolock) join zhiydoc b(nolock) on a.dzyid=b.dzyid

join bmdoc c(nolock) on a.bmid=c.bmid where  b.dzyname =:p_caozy

set @username=:p_caozy

if (@bm in ('销售部')) and @username<>'系统管理员'

begin

select getdate()

end

else 

begin

select gedate()-1

end