新增 - 表

This commit is contained in:
suwings 2018-04-27 21:37:19 +08:00
parent 97c21de9b7
commit e76e66466d

39
model/Table.js Normal file
View File

@ -0,0 +1,39 @@
//表实体
class Table {
constructor(tableName) {
this.tableName = tableName;
this._objs = {};
}
setItem(k, v = null) {
this._objs[k] = v;
}
addItem(k, v = null) {
if (this._objs[k])
throw new Error("ADD_ITEM_ERROR: This is not null!");
else
this._objs[k] = v;
}
delItem(k, v = null) {
delete this._objs[k];
}
toString() {
return JSON.stringify(this._objs);
}
}
//权限表实体
class PermissionTable extends Table {
constructor(tableName) {
super(tableName);
}
}
module.exports = {
PermissionTable,
Table
}