明树Git Lab

Commit 3105652c authored by zfp1's avatar zfp1

1

parent f8cea7e0
Pipeline #108168 passed with stage
in 3 seconds
...@@ -413,8 +413,8 @@ async function getCgqygl(req, res, next) { ...@@ -413,8 +413,8 @@ async function getCgqygl(req, res, next) {
let info = await DB.RcCgqygl.findOne({ where: search, raw: true }); let info = await DB.RcCgqygl.findOne({ where: search, raw: true });
if (!(info && info.id && info.projectId)) return res.sendError(errorMessage.resourceNotFound); if (!(info && info.id && info.projectId)) return res.sendError(errorMessage.resourceNotFound);
let tzfhs = await DB.RcCgqyglTzfh.findAll({ where: { projectId: info.projectId, sourceId: info.id }, raw: true }); let tzfhs = await DB.RcCgqyglTzfh.findAll({ where: { projectId: info.projectId, sourceId: info.id }});
let wtyys = await DB.RcCgqyglWtyy.findAll({ where: { projectId: info.projectId, sourceId: info.id }, raw: true }); let wtyys = await DB.RcCgqyglWtyy.findAll({ where: { projectId: info.projectId, sourceId: info.id }});
info.tzfhs = tzfhs || []; info.tzfhs = tzfhs || [];
info.wtyys = wtyys || []; info.wtyys = wtyys || [];
return res.sendData(info); return res.sendData(info);
......
...@@ -481,7 +481,7 @@ async function getYjglList(req, res, next) { ...@@ -481,7 +481,7 @@ async function getYjglList(req, res, next) {
let offset = (page - 1) * limit; let offset = (page - 1) * limit;
let search = {}; let search = {};
search.order = [['createdAt', 'DESC']]; search.order = [['id', 'DESC']];
search.limit = limit; search.limit = limit;
search.offset = offset; search.offset = offset;
......
...@@ -4,100 +4,105 @@ const moment = require('moment'); ...@@ -4,100 +4,105 @@ const moment = require('moment');
//投中管理- 建设期投资检查 //投中管理- 建设期投资检查
const RcTwhgl = sequelize.define('RcTwhgl', { const RcTwhgl = sequelize.define('RcTwhgl', {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
primaryKey: true, primaryKey: true,
autoIncrement: true autoIncrement: true
}, },
meetingCode: {
type: DataTypes.STRING(50),
allowNull: false,
comment: '会议编号'
},
meetingName: {
type: DataTypes.STRING(200),
allowNull: false,
comment: '会议名称'
},
meetingDate: {
type: DataTypes.DATE,
allowNull: false,
comment: '会议时间',
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
meetingLocation: {
type: DataTypes.STRING(200),
allowNull: true,
comment: '会议地点'
},
meetingLevel: {
type: DataTypes.STRING,
comment: '会议层级:company-公司级,department-部门级,project-项目级'
},
attendingLeaders: {
type: DataTypes.STRING(500),
allowNull: true,
comment: '参会领导'
},
attendingDepartments: {
type: DataTypes.STRING(500),
allowNull: true,
comment: '参会部门'
},
meetingMinutesAttachment: {
type: DataTypes.JSON,
allowNull: true,
comment: '会议纪要附件路径'
},
meetingCode: {
type: DataTypes.STRING(50),
allowNull: false,
comment: '会议编号'
},
meetingName: {
type: DataTypes.STRING(200),
allowNull: false,
comment: '会议名称'
},
meetingDate: {
type: DataTypes.DATE,
allowNull: false,
comment: '会议时间'
},
meetingLocation: {
type: DataTypes.STRING(200),
allowNull: true,
comment: '会议地点'
},
meetingLevel: {
type: DataTypes.STRING,
comment: '会议层级:company-公司级,department-部门级,project-项目级'
},
attendingLeaders: {
type: DataTypes.STRING(500),
allowNull: true,
comment: '参会领导'
},
attendingDepartments: {
type: DataTypes.STRING(500),
allowNull: true,
comment: '参会部门'
},
meetingMinutesAttachment: {
type: DataTypes.JSON,
allowNull: true,
comment: '会议纪要附件路径'
},
// sourceId: {
// sourceId: { // type: DataTypes.INTEGER,
// type: DataTypes.INTEGER, // comment: "所属主表id"
// comment: "所属主表id" // },
// }, // projectId: {
// projectId: { // type: DataTypes.INTEGER,
// type: DataTypes.INTEGER, // comment: "所属项目ID",
// comment: "所属项目ID", // },
// }, del: {
del: { type: DataTypes.INTEGER,
type: DataTypes.INTEGER, defaultValue: 0,
defaultValue: 0, comment: "0 正常 1 删除"
comment: "0 正常 1 删除" },
}, creator: {
creator: { type: DataTypes.INTEGER,
type: DataTypes.INTEGER, comment: "创建人"
comment: "创建人" },
}, createdAt: {
createdAt: { type: DataTypes.DATE,
type: DataTypes.DATE, defaultValue: new Date(),
defaultValue: new Date(), get() {
get() { const rawValue = this.getDataValue('createdAt');
const rawValue = this.getDataValue('createdAt'); return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : ''; }
} },
}, updatedAt: { // 同样处理 updatedAt
updatedAt: { // 同样处理 updatedAt type: DataTypes.DATE,
type: DataTypes.DATE, defaultValue: new Date(),
defaultValue: new Date(), get() {
get() { const rawValue = this.getDataValue('updatedAt');
const rawValue = this.getDataValue('updatedAt'); return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
} }
}
}, { }, {
tableName: 'jt_rc_twhgl', // 指定表名(如果与模型名不同) tableName: 'jt_rc_twhgl', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置) timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
}); });
// 同步模型到数据库(创建表) // 同步模型到数据库(创建表)
RcTwhgl.sync({ RcTwhgl.sync({
// force: false, // force: false,
// force: true ,//会删除已存在表并重新创建 // force: true ,//会删除已存在表并重新创建
alter: true alter: true
}) })
.then(() => { .then(() => {
console.log('RcTwhgl 表同步成功'); console.log('RcTwhgl 表同步成功');
}); });
module.exports = RcTwhgl; module.exports = RcTwhgl;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment