|
drop procedure if exists sp_ylc;
create procedure sp_ylc()
begin
DECLARE @userid INT;
DECLARE @opsid INT;
DECLARE @cunm INT;
DECLARE @moduleid INT;
DECLARE @mduname VARCHAR(200);
DECLARE @i INT;
DECLARE @content VARCHAR(500);
DECLARE @time datetime ;
DECLARE @objectID INT ;
DECLARE @copt INT;
DECLARE @copt INT;
DECLARE @objlist VARCHAR(500);
DECLARE @operarry1 VARCHAR(500);
DECLARE @operarry2 VARCHAR(500);
DECLARE @content0 VARCHAR(500);
DECLARE @contentp VARCHAR(500);
DECLARE @ctime datetime ;
DECLARE @ipd INT;
DECLARE @ptimes datetime;
DECLARE @stimo datetime;
DECLARE @ent VARCHAR(500);
DECLARE @iupoi INT;
DECLARE @ipok INT;
Select @userid = I_userID,@opsid=I_operationID,@cunm=count(*) from space_operation_record where status<>0 group by I_userID,I_operationID;
while @cunm > 0 do
select @cunm = @cunm -1;
Select @moduleid=I_moduleID from space_operation where status<>0 and [email=ID=@opid]ID=@opid[/email];
if @moduleid > 0 then
Select @mduname=Nvc_name from space_module where status<>0 and [email=ID=@moduleid]ID=@moduleid[/email];
if @mduname > 0 then
select @i=0;
Select @content=Nvc_content,@id=ID,@time=createtime,@objectID=I_objectID,@copt=count(*) from space_operation_record where status<>0 and I_operationID=opid and I_userID=userid;
if copt > 0 then
if @mduname = '日志' then
while @copt > 0 do
select @copt = @copt -1;
INSERT INTO space_operation_stat(I_operationID,I_userID,Nvc_content,D_stattime,Createtime) VALUES ([email=]'@id','@userid','@content','@time',now[/email]());
end while;
else
while @Copt > 0 do
if @i > 5 then
break;
end if;
select @objlist = CONCAT(@objectID,CONCAT(@objectID,','));
select @operarry1 = substring_index(@content,'|',1);
select @operarry2 = substring_index(@content,'|',-1);
select @content0 =CONCAT(@operarry2,SPACE(1));
select @copt = @copt -1;
select @i = @i + 1;
end while;
select @objlist = substring(@objlist,'-1');
if @content0 is null then
select @contentp = CONCAT(@operarry1,@content0);
Select @ctime=createtime,@ipd=ID from space_operation_record where status<>0 and [email=I_operationID=@opid]I_operationID=@opid[/email] order by createtime desc limit 0,1;
if @ipd > 0 then
INSERT INTO space_operation_stat(I_operationID,I_userID,Nvc_content,D_stattime,Createtime,Nvc_objlist) VALUES([email=]'@ipd','@userid','@contentp','@ctime',now(),'@objlist'[/email]);
end if;
end if;
end if;
end if;
end if;
end if;
end while;
UPDATE space_operation_play SET status=0;
UPDATE space_operation_display SET status=0;
Select @ptimes=createtime from space_operation_stat where status<>0 order by createtime desc limit 0,1;
if @ptimes > 0 then
Select @stimo=D_stattime,@ent=Nvc_content,@iupoi=I_userID,@ipok=ID from space_operation_stat where status<>0 and [email=createtime=]createtime='@ptimes'[/email] order by D_stattime desc limit 0,30;
if @stimo > 0 then
INSERT INTO space_operation_play(I_statID,Nvc_content,D_stattime,I_userID,Createtime) VALUES ([email=]'@ipok','@ent','@stimo',now[/email]());
end if;
end if;
end |
|