CREATE TABLE sys_sms (
  id NUMBER(20, 0) NOT NULL,
  platform NUMBER(2, 0),
  mobile varchar2(20),
  params_1 varchar2(50),
  params_2 varchar2(50),
  params_3 varchar2(50),
  params_4 varchar2(50),
  status NUMBER(2, 0),
  creator NUMBER(20, 0),
  create_date date,
  PRIMARY KEY (id)
);

CREATE INDEX idx_sys_sms_create_date on sys_sms(create_date);

COMMENT ON TABLE sys_sms IS '短信';
COMMENT ON COLUMN sys_sms.id IS 'id';
COMMENT ON COLUMN sys_sms.platform IS '平台类型';
COMMENT ON COLUMN sys_sms.mobile IS '手机号';
COMMENT ON COLUMN sys_sms.params_1 IS '参数1';
COMMENT ON COLUMN sys_sms.params_2 IS '参数2';
COMMENT ON COLUMN sys_sms.params_3 IS '参数3';
COMMENT ON COLUMN sys_sms.params_4 IS '参数4';
COMMENT ON COLUMN sys_sms.status IS '发送状态  0：失败  1：成功';
COMMENT ON COLUMN sys_sms.creator IS '创建者';
COMMENT ON COLUMN sys_sms.create_date IS '创建时间';


CREATE TABLE sys_mail_template (
  id NUMBER(20, 0) NOT NULL,
  name varchar2(100),
  subject varchar2(200),
  content clob,
  creator NUMBER(20, 0),
  create_date date,
  updater NUMBER(20, 0),
  update_date date,
  PRIMARY KEY (id)
);

CREATE INDEX idx_mail_template_create_date on sys_mail_template(create_date);

COMMENT ON TABLE sys_mail_template IS '邮件模板';
COMMENT ON COLUMN sys_mail_template.id IS 'id';
COMMENT ON COLUMN sys_mail_template.name IS '模板名称';
COMMENT ON COLUMN sys_mail_template.subject IS '邮件主题';
COMMENT ON COLUMN sys_mail_template.content IS '邮件正文';
COMMENT ON COLUMN sys_mail_template.creator IS '创建者';
COMMENT ON COLUMN sys_mail_template.create_date IS '创建时间';
COMMENT ON COLUMN sys_mail_template.updater IS '更新者';
COMMENT ON COLUMN sys_mail_template.update_date IS '更新时间';


CREATE TABLE sys_mail_log (
  id NUMBER(20, 0) NOT NULL,
  template_id NUMBER(20, 0) NOT NULL,
  mail_from varchar2(200),
  mail_to varchar2(400),
  mail_cc varchar2(400),
  subject varchar2(200),
  content clob,
  status NUMBER(2, 0),
  creator NUMBER(20, 0),
  create_date date,
  PRIMARY KEY (id)
);

CREATE INDEX idx_mail_log_create_date on sys_mail_log(create_date);

COMMENT ON TABLE sys_mail_log IS '邮件发送记录';
COMMENT ON COLUMN sys_mail_log.id IS 'id';
COMMENT ON COLUMN sys_mail_log.template_id IS '邮件模板ID';
COMMENT ON COLUMN sys_mail_log.mail_from IS '发送者';
COMMENT ON COLUMN sys_mail_log.mail_to IS '收件人';
COMMENT ON COLUMN sys_mail_log.mail_cc IS '抄送者';
COMMENT ON COLUMN sys_mail_log.subject IS '邮件主题';
COMMENT ON COLUMN sys_mail_log.content IS '邮件正文';
COMMENT ON COLUMN sys_mail_log.status IS '发送状态  0：失败  1：成功';
COMMENT ON COLUMN sys_mail_log.creator IS '创建者';
COMMENT ON COLUMN sys_mail_log.create_date IS '创建时间';

