巴林闲侠
1 year ago
10 changed files with 368 additions and 11 deletions
@ -0,0 +1,60 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const ReportSpotCheck = sequelize.define("reportSpotCheck", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "report_spot_check_id_uindex" |
||||
|
}, |
||||
|
reportId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "report_id", |
||||
|
autoIncrement: false, |
||||
|
references: { |
||||
|
key: "id", |
||||
|
model: "report" |
||||
|
} |
||||
|
}, |
||||
|
spotDate: { |
||||
|
type: DataTypes.DATEONLY, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "spot_date", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
prepareId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "prepare_id", |
||||
|
autoIncrement: false, |
||||
|
references: { |
||||
|
key: "id", |
||||
|
model: "reportSpotCheckPreview" |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "report_spot_check", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.ReportSpotCheck = ReportSpotCheck; |
||||
|
return ReportSpotCheck; |
||||
|
}; |
@ -0,0 +1,74 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const ReportSpotCheckPreview = sequelize.define("reportSpotCheckPreview", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "report_spot_check_preview_id_uindex" |
||||
|
}, |
||||
|
percentage: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "抽查比例", |
||||
|
primaryKey: false, |
||||
|
field: "percentage", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
departmentId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "幸运乡镇", |
||||
|
primaryKey: false, |
||||
|
field: "department_id", |
||||
|
autoIncrement: false, |
||||
|
references: { |
||||
|
key: "id", |
||||
|
model: "department" |
||||
|
} |
||||
|
}, |
||||
|
date: { |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: "预览时间", |
||||
|
primaryKey: false, |
||||
|
field: "date", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
reportCount: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: "当时上报总数", |
||||
|
primaryKey: false, |
||||
|
field: "report_count", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
checked: { |
||||
|
type: DataTypes.BOOLEAN, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "checked", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "report_spot_check_preview", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.ReportSpotCheckPreview = ReportSpotCheckPreview; |
||||
|
return ReportSpotCheckPreview; |
||||
|
}; |
@ -0,0 +1,29 @@ |
|||||
|
create table report_spot_check_preview |
||||
|
( |
||||
|
id serial not null, |
||||
|
percentage int not null, |
||||
|
department_id int not null |
||||
|
constraint report_spot_check_preview_department_id_fk |
||||
|
references department (id), |
||||
|
date timestamp with time zone, |
||||
|
report_count int not null, |
||||
|
checked bool default false |
||||
|
); |
||||
|
|
||||
|
comment on table report_spot_check_preview is '抽查的预览结果 '; |
||||
|
|
||||
|
comment on column report_spot_check_preview.percentage is '抽查比例'; |
||||
|
|
||||
|
comment on column report_spot_check_preview.department_id is '幸运乡镇'; |
||||
|
|
||||
|
comment on column report_spot_check_preview.date is '预览时间'; |
||||
|
|
||||
|
comment on column report_spot_check_preview.report_count is '当时上报总数'; |
||||
|
|
||||
|
create unique index report_spot_check_preview_id_uindex |
||||
|
on report_spot_check_preview (id); |
||||
|
|
||||
|
alter table report_spot_check_preview |
||||
|
add constraint report_spot_check_preview_pk |
||||
|
primary key (id); |
||||
|
|
@ -0,0 +1,17 @@ |
|||||
|
create table if not exists report_spot_check |
||||
|
( |
||||
|
id serial not null |
||||
|
constraint report_spot_check_pk |
||||
|
primary key, |
||||
|
report_id integer not null |
||||
|
constraint report_spot_check_report_id_fk |
||||
|
references report, |
||||
|
spot_date date not null, |
||||
|
prepare_id integer not null |
||||
|
constraint report_spot_check_report_spot_check_preview_id_fk |
||||
|
references report_spot_check_preview |
||||
|
); |
||||
|
|
||||
|
create unique index if not exists report_spot_check_id_uindex |
||||
|
on report_spot_check (id); |
||||
|
|
Loading…
Reference in new issue