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 {
const models = ctx.fs.dc.models;
const { userId } = ctx.fs.api
const { ids } = ctx.query;
const { exp, ids, roadLevel, municipalType } = ctx.query;
const fileList = [
{
n: '道路',
tableName: 'road',
defaultKey: ['level'],
defaultValue: ['村'],
},
{
n: '道路',
tableName: 'road',
defaultKey: ['level'],
defaultValue: ['县'],
},
if (!exp) {
throw '参数错误';
}
const modalList = [
{
n: '道路',
tableName: 'road',
defaultKey: ['level'],
defaultValue: ['乡'],
k: 'road',
tableName: 'Road',
},
{
n: '桥梁',
tableName: 'bridge'
},
{
n: '运政车辆',
tableName: 'municipal_vehicle',
defaultKey: ['type'],
defaultValue: ['出租车'],
k: 'bridge',
tableName: 'Bridge'
},
{
n: '运政车辆',
tableName: 'municipal_vehicle',
defaultKey: ['type'],
defaultValue: ['危货'],
k: 'vehicle',
tableName: 'MunicipalVehicle',
},
{
n: '运政业户',
tableName: 'municipal_business',
defaultKey: ['type'],
defaultValue: ['出租车'],
},
{
n: '运政业户',
tableName: 'municipal_business',
defaultKey: ['type'],
defaultValue: ['危货'],
},
{
n: '工程一览',
tableName: 'project',
defaultKey: ['done', 'type'],
defaultValue: [false, 'road'],
k: 'business',
tableName: 'MunicipalBusiness',
},
{
n: '工程一览',
tableName: 'project',
defaultKey: ['done', 'type'],
defaultValue: [false, 'bridge'],
k: 'project',
tableName: 'Project',
},
{
n: '治超',
tableName: 'overspeed',
k: 'overspeed',
tableName: 'Overspeed',
},
{
n: '公交线路',
tableName: 'bus_line',
k: 'busLine',
tableName: 'BusLine',
},
{
n: '公交车辆',
tableName: 'bus_car',
k: 'busCar',
tableName: 'BusCar',
},
]
const modalOption = modalList.find(item => item.k == exp);
if (!modalOption) {
throw '参数错误';
}
let findOption = {
where: {}
}
if (ids) {
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 tableAttributes = models.BusCar.tableAttributes
const exportData = await models[modalOption.tableName].findAll(findOption)
const tableAttributes = models[modalOption.tableName].tableAttributes
let header = []
for (let k in tableAttributes) {
if (k != 'id') {
@ -103,7 +88,7 @@ async function dataExport (ctx) {
}
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 fileData = fs.readFileSync(filePath);

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

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

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

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

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

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

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

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

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

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

3
api/sequelize-automate.config.js

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

Loading…
Cancel
Save