Commit 4d393709 by 蒋勇

d

parent 61bcb046
...@@ -32,20 +32,22 @@ class DbFactory{ ...@@ -32,20 +32,22 @@ class DbFactory{
/*建立用户和角色之间的关系*/ /*建立用户和角色之间的关系*/
this.db.models.user.belongsToMany(this.db.models.role, {as:"Roles",through: 'p_userrole',constraints: false,}); this.db.models.user.belongsToMany(this.db.models.role, {as:"Roles",through: 'p_userrole',constraints: false,});
this.db.models.role.belongsToMany(this.db.models.user, {as:"Users",through: 'p_userrole',constraints: false,}); this.db.models.role.belongsToMany(this.db.models.user, {as:"Users",through: 'p_userrole',constraints: false,});
/*组织机构*/ /*组织机构自引用*/
this.db.models.org.belongsTo(this.db.models.org,{constraints: false,}); this.db.models.org.belongsTo(this.db.models.org,{constraints: false,});
this.db.models.org.hasMany(this.db.models.org,{constraints: false,}); this.db.models.org.hasMany(this.db.models.org,{constraints: false,});
//组织机构和角色是多对多关系 //组织机构和角色是多对多关系,建立兼职岗位,给岗位赋予多个角色,从而同步修改用户的角色
this.db.models.org.belongsTo(this.db.models.role,{constraints: false,}); //通过岗位接口去修改用户的角色
// this.db.models.role.belongsToMany(this.db.models.org,{through: this.db.models.orgrole,constraints: false,}); this.db.models.role.belongsToMany(this.db.models.org,{through: this.db.models.orgrole,constraints: false,});
this.db.models.org.belongsToMany(this.db.models.role,{through: this.db.models.orgrole,constraints: false,});
//组织机构和用户是多对多关系 //组织机构和用户是1对多,
this.db.models.user.belongsTo(this.db.models.org,{constraints: false,}); this.db.models.user.belongsTo(this.db.models.org,{constraints: false,});
this.db.models.org.hasMany(this.db.models.user,{constraints: false,});
this.db.models.user.belongsTo(this.db.models.app,{constraints: false,}); this.db.models.user.belongsTo(this.db.models.app,{constraints: false,});
this.db.models.role.belongsTo(this.db.models.app, {constraints: false,}); this.db.models.role.belongsTo(this.db.models.app, {constraints: false,});
this.db.models.org.belongsTo(this.db.models.app,{constraints: false,});
this.db.models.auth.belongsTo(this.db.models.app,{constraints: false,}); this.db.models.auth.belongsTo(this.db.models.app,{constraints: false,});
this.db.models.auth.belongsTo(this.db.models.company,{constraints: false,}); this.db.models.auth.belongsTo(this.db.models.company,{constraints: false,});
......
...@@ -46,7 +46,7 @@ module.exports = (db, DataTypes) => { ...@@ -46,7 +46,7 @@ module.exports = (db, DataTypes) => {
defaultValue: true defaultValue: true
}, },
opath:DataTypes.STRING,//作业务时,需要在业务表冗余当前处理人的opath opath:DataTypes.STRING,//作业务时,需要在业务表冗余当前处理人的opath
ppath:DataTypes.STRING,//权限路径,主岗下的人大于opath一级,查询时按照opath去查询 ptags:DataTypes.STRING,//权限标签,逗号分隔,可以按照标签查看opath中含有标签的数据
},{ },{
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: 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