明树Git Lab

Commit 370c50af authored by zfp1's avatar zfp1

update

parent ce22feb2
......@@ -15,6 +15,14 @@ const Position = require("./model/system/position");
const Project = require("./model/jt/project");
const Resources = require("./model/jt/resources");
const ResourcesInfo = require("./model/jt/resourcesInfo");
const ProjectBjtj = require("./model/jt/projectBjtj");
const ProjectCwpjzb = require("./model/jt/projectCwpjzb");
const ProjectFile = require("./model/jt/projectFile");
const ProjectGdxx = require("./model/jt/projectGdxx");
const ProjectJsgm = require("./model/jt/projectJsgm");
const ProjectSpyj = require("./model/jt/projectSpyj");
const ProjectXmtzze = require("./model/jt/projectXmtzze");
/**
* 业务表
......@@ -36,6 +44,13 @@ global.DB = {
Project,
Resources,
ResourcesInfo,
ProjectBjtj,
ProjectCwpjzb,
ProjectFile,
ProjectGdxx,
ProjectJsgm,
ProjectSpyj,
ProjectXmtzze,
}
......@@ -107,3 +122,26 @@ Position.belongsToMany(User, {
Resources.hasMany(ResourcesInfo, { foreignKey: 'resourceId', as: 'resourcesInfos' });
ResourcesInfo.belongsTo(Resources, { foreignKey: 'resourceId' });
/**项目-核心边界条件 1:n */
Project.hasMany(ProjectBjtj, { foreignKey: 'projectId', as: 'projectBjtjs' });
ProjectBjtj.belongsTo(Project, { foreignKey: 'projectId' });
/**项目-财务评价指标 1:n */
Project.hasMany(ProjectCwpjzb, { foreignKey: 'projectId', as: 'projectCwpjzbs' });
ProjectCwpjzb.belongsTo(Project, { foreignKey: 'projectId' });
/**项目-项目附件 1:n */
Project.hasMany(File, { through: 'jt_project_file', foreignKey: 'projectId', as: 'files', otherKey: 'fileId' });
File.belongsTo(Project, { through: 'jt_project_file', foreignKey: 'fileId', otherKey: 'projectId' });
/**项目-股东信息 1:n */
Project.hasMany(ProjectGdxx, { foreignKey: 'projectId', as: 'projectGdxxs' });
ProjectGdxx.belongsTo(Project, { foreignKey: 'projectId' });
/**项目-建设规模 1:n */
Project.hasMany(ProjectJsgm, { foreignKey: 'projectId', as: 'projectJsgms' });
ProjectJsgm.belongsTo(Project, { foreignKey: 'projectId' });
/**项目-审批意见 1:n */
Project.hasMany(ProjectSpyj, { foreignKey: 'projectId', as: 'projectSpyjs' });
ProjectSpyj.belongsTo(Project, { foreignKey: 'projectId' });
/**项目-项目投资总额 1:n */
Project.hasMany(ProjectXmtzze, { foreignKey: 'projectId', as: 'projectXmtzzes' });
ProjectXmtzze.belongsTo(Project, { foreignKey: 'projectId' });
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const Project = require('./project');
// 核心边界条件
const projectBjtj = sequelize.define('projectBjtj', {
id: {
......@@ -75,6 +75,10 @@ const projectBjtj = sequelize.define('projectBjtj', {
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
references: {
model: Project, // 关联的表名
key: 'id', // 关联的字段
}
},
del: {
......
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
// 建设规模
// 股东信息
const projectGdxx = sequelize.define('projectGdxx', {
// 定义字段
id: {
type: DataTypes.INTEGER,
primaryKey: true,
......
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