INSERT INTO sys_params(id, param_code, param_value, param_type, remark, del_flag, creator, create_date, updater, update_date) VALUES (1067246875800000145, 'MAIL_CONFIG_KEY', '{"smtp":"smtp.163.com","port":25,"username":"renrenio_test@163.com","password":"renren123456"}', 0, '邮件配置信息', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_params(id, param_code, param_value, param_type, remark, del_flag, creator, create_date, updater, update_date) VALUES (1067246875800000146, 'SMS_CONFIG_KEY', '{"platform":1,"aliyunAccessKeyId":"1","aliyunAccessKeySecret":"1","aliyunSignName":"1","aliyunTemplateCode":"1","qcloudAppId":2,"qcloudAppKey":"2","qcloudSignName":"2","qcloudTemplateId":"2"}', 0, '短信配置信息', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);

INSERT INTO sys_mail_template(id, name, subject, content, create_date) VALUES (1067246875800000147, '验证码模板', '人人开源注册验证码', '<p>人人开源注册验证码：${code}</p>', CURRENT_DATE);


INSERT INTO sys_menu(id, pid, url, type, icon, permissions, sort, del_flag, creator, create_date, updater, update_date) VALUES (1067246875800000056, 0, '', 0, 'icon-message', '', 3, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_menu(id, pid, url, type, icon, permissions, sort, del_flag, creator, create_date, updater, update_date) VALUES (1067246875800000057, 1067246875800000056, 'message/sms', 0, 'icon-layout', '', 0, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_menu(id, pid, url, type, icon, permissions, sort, del_flag, creator, create_date, updater, update_date) VALUES (1067246875800000058, 1067246875800000056, 'message/mail-template', 0, 'icon-appstore', '', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_menu(id, pid, url, type, icon, permissions, sort, del_flag, creator, create_date, updater, update_date) VALUES (1067246875800000059, 1067246875800000056, 'message/mail-log', 0, 'icon-save', '', 2, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);

INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000056, 'name', 'Message Management', 'en-US');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000056, 'name', '消息管理', 'zh-CN');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000056, 'name', '消息管理', 'zh-TW');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000057, 'name', 'SMS Service', 'en-US');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000057, 'name', '短信服务', 'zh-CN');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000057, 'name', '短信服務', 'zh-TW');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000058, 'name', 'Mail Template', 'en-US');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000058, 'name', '邮件模板', 'zh-CN');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000058, 'name', '郵件模板', 'zh-TW');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000059, 'name', 'Mail Log', 'en-US');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000059, 'name', '邮件发送记录', 'zh-CN');
INSERT INTO sys_language(table_name, table_id, field_name, field_value, language) VALUES ('sys_menu', 1067246875800000059, 'name', '郵件發送記錄', 'zh-TW ');

INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000148, 1067246875800000057, ' 短信服务', '/message/sms/send', 'POST', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000149, 1067246875800000057, ' 短信服务', '/message/sms', 'DELETE', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000150, 1067246875800000057, ' 短信服务', '/message/sms/config', 'GET', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000151, 1067246875800000057, ' 短信服务', '/message/sms/page', 'GET', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000152, 1067246875800000057, ' 短信服务', '/message/sms/saveConfig', 'POST', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000153, 1067246875800000058, ' 邮件模板', '/message/mailtemplate/page', 'GET', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000154, 1067246875800000058, ' 邮件模板', '/message/mailtemplate', 'DELETE', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000155, 1067246875800000058, ' 邮件模板', '/message/mailtemplate/saveConfig', 'POST', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000156, 1067246875800000058, ' 邮件模板', '/message/mailtemplate', 'POST', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000157, 1067246875800000058, ' 邮件模板', '/message/mailtemplate/{id}', 'GET', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000158, 1067246875800000058, ' 邮件模板', '/message/mailtemplate', 'PUT', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000159, 1067246875800000058, ' 邮件模板', '/message/mailtemplate/config', 'GET', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000160, 1067246875800000058, ' 邮件模板', '/message/mailtemplate/send', 'POST', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000161, 1067246875800000059, ' 邮件发送记录', '/message/maillog', 'DELETE', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
INSERT INTO sys_resource(id, resource_code, resource_name, resource_url, resource_method, menu_flag, auth_level, creator, create_date, updater, update_date) VALUES (1067246875800000162, 1067246875800000059, ' 邮件发送记录', '/message/maillog/page', 'GET', 1, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
