Browse Source

上报处理数据

dev
巴林闲侠 2 years ago
parent
commit
9e51bbe72a
  1. 14
      api/app/lib/controllers/report/index.js
  2. 437
      api/app/lib/models/report.js
  3. 8
      scripts/1.2.3/schema/2.update_report.sql

14
api/app/lib/controllers/report/index.js

@ -32,7 +32,6 @@ async function reportList (ctx) {
`
const res = await sequelize.query(sqlStr, { type: QueryTypes.SELECT })
let a = 1
findUsers = res.map(item => {
return item.id
})
@ -192,10 +191,15 @@ async function reportHandle (ctx) {
const { reportId } = ctx.params
const { handleState } = ctx.request.body
await models.Report.update({
handleState: handleState
}, {
const data = ctx.request.body
/**
* data = {
* handleState,
* handleContent,
* handlePic
* }
*/
await models.Report.update(data, {
where: {
id: reportId
}

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

@ -3,214 +3,231 @@
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Report = sequelize.define("report", {
id: {
index: 1,
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "report_id_uindex"
},
reportType: {
index: 2,
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "上报类型",
primaryKey: false,
field: "report_type",
autoIncrement: false
},
projectType: {
index: 3,
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "工程类型",
primaryKey: false,
field: "project_type",
autoIncrement: false
},
road: {
index: 4,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '所属道路',
primaryKey: false,
field: "road",
autoIncrement: false
},
roadSectionStart: {
index: 5,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '开始路段',
primaryKey: false,
field: "road_section_start",
autoIncrement: false
},
roadSectionEnd: {
index: 6,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '结束路段',
primaryKey: false,
field: "road_section_end",
autoIncrement: false
},
longitude: {
index: 7,
type: DataTypes.DOUBLE,
allowNull: true,
defaultValue: null,
comment: '经度',
primaryKey: false,
field: "longitude",
autoIncrement: false
},
latitude: {
index: 8,
type: DataTypes.DOUBLE,
allowNull: true,
defaultValue: null,
comment: '纬度',
primaryKey: false,
field: "latitude",
autoIncrement: false
},
content: {
index: 9,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '具体内容',
primaryKey: false,
field: "content",
autoIncrement: false
},
scenePic: {
index: 10,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "scene_pic",
autoIncrement: false
},
conserveBeforePic: {
index: 11,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "conserve_before_pic",
autoIncrement: false
},
conserveUnderwayPic: {
index: 12,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "conserve_underway_pic",
autoIncrement: false
},
conserveAfterPic: {
index: 13,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "conserve_after_pic",
autoIncrement: false
},
userId: {
index: 14,
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false
},
time: {
index: 15,
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: '创建日期',
primaryKey: false,
field: "time",
autoIncrement: false
},
address: {
index: 16,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '具体位置',
primaryKey: false,
field: "address",
autoIncrement: false
},
projectName: {
index: 17,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "工程名称",
primaryKey: false,
field: "project_name",
autoIncrement: false
},
handleState: {
index: 18,
type: DataTypes.STRING,
allowNull: false,
defaultValue: "已处理",
// comment: "处理状态",
primaryKey: false,
field: "handle_state",
autoIncrement: false
},
routeCode: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "route_code",
autoIncrement: false
},
performerId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "执行者",
primaryKey: false,
field: "performer_id",
autoIncrement: false
}
}, {
tableName: "report",
comment: "",
indexes: []
});
dc.models.Report = Report;
return Report;
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Report = sequelize.define("report", {
id: {
index: 1,
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "report_id_uindex"
},
reportType: {
index: 2,
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "上报类型",
primaryKey: false,
field: "report_type",
autoIncrement: false
},
projectType: {
index: 3,
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "工程类型",
primaryKey: false,
field: "project_type",
autoIncrement: false
},
road: {
index: 4,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '所属道路',
primaryKey: false,
field: "road",
autoIncrement: false
},
roadSectionStart: {
index: 5,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '开始路段',
primaryKey: false,
field: "road_section_start",
autoIncrement: false
},
roadSectionEnd: {
index: 6,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '结束路段',
primaryKey: false,
field: "road_section_end",
autoIncrement: false
},
longitude: {
index: 7,
type: DataTypes.DOUBLE,
allowNull: true,
defaultValue: null,
comment: '经度',
primaryKey: false,
field: "longitude",
autoIncrement: false
},
latitude: {
index: 8,
type: DataTypes.DOUBLE,
allowNull: true,
defaultValue: null,
comment: '纬度',
primaryKey: false,
field: "latitude",
autoIncrement: false
},
content: {
index: 9,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '具体内容',
primaryKey: false,
field: "content",
autoIncrement: false
},
scenePic: {
index: 10,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "scene_pic",
autoIncrement: false
},
conserveBeforePic: {
index: 11,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "conserve_before_pic",
autoIncrement: false
},
conserveUnderwayPic: {
index: 12,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "conserve_underway_pic",
autoIncrement: false
},
conserveAfterPic: {
index: 13,
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "conserve_after_pic",
autoIncrement: false
},
userId: {
index: 14,
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "user_id",
autoIncrement: false
},
time: {
index: 15,
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: '创建日期',
primaryKey: false,
field: "time",
autoIncrement: false
},
address: {
index: 16,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: '具体位置',
primaryKey: false,
field: "address",
autoIncrement: false
},
projectName: {
index: 17,
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "工程名称",
primaryKey: false,
field: "project_name",
autoIncrement: false
},
handleState: {
index: 18,
type: DataTypes.STRING,
allowNull: false,
defaultValue: "已处理",
// comment: "处理状态",
primaryKey: false,
field: "handle_state",
autoIncrement: false
},
routeCode: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "route_code",
autoIncrement: false
},
performerId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: "执行者",
primaryKey: false,
field: "performer_id",
autoIncrement: false
},
handleContent: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "",
primaryKey: false,
field: "handle_content",
autoIncrement: false
},
handlePic: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "handle_pic",
autoIncrement: false
},
}, {
tableName: "report",
comment: "",
indexes: []
});
dc.models.Report = Report;
return Report;
};

8
scripts/1.2.3/schema/2.update_report.sql

@ -1,2 +1,6 @@
alter table report
add code_road varchar(512);
ALTER TABLE report add code_road varchar(512);
ALTER TABLE report add handle_content varchar(1024); comment
ON column report.handle_content is '执行内容描述';
ALTER TABLE report add handle_pic varchar(1204) [];
Loading…
Cancel
Save