Browse Source

数据导出接口

release_0.0.4
巴林闲侠 3 years ago
parent
commit
448e0d6dd4
  1. 87
      api/app/lib/controllers/data/index.js
  2. 12
      api/app/lib/models/project.js
  3. 4
      api/app/lib/models/publicity.js
  4. 16
      api/app/lib/models/report.js
  5. 77
      api/app/lib/models/road.js
  6. 4
      api/app/lib/models/statistic.js
  7. 3
      api/sequelize-automate.config.js

87
api/app/lib/controllers/data/index.js

@ -7,90 +7,75 @@ async function dataExport (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { userId } = ctx.fs.api const { userId } = ctx.fs.api
const { ids } = ctx.query; const { exp, ids, roadLevel, municipalType } = ctx.query;
const fileList = [ if (!exp) {
{ throw '参数错误';
n: '道路', }
tableName: 'road',
defaultKey: ['level'], const modalList = [
defaultValue: ['村'],
},
{
n: '道路',
tableName: 'road',
defaultKey: ['level'],
defaultValue: ['县'],
},
{ {
n: '道路', n: '道路',
tableName: 'road', k: 'road',
defaultKey: ['level'], tableName: 'Road',
defaultValue: ['乡'],
}, },
{ {
n: '桥梁', n: '桥梁',
tableName: 'bridge' k: 'bridge',
}, tableName: 'Bridge'
{
n: '运政车辆',
tableName: 'municipal_vehicle',
defaultKey: ['type'],
defaultValue: ['出租车'],
}, },
{ {
n: '运政车辆', n: '运政车辆',
tableName: 'municipal_vehicle', k: 'vehicle',
defaultKey: ['type'], tableName: 'MunicipalVehicle',
defaultValue: ['危货'],
}, },
{ {
n: '运政业户', n: '运政业户',
tableName: 'municipal_business', k: 'business',
defaultKey: ['type'], tableName: 'MunicipalBusiness',
defaultValue: ['出租车'],
},
{
n: '运政业户',
tableName: 'municipal_business',
defaultKey: ['type'],
defaultValue: ['危货'],
},
{
n: '工程一览',
tableName: 'project',
defaultKey: ['done', 'type'],
defaultValue: [false, 'road'],
}, },
{ {
n: '工程一览', n: '工程一览',
tableName: 'project', k: 'project',
defaultKey: ['done', 'type'], tableName: 'Project',
defaultValue: [false, 'bridge'],
}, },
{ {
n: '治超', n: '治超',
tableName: 'overspeed', k: 'overspeed',
tableName: 'Overspeed',
}, },
{ {
n: '公交线路', n: '公交线路',
tableName: 'bus_line', k: 'busLine',
tableName: 'BusLine',
}, },
{ {
n: '公交车辆', n: '公交车辆',
tableName: 'bus_car', k: 'busCar',
tableName: 'BusCar',
}, },
] ]
const modalOption = modalList.find(item => item.k == exp);
if (!modalOption) {
throw '参数错误';
}
let findOption = { let findOption = {
where: {} where: {}
} }
if (ids) { if (ids) {
findOption.where.id = { $in: ids.split(',') } findOption.where.id = { $in: ids.split(',') }
} }
if (roadLevel) {
findOption.where.level = roadLevel
}
if (municipalType) {
findOption.where.type = municipalType
}
const exportData = await models.BusCar.findAll(findOption) const exportData = await models[modalOption.tableName].findAll(findOption)
const tableAttributes = models.BusCar.tableAttributes const tableAttributes = models[modalOption.tableName].tableAttributes
let header = [] let header = []
for (let k in tableAttributes) { for (let k in tableAttributes) {
if (k != 'id') { if (k != 'id') {
@ -103,7 +88,7 @@ async function dataExport (ctx) {
} }
header.sort((a, b) => { return a.index - b.index }) header.sort((a, b) => { return a.index - b.index })
const fileName = `摄像头信息列表_${moment().format('YYYYMMDDHHmmss')}` + '.csv' const fileName = `${modalOption.n}_${moment().format('YYYYMMDDHHmmss')}` + '.csv'
const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName }) const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName })
const fileData = fs.readFileSync(filePath); const fileData = fs.readFileSync(filePath);

12
api/app/lib/models/project.js

