/**
Source Server Version: 8.0.31
Source Database: backendsys
Date: 2023/05/23 17:09:22
*/

DROP TABLE IF EXISTS `sys_user_integral_log`;
CREATE TABLE `sys_user_integral_log` (
    PRIMARY KEY (`id`),
    `id` BIGINT AUTO_INCREMENT COMMENT 'ID',
    `user_id` BIGINT NOT NULL COMMENT '用户ID',
    `content` VARCHAR(500) COMMENT '内容',
    `integral` INT NOT NULL COMMENT '操作积分',
    `operation` INT NOT NULL COMMENT '操作 (1:增加, -1:减少)',
    `operation_user_id` BIGINT COMMENT '操作人 (手动操作必填)',
    `operation_ip` VARCHAR(64) COMMENT '操作IP',
    `origin` INT NOT NULL COMMENT '来源 (1:手动操作, 2:..)',
    `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    INDEX `idx_user_id` (`user_id`)
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='系统用户积分记录表';

INSERT INTO sys_user_integral_log(user_id, content, integral, operation, operation_user_id, origin) VALUES
    (1, '手动添加积分', 100, 1, 1, 1),
    (1, '手动添加积分', 200, 1, 2, 1),
    (1, '手动添加积分', 200, -1, 2, 1)
;
