sql.sql 2.21 KB
alter table follow_record_log
    add task_id bigint null comment '跟进任务id' after id;

update follow_record_log t1
set task_id = (select w1.task_id from follow_record w1 where w1.id = t1.record_id)
where t1.task_id is null;


create table secret_report_history
(
    id               bigint auto_increment,
    task_id          bigint       not null comment '任务id',
    task_type        int(3)       not null comment '跟进类型 ',
    follow_record_id bigint       not null comment '跟进记录id',
    first_call       tinyint(1)   not null comment '是否是首次通话',
    call_id          varchar(225) not null comment '通话记录id',
    staff_id         bigint       not null comment '工作人员id',
    staff_name       varchar(64)  null comment '工作人员名称',
    customer_id      bigint       not null comment '客户id',
    call_type        int(3)       not null comment '主/被叫',
    call_time        datetime     not null comment '呼叫时间',
    call_duration    bigint          null comment '通话时长(秒)',
    shop_id          bigint       not null comment '门店id',
    group_id         bigint       not null comment '集团id',
    constraint secret_report_history_pk
        primary key (id)
)
    comment '智能电话通话记录';

create index secret_report_history_call_time_index
    on secret_report_history (call_time);

create index secret_report_history_customer_id_index
    on secret_report_history (customer_id);

create index secret_report_history_staff_id_index
    on secret_report_history (staff_id);




-- 报表字段调整
alter table cas_015_d
    add i10 int null comment '智能电话跟进有效数';
alter table cas_015_d
    add i11 int null comment '智能电话跟进数';
alter table cas_015_d
    add i12 int null comment '首次智能电话跟进有效数';
alter table cas_015_d
    add i13 int null comment '首次智能电话跟进数';



alter table cas_015_m
    add i10 int null comment '智能电话跟进有效数';
alter table cas_015_m
    add i11 int null comment '智能电话跟进数';
alter table cas_015_m
    add i12 int null comment '首次智能电话跟进有效数';
alter table cas_015_m
    add i13 int null comment '首次智能电话跟进数';