TG.WXCRM.V4/Model/Sql/20221011.txt

40 lines
1.5 KiB
Plaintext

alter table WX_AFTERSALES3 add isexe NUMBER default 0;
alter table WW_HHUSER_EID add isExe NUMBER default 0;
alter table WW_HHUSER_EID add Ctime DATE DEFAULT SYSDATE; //需发布riaservice
create table WW_HHUSER_EID_NOTICE
(
USERID VARCHAR2(200),
INNERUSERID NUMBER,
NoticeType NUMBER,
CTIME DATE,
UTIME DATE
);
comment on table WW_HHUSER_EID_NOTICE
is '企微微信 提醒表';
-- Add comments to the columns
comment on column WW_HHUSER_EID_NOTICE.USERID
is '企业微信ID 对应WW_HHUSER_EID 主键';
comment on column WW_HHUSER_EID_NOTICE.NoticeType
is '类型';
comment on column WW_HHUSER_EID_NOTICE.INNERUSERID
is '员工pkid';
comment on column WW_HHUSER_EID_NOTICE.CTIME
is '创建时间';
alter table WW_HHUSER_EID_NOTICE
add constraint PK_WW_HHUSER_EID_NOTICE primary key (USERID, INNERUSERID,NoticeType)
--更新历史退款订单字段
update wx_szzyorder set wx_szzyorder.deptcode = (select deptcode from WX_SZZYORDERREFUND where WX_SZZYORDERREFUND.orderid = wx_szzyorder.orderid)
where orderid in (
select a.orderid from WX_SZZYORDERREFUND a
join wx_szzyorder b on a.orderid = b.orderid where a.deptcode is not null and b.deptcode is null
);
update WX_SZZYORDERREFUND set WX_SZZYORDERREFUND.deptcode = (select deptcode from wx_szzyorder where wx_szzyorder.orderid = WX_SZZYORDERREFUND.orderid)
where orderid in (
select a.orderid from WX_SZZYORDERREFUND a
join wx_szzyorder b on a.orderid = b.orderid where a.deptcode is null and b.deptcode is not null)