-- 薪资发放明细表
CREATE TABLE IF NOT EXISTS hrm_salary_payment_detail (
    id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
    payment_id BIGINT NOT NULL COMMENT '发放台账ID',
    calculation_id BIGINT NOT NULL COMMENT '薪酬核算ID',
    user_id BIGINT NOT NULL COMMENT '员工ID',
    dept_id BIGINT DEFAULT NULL COMMENT '部门ID',
    actual_salary DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '实发工资',
    status INT NOT NULL DEFAULT 0 COMMENT '发放状态：0-待发放，10-已发放',
    payment_time DATETIME DEFAULT NULL COMMENT '发放时间',
    remark VARCHAR(255) DEFAULT NULL COMMENT '备注',
    create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    update_time DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    creator VARCHAR(64) DEFAULT '' COMMENT '创建人',
    updater VARCHAR(64) DEFAULT '' COMMENT '更新人',
    deleted BIT NOT NULL DEFAULT 0 COMMENT '是否删除',
    INDEX idx_payment_id (payment_id),
    INDEX idx_calculation_id (calculation_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT '薪资发放明细';
