首页
关于
Search
1
在投射和录制时显示敏感信息写给TeamViewer,anydesk,向日葵
8,753 阅读
2
sublime 3155-3175 LICENSE
8,045 阅读
3
mysql存储过程&时间累加插入
7,848 阅读
4
mysql-workbench中duration fetch的含义
4,571 阅读
5
永远不要相信浮点数结果精确到了最后一位,也永远不要比较两个浮点数是否相等。
4,523 阅读
ubuntu
linux
sublime
php
mysql
JS
CSS
其他
chrome
redis
登录
Search
标签搜索
mysql
grep
journalctl
curl
only_full_group_by
rename
Sub-process
You can't specify target table
adwaita
全文索引
查看索引
unity8
gmmktime
date.utc
警示
round
ceil
floor
curl抓取重定向
GSConnect
五好的Book
累计撰写
194
篇文章
累计收到
31
条评论
首页
栏目
ubuntu
linux
sublime
php
mysql
JS
CSS
其他
chrome
redis
页面
关于
搜索到
1
篇与
的结果
2021-11-29
用触发器来记录操作记录
直接上代码DROP TRIGGER IF EXISTS `trigger_book` ; DELIMITER $$ CREATE DEFINER=`root`@`%` TRIGGER trigger_book after update ON book FOR EACH ROW BEGIN declare nowtime int(11); set @b1 =''; set nowtime=unix_timestamp(now()); if (old.cooperation!=new.cooperation or new.base!=old.base or new.buyout!=old.buyout or new.into!=old.into or new.quan!=old.quan) then if (old.cooperation!=new.cooperation) then set @b1=concat(" 修改签约类型为:",new.cooperation," 旧值:",old.cooperation); end if; if (new.base!=old.base) then set @b1=concat(@b1," 修改保底为:",new.base," 旧值:",old.base); end if; if (new.buyout!=old.buyout) then set @b1=concat(@b1," 修改买断为:",new.buyout," 旧值:",old.buyout); end if; if (new.quan!=old.quan) then set @b1=concat(@b1," 修改全勤为:",new.quan," 旧值:",old.quan); end if; if (new.`into`!=old.`into`) then set @b1=concat(@b1," 修改分成为:",new.`into`," 旧值:",old.`into`); end if; insert into opt_log(opt_uid,opt_value,opt_time,bid)value(new.opt_uid,@b1,nowtime,new.id); end if; end $$# DELIMITER ; 以上是修改书的签约类型时,记录对应的人以及对应的修改前后的值。可能应用场景有限,但是这不需要在应用层去做相关功能, 直接数据库里就完事了。如果感兴趣还可以看看函数的应用
2021年11月29日
1,048 阅读
0 评论
0 点赞