1
This commit is contained in:
153
api/model/company_info.js
Normal file
153
api/model/company_info.js
Normal file
@@ -0,0 +1,153 @@
|
||||
const Sequelize = require('sequelize');
|
||||
|
||||
/**
|
||||
* 公司信息表模型
|
||||
* 存储上市公司基本信息
|
||||
*/
|
||||
module.exports = (db) => {
|
||||
const company_info = db.define("company_info", {
|
||||
// 序号
|
||||
sequence_number: {
|
||||
comment: '序号',
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
defaultValue: 0
|
||||
},
|
||||
|
||||
// 证券代码
|
||||
stock_code: {
|
||||
comment: '证券代码(如:300890.SZ)',
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 公司中文名称
|
||||
company_name: {
|
||||
comment: '公司中文名称',
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: false,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 注册地址
|
||||
registered_address: {
|
||||
comment: '注册地址',
|
||||
type: Sequelize.STRING(500),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 省份
|
||||
province: {
|
||||
comment: '省份',
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 区域(区/县)
|
||||
city: {
|
||||
comment: '区域(区/县),如:宝山区、杨浦区',
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 公司电话
|
||||
phone: {
|
||||
comment: '公司电话',
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 公司电子邮件地址
|
||||
email: {
|
||||
comment: '公司电子邮件地址',
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 公司网站
|
||||
website: {
|
||||
comment: '公司网站',
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
|
||||
// 是否上市
|
||||
is_listed: {
|
||||
comment: '是否上市(1=上市,0=未上市)',
|
||||
type: Sequelize.TINYINT(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
|
||||
// 推荐等级
|
||||
recommendation_level: {
|
||||
comment: '推荐等级(excellent=优秀,good=良好,normal=一般,not_recommended=不推荐)',
|
||||
type: Sequelize.STRING(20),
|
||||
allowNull: true,
|
||||
defaultValue: 'normal'
|
||||
},
|
||||
|
||||
// 状态
|
||||
is_enabled: {
|
||||
comment: '是否启用(1=启用,0=禁用)',
|
||||
type: Sequelize.TINYINT(1),
|
||||
allowNull: false,
|
||||
defaultValue: 1
|
||||
},
|
||||
|
||||
// 备注
|
||||
remark: {
|
||||
comment: '备注',
|
||||
type: Sequelize.TEXT,
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
}
|
||||
}, {
|
||||
indexes: [
|
||||
{
|
||||
unique: false,
|
||||
fields: ['stock_code']
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['company_name']
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['province']
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['city']
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['province', 'city']
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['is_listed']
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['recommendation_level']
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['is_enabled']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// company_info.sync({ force: true });
|
||||
|
||||
return company_info;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user