@ -6,6 +6,7 @@ module.exports = dc => {
const sequelize = dc.orm; const sequelize = dc.orm;
const Project = sequelize.define("project", { const Project = sequelize.define("project", {
id: { id: {
index: 1,
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -16,6 +17,7 @@ module.exports = dc => {
unique: "project_id_uindex" unique: "project_id_uindex"
}, },
entryName: { entryName: {
index: 2,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -25,6 +27,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
projectMileage: { projectMileage: {
index: 3,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -34,6 +37,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
investment: { investment: {
index: 4,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -43,6 +47,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
buildUnit: { buildUnit: {
index: 5,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -52,6 +57,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
constructionControlUnit: { constructionControlUnit: {
index: 6,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -61,6 +67,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
designUnit: { designUnit: {
index: 7,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -70,6 +77,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
constructionUnit: { constructionUnit: {
index: 8,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -79,6 +87,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
supervisorAndSupervisor: { supervisorAndSupervisor: {
index: 9,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -88,6 +97,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
projectProgress: { projectProgress: {
index: 10,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -97,6 +107,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
done: { done: {
index: 11,
type: DataTypes.BOOLEAN, type: DataTypes.BOOLEAN,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -106,6 +117,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
type: { type: {
index: 12,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,

4
api/app/lib/models/publicity.js

@ -6,6 +6,7 @@ module.exports = dc => {
const sequelize = dc.orm; const sequelize = dc.orm;
const Publicity = sequelize.define("publicity", { const Publicity = sequelize.define("publicity", {
id: { id: {
index: 1,
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -16,6 +17,7 @@ module.exports = dc => {
unique: "publicity_id_uindex" unique: "publicity_id_uindex"
}, },
name: { name: {
index: 2,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -25,6 +27,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
video: { video: {
index: 3,
type: DataTypes.ARRAY(DataTypes.INTEGER), type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -34,6 +37,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
enable: { enable: {
index: 4,
type: DataTypes.BOOLEAN, type: DataTypes.BOOLEAN,
allowNull: false, allowNull: false,
defaultValue: true, defaultValue: true,

16
api/app/lib/models/report.js

@ -6,6 +6,7 @@ module.exports = dc => {
const sequelize = dc.orm; const sequelize = dc.orm;
const Report = sequelize.define("report", { const Report = sequelize.define("report", {
id: { id: {
index: 1,
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -16,6 +17,7 @@ module.exports = dc => {
unique: "report_id_uindex" unique: "report_id_uindex"
}, },
reportType: { reportType: {
index: 2,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -25,6 +27,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
projectType: { projectType: {
index: 3,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -34,6 +37,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
road: { road: {
index: 4,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -43,6 +47,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
roadSectionStart: { roadSectionStart: {
index: 5,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -52,6 +57,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
roadSectionEnd: { roadSectionEnd: {
index: 6,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -61,6 +67,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
longitude: { longitude: {
index: 7,
type: DataTypes.DOUBLE, type: DataTypes.DOUBLE,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -70,6 +77,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
latitude: { latitude: {
index: 8,
type: DataTypes.DOUBLE, type: DataTypes.DOUBLE,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -79,6 +87,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
content: { content: {
index: 9,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -88,6 +97,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
scenePic: { scenePic: {
index: 10,
type: DataTypes.ARRAY(DataTypes.STRING), type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -97,6 +107,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
conserveBeforePic: { conserveBeforePic: {
index: 11,
type: DataTypes.ARRAY(DataTypes.STRING), type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -106,6 +117,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
conserveUnderwayPic: { conserveUnderwayPic: {
index: 12,
type: DataTypes.ARRAY(DataTypes.STRING), type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -115,6 +127,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
conserveAfterPic: { conserveAfterPic: {
index: 13,
type: DataTypes.ARRAY(DataTypes.STRING), type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -124,6 +137,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
userId: { userId: {
index: 14,
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -133,6 +147,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
time: { time: {
index: 15,
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -142,6 +157,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
address: { address: {
index: 16,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,

77
api/app/lib/models/road.js

@ -6,6 +6,7 @@ module.exports = dc => {
const sequelize = dc.orm; const sequelize = dc.orm;
const Road = sequelize.define("road", { const Road = sequelize.define("road", {
id: { id: {
index: 1,
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -16,6 +17,7 @@ module.exports = dc => {
unique: "road_id_uindex" unique: "road_id_uindex"
}, },
routeName: { routeName: {
index: 2,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -25,6 +27,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
routeCode: { routeCode: {
index: 3,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -34,6 +37,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
sectionNo: { sectionNo: {
index: 4,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -43,6 +47,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
townshipCode: { townshipCode: {
index: 5,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -52,6 +57,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
startingPlaceName: { startingPlaceName: {
index: 6,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -61,6 +67,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
startStation: { startStation: {
index: 7,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -70,6 +77,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
categoryOfStartingPointAndDividingPoint: { categoryOfStartingPointAndDividingPoint: {
index: 8,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -79,6 +87,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
stopPlaceName: { stopPlaceName: {
index: 9,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -88,6 +97,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
categoryOfDeadCenterAndDividingPoint: { categoryOfDeadCenterAndDividingPoint: {
index: 10,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -97,6 +107,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
stopStation: { stopStation: {
index: 11,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -106,6 +117,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
sectionType: { sectionType: {
index: 12,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -115,6 +127,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
routeCodeBeforeRoadNetworkAdjustment: { routeCodeBeforeRoadNetworkAdjustment: {
index: 13,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -124,6 +137,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
serialNumberOfOriginalSection: { serialNumberOfOriginalSection: {
index: 14,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -133,6 +147,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
startingStakeNumberOfTheOriginalRoadSection: { startingStakeNumberOfTheOriginalRoadSection: {
index: 15,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -142,6 +157,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
endingPointStakeNoOfTheOriginalRoadSection: { endingPointStakeNoOfTheOriginalRoadSection: {
index: 16,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -151,6 +167,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
routeLevel: { routeLevel: {
index: 17,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -160,6 +177,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
natureOfRoadSection: { natureOfRoadSection: {
index: 18,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -169,6 +187,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
completionTime: { completionTime: {
index: 19,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -178,6 +197,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
reconstructionTime: { reconstructionTime: {
index: 20,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -187,6 +207,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
natureOfConstruction: { natureOfConstruction: {
index: 21,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -196,6 +217,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
gbmAndCivilizedModelRoad: { gbmAndCivilizedModelRoad: {
index: 22,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -205,6 +227,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
landforms: { landforms: {
index: 23,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -214,6 +237,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
natureOfCharges: { natureOfCharges: {
index: 24,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -223,6 +247,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
tollStation: { tollStation: {
index: 25,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -232,6 +257,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
numberOfCulverts: { numberOfCulverts: {
index: 26,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -241,6 +267,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
technicalLevel: { technicalLevel: {
index: 27,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -250,6 +277,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
pavementType: { pavementType: {
index: 28,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -259,6 +287,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
pavementWidth: { pavementWidth: {
index: 29,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -268,6 +297,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
subgradeWidth: { subgradeWidth: {
index: 30,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -277,6 +307,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
laneCharacteristics: { laneCharacteristics: {
index: 31,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -286,6 +317,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
whetherItIsOpenToTrafficInSunnyOrRainyDays: { whetherItIsOpenToTrafficInSunnyOrRainyDays: {
index: 32,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -295,6 +327,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
designSpeedPerHour: { designSpeedPerHour: {
index: 33,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -304,6 +337,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
urbanManagementSectionOrNot: { urbanManagementSectionOrNot: {
index: 34,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -313,6 +347,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
managementAndMaintenanceUnit: { managementAndMaintenanceUnit: {
index: 35,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -322,6 +357,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
roadAdministrationUnit: { roadAdministrationUnit: {
index: 36,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -331,6 +367,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
alimentation: { alimentation: {
index: 37,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -340,6 +377,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
sourceOfListedMaintenanceFunds: { sourceOfListedMaintenanceFunds: {
index: 38,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -349,6 +387,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
curingTime: { curingTime: {
index: 39,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -358,6 +397,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
greeningMileage: { greeningMileage: {
index: 40,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -367,6 +407,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
greeningMileaged: { greeningMileaged: {
index: 41,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -376,6 +417,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
typeOfRepeatedRoadSection: { typeOfRepeatedRoadSection: {
index: 42,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -385,6 +427,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
serialNumberOfRepeatedSection: { serialNumberOfRepeatedSection: {
index: 43,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -394,6 +437,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
repeatedSectionRouteCode: { repeatedSectionRouteCode: {
index: 44,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -403,6 +447,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
plannedFundCategory: { plannedFundCategory: {
index: 45,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -412,6 +457,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
plannedYear: { plannedYear: {
index: 46,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -421,6 +467,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
planDocumentNo: { planDocumentNo: {
index: 47,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -430,6 +477,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
planItemUniqueCode: { planItemUniqueCode: {
index: 48,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -439,6 +487,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
plannedProjectRouteCode: { plannedProjectRouteCode: {
index: 49,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -448,6 +497,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
planProjectName: { planProjectName: {
index: 50,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -457,6 +507,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
plannedProjectType: { plannedProjectType: {
index: 51,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -466,6 +517,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
completionStatus: { completionStatus: {
index: 52,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -475,6 +527,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
yearOfCompletion: { yearOfCompletion: {
index: 53,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -484,6 +537,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
plannedFundCategoryOne: { plannedFundCategoryOne: {
index: 54,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -493,6 +547,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
plannedYearOne: { plannedYearOne: {
index: 55,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -502,6 +557,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
planDocumentNoOne: { planDocumentNoOne: {
index: 56,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -511,6 +567,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
planItemUniqueCodeOne: { planItemUniqueCodeOne: {
index: 57,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -520,6 +577,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
planProjectNameOne: { planProjectNameOne: {
index: 58,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -529,6 +587,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
completionStatusOne: { completionStatusOne: {
index: 59,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -538,6 +597,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
yearOfCompletionOne: { yearOfCompletionOne: {
index: 60,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -547,6 +607,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
stationRange: { stationRange: {
index: 61,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -556,6 +617,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
reportingUnit: { reportingUnit: {
index: 62,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -565,6 +627,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
reasonForChange: { reasonForChange: {
index: 63,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -574,6 +637,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
changeTime: { changeTime: {
index: 64,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -583,6 +647,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
lastRepairAndMaintenanceYear: { lastRepairAndMaintenanceYear: {
index: 65,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -592,6 +657,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
whetherMaintenanceManagedHighway: { whetherMaintenanceManagedHighway: {
index: 66,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -601,6 +667,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
remarks: { remarks: {
index: 67,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -610,6 +677,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
routeCodeOfLastYear: { routeCodeOfLastYear: {
index: 68,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -619,6 +687,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
routeNameOfLastYear: { routeNameOfLastYear: {
index: 69,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -628,6 +697,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
startingStationOfLastYear: { startingStationOfLastYear: {
index: 70,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -637,6 +707,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
lastYearsEndingPointStakeNumber: { lastYearsEndingPointStakeNumber: {
index: 71,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -646,6 +717,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
graphicMileage: { graphicMileage: {
index: 72,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -655,6 +727,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
chainageMileage: { chainageMileage: {
index: 73,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -664,6 +737,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
districtcounty: { districtcounty: {
index: 74,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -673,6 +747,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
locationCity: { locationCity: {
index: 75,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -682,6 +757,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
level: { level: {
index: 76,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
@ -691,6 +767,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
surfaceThickness: { surfaceThickness: {
index: 77,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,

4
api/app/lib/models/statistic.js

@ -6,6 +6,7 @@ module.exports = dc => {
const sequelize = dc.orm; const sequelize = dc.orm;
const Statistic = sequelize.define("statistic", { const Statistic = sequelize.define("statistic", {
id: { id: {
index: 1,
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -16,6 +17,7 @@ module.exports = dc => {
unique: "vehicle_id_uindex" unique: "vehicle_id_uindex"
}, },
name: { name: {
index: 2,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
@ -25,6 +27,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
count: { count: {
index: 3,
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: "0", defaultValue: "0",
@ -34,6 +37,7 @@ module.exports = dc => {
autoIncrement: false autoIncrement: false
}, },
type: { type: {
index: 4,
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,

3
api/sequelize-automate.config.js

@ -18,6 +18,7 @@ module.exports = {
timestamps: false, timestamps: false,
}, },
}, },
// !!! 所有 model 都有自定义脚本所不能生成的内容 执行此脚本需谨慎
options: { options: {
type: 'freesun', // 指定 models 代码风格 type: 'freesun', // 指定 models 代码风格
camelCase: true, // Models 文件中代码是否使用驼峰命名 camelCase: true, // Models 文件中代码是否使用驼峰命名
@ -27,7 +28,7 @@ module.exports = {
typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义 typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义
emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir` emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir`
tables: null, // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 tables: null, // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性
skipTables: ['report', 'publicity'], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性 skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性
tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中 tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中
ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面 ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面
attrLength: false, // 在生成模型的字段中 是否生成 如 var(128)这种格式,公司一般使用 String ,则配置为 false attrLength: false, // 在生成模型的字段中 是否生成 如 var(128)这种格式,公司一般使用 String ,则配置为 false

Loading…
Cancel
Save