ALTER TABLE `eb_order`
    ADD COLUMN `insurance_type` int(1)       NULL COMMENT '保费类型 0-保单保费 1-保全保费',
    ADD COLUMN `user_name`      varchar(255) NULL COMMENT '用户昵称',
    ADD COLUMN `product_name`   varchar(255) NULL COMMENT '商品名称',
    ADD COLUMN `member_name`    varchar(255) NULL COMMENT '服务人员名称,号隔开';

UPDATE eb_order
    JOIN eb_user ON eb_order.uid = eb_user.id
SET eb_order.user_name = eb_user.nickname;

UPDATE eb_order
    JOIN eb_order_detail ON eb_order.order_no = eb_order_detail.order_no
SET eb_order.product_name = eb_order_detail.product_name;

UPDATE eb_order
    join (select eb_user.id, GROUP_CONCAT(bcx_department_member.`name` SEPARATOR ',') as member
          from bcx_department_member_serve
                   left join bcx_department_member on bcx_department_member_serve.bcx_id = bcx_department_member.bcx_id
                   left join eb_user on bcx_department_member_serve.org_id = eb_user.account
          where eb_user.id is not null
          GROUP BY eb_user.id) as m on eb_order.uid = m.id
set eb_order.member_name = m.member;

UPDATE eb_order set insurance_type = 1, pay_type = 'bailianbao' where biz_type = 3
