修复BUG:SaveUsers存储过程没有更新,补充上一个提交

This commit is contained in:
Argo-Lenovo 2016-11-11 15:03:20 +08:00
parent 3e465ca0d8
commit 9ea25ec00e
1 changed files with 5 additions and 2 deletions

View File

@ -189,13 +189,16 @@ BEGIN
-- Insert statements for procedure here -- Insert statements for procedure here
if @userStatus = 2 if @userStatus = 2
begin begin
update Users set ApprovedTime = GETDATE() where ID = @id update Users set ApprovedTime = GETDATE(), ApprovedBy = @approvedBy where ID = @id
end end
else else
begin begin
declare @approveTime datetime = null declare @approveTime datetime = null
if @userStatus = 0 set @approveTime = GETDATE() if @userStatus = 0 set @approveTime = GETDATE()
Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approveTime, @approvedBy, @description) if(@id = 0)
Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approveTime, @description)
else
Update Users set UserName = @userName, Password = @password, PassSalt = @passSalt, DisplayName = @displayName where ID = @id
end end
END END
GO GO