buider
This commit is contained in:
@@ -40,11 +40,7 @@ const defaultFields = {
|
||||
onUpdate: Sequelize.literal('CURRENT_TIMESTAMP'),
|
||||
comment: '更新时间'
|
||||
},
|
||||
deleted_at: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '删除时间'
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -55,11 +51,7 @@ function extendModel(modelClass) {
|
||||
// 添加通用的查询方法
|
||||
modelClass.findAllActive = function(options = {}) {
|
||||
return this.findAll({
|
||||
...options,
|
||||
where: {
|
||||
...options.where,
|
||||
deleted_at: null
|
||||
}
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user