From b92e0ba137e3a9a73fa8d6d1431098853d22db3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A6=B9=E4=BD=B3?= <13981807+liu-yujia2024@user.noreply.gitee.com> Date: Thu, 19 Jun 2025 07:14:46 +0000 Subject: [PATCH] =?UTF-8?q?add=20=E8=BF=87=E8=A7=A6=E5=8F=91=E5=99=A8?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=87=AA=E5=8A=A8=E5=BC=80=E5=8D=A1=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘禹佳 <13981807+liu-yujia2024@user.noreply.gitee.com> --- ...4\200\345\215\241\344\270\232\345\212\241" | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 "\350\277\207\350\247\246\345\217\221\345\231\250\345\256\236\347\216\260\350\207\252\345\212\250\345\274\200\345\215\241\344\270\232\345\212\241" diff --git "a/\350\277\207\350\247\246\345\217\221\345\231\250\345\256\236\347\216\260\350\207\252\345\212\250\345\274\200\345\215\241\344\270\232\345\212\241" "b/\350\277\207\350\247\246\345\217\221\345\231\250\345\256\236\347\216\260\350\207\252\345\212\250\345\274\200\345\215\241\344\270\232\345\212\241" new file mode 100644 index 0000000..a223554 --- /dev/null +++ "b/\350\277\207\350\247\246\345\217\221\345\231\250\345\256\236\347\216\260\350\207\252\345\212\250\345\274\200\345\215\241\344\270\232\345\212\241" @@ -0,0 +1,31 @@ +-- 创建触发器函数(MySQL 使用不同的语法) +DELIMITER // + +CREATE TRIGGER trigger_auto_create_card +AFTER INSERT ON userInfo +FOR EACH ROW +BEGIN + -- 为新用户自动创建一张默认的活期储蓄卡(RMB, 活期存款类型) + -- 使用固定前缀+用户ID作为卡号 + INSERT INTO cardInfo( + cardid, + curid, + savingid, + openmoney, + balance, + pass, + isreportloss, + customerid + ) VALUES ( + CONCAT('10103576', LPAD(NEW.customerid, 8, '0')), + 'RMB', + 1, -- 活期存款类型 + 10.00, -- 默认开户金额 + 10.00, -- 默认余额 + '888888', -- 默认密码 + '否', -- 默认未挂失 + NEW.customerid -- 关联的用户ID + ); +END// + +DELIMITER ; \ No newline at end of file -- Gitee