日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql解题器_mysql触发器,答题记录表同步教学跟踪(用户列表)

發(fā)布時(shí)間:2023/12/18 数据库 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql解题器_mysql触发器,答题记录表同步教学跟踪(用户列表) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

DELIMITER ||

DROP TRIGGER IF EXISTS t_afterinsert_on_tab1 ||

CREATE TRIGGER t_afterinsert_on_tab1 AFTER INSERT

ON online_answerrecord FOREACH ROWBEGIN

--判斷數(shù)據(jù)庫中有無此記錄,有,修改,無,新增

SET @count =(SELECT

COUNT(1)FROMonline_papercompletion_userWHERE USERID =new.useridAND ORDERID =new.orderid) ;--設(shè)置考試類型--SET @examinationtype = new.examinationtype;--強(qiáng)化總題數(shù)量--SET @qianghuatype = 0;--章節(jié)總題數(shù)量--SET @zhangjietype = 0;--預(yù)測(cè)總題數(shù)量--SET @yucetype = 0;--章節(jié)完成數(shù)量

SET @zhangjiewancheng = 0;--強(qiáng)化完成數(shù)量

SET @qianghuawancheng = 0;--預(yù)測(cè)完成數(shù)量

SET @yucewancheng = 0;--是否正確--SET @iscorrect = 0;

--設(shè)置章節(jié)試題(正確數(shù))

SET @zhangjiezhengque = 0;--設(shè)置章節(jié)錯(cuò)誤(錯(cuò)誤數(shù))

SET @zhangjiecuowu = 0;--強(qiáng)化試題(正確數(shù))

SET @zhangjiezhengque = 0;--強(qiáng)化試題(錯(cuò)誤數(shù))

SET @qianghuacuowu = 0;--預(yù)測(cè)試題(正確數(shù))

SET @yucezhengque = 0;--預(yù)測(cè)試題(錯(cuò)誤數(shù))--set @yucecuowu = 0 ;

--如果答題正確 暫定0是正確--IF new.Iscorrect = '0' THEN

--(

IF new.examinationtype = '強(qiáng)化試卷'

AND new.Iscorrect = '0'

THEN SET @qianghuawancheng = '1';SET @qianghuazhengque = '1';

ELSEIF new.examinationtype= '章節(jié)試卷'

AND new.Iscorrect = '0'

THEN SET @zhangjiewancheng = '1';SET @zhangjiezhengque = '1';

ELSEIF new.examinationtype= '預(yù)測(cè)試卷'

AND new.Iscorrect = '0'

THEN SET @yucewancheng = '1';SET @yucezhengque = '1';

ELSEIF new.examinationtype= '強(qiáng)化試卷'

AND new.Iscorrect = '1'

THEN SET @qianghuawancheng = '1';SET @qianghuacuowu1 = '1';

ELSEIF new.examinationtype= '章節(jié)試卷'

AND new.Iscorrect = '1'

THEN SET @zhangjiewancheng = '1';SET @zhangjiecuowu = '1';

ELSEIF new.examinationtype= '預(yù)測(cè)試卷'

AND new.Iscorrect = '1'

THEN SET @yucewancheng = '1';SET @yucecuowu = '1';END IF;--)

--END if;

IF @count = 0

THEN

INSERT INTOonline_papercompletion_user (

id,

name1,

name2,

createtime,

userid,

personlname,

sysuserid,

sysusername,

registrationsituation,

curriculum_name,

examinationtype,

examinationdate,

examinationaddress,

phonenumber,

z_totalquestions,

z_totalcomplete,

q_totalquestions,

q_totalcomplete,

c_totalquestions,

c_totalcomplete,

bysituation,

score,

orderid,

z_totaltrue,

z_totalfalse,

q_totaltrue,

q_totalfalse,

c_totaltrue,

c_totalfalse

)VALUES(FLOOR(1 + (RAND() * 400000)),

new.name1,

new.name2,

NOW(),

new.USERID,'','','','','',

new.examinationtype,

NOW(),'','','',@zhangjiewancheng,'',@qianghuawancheng,'',@yucewancheng,'','',

new.orderid,@zhangjiezhengque,@zhangjiecuowu,@qianghuazhengque,@qianghuacuowu,@yucezhengque,@yucecuowu) ;

ELSEIF@count > 0

THEN --set @zwancheng = cast((SELECT z_totalcomplete FROM online_papercompletion_user WHERE userid=new.userid AND orderid=new.orderid) as bigint);

UPDATEonline_papercompletion_userSET

--personlname,--sysuserid,--sysusername,--registrationsituation,--curriculum_name,--examinationtype,--examinationdate,--examinationaddress,--phonenumber,--z_totalquestions,

z_totalcomplete =(SELECTc.azFROM(

(SELECT

CONVERT(z_totalcomplete, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@zhangjiewancheng ASSIGNED),--q_totalquestions,

q_totalcomplete =(SELECTz.azFROM(

(SELECT

CONVERT(q_totalcomplete, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) z)+ CAST(@qianghuawancheng ASSIGNED),--c_totalquestions,

c_totalcomplete =(SELECTc.azFROM(

(SELECT

CONVERT(c_totalcomplete, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@yucewancheng ASSIGNED),--bysituation,--score,

z_totaltrue =(SELECTc.azFROM(

(SELECT

CONVERT(z_totaltrue, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@yucewancheng ASSIGNED),

z_totalfalse=(SELECTc.azFROM(

(SELECT

CONVERT(z_totalfalse, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@yucewancheng ASSIGNED),

q_totaltrue=(SELECTc.azFROM(

(SELECT

CONVERT(q_totaltrue, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@yucewancheng ASSIGNED),

q_totalfalse=(SELECTc.azFROM(

(SELECT

CONVERT(q_totalfalse, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@yucewancheng ASSIGNED),

c_totaltrue=(SELECTc.azFROM(

(SELECT

CONVERT(c_totaltrue, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@yucewancheng ASSIGNED),

c_totalfalse=(SELECTc.azFROM(

(SELECT

CONVERT(c_totalfalse, SIGNED) azFROMonline_papercompletion_userWHERE userid =new.useridAND orderid =new.orderid)

) c)+ CAST(@yucewancheng ASSIGNED)WHERE userid =new.useridAND orderid =new.orderid ;END IF;END ||DELIMITER ;--測(cè)試數(shù)據(jù)

INSERT INTOzxks.online_answerrecord (

ANSWERRECORD_ID,

CREATETIME,

USERID,

ORDERID,

EXAMINATIONTYPE,

QUALIFICATIONS_ID,

CURRICULUM_ID,

ZID,

JID,

MID,

TID,

STRUCTUREPATH_NAME,

STRUCTUREPATH_CODE,

QUESTIONID,

ISCORRECT,

XUANXIANG,

PAGEID,

ISTAG,

FACILITYVALUE,

NAME1,

NAME2

)VALUES('2',

NOW(),'1','1','章節(jié)試卷','1','1','1','1','1','1','1','1','1','0','1','1',1,'1','1','1') ;

總結(jié)

以上是生活随笔為你收集整理的mysql解题器_mysql触发器,答题记录表同步教学跟踪(用户列表)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。