feat:完善项目

This commit is contained in:
henry
2022-01-14 17:09:06 +08:00
parent cf68cfbd96
commit 9a41d7ff12
16 changed files with 646 additions and 38 deletions

View File

@ -225,6 +225,8 @@ func FirstWhere(model IModel, where ...*ModelWhere) (bool, error) {
for _, wo := range where {
db = db.Where(wo.Condition, wo.Value)
}
} else {
db = db.Where(fmt.Sprintf("%s = %d", FieldsForID, model.GetID()))
}
if db.Migrator().HasColumn(model, FieldsForDeleted) {
db = db.Where(FieldsForDeleted, DeleteStatusForNot)
@ -245,6 +247,8 @@ func FirstField(model IModel, fields []string, where ...*ModelWhere) (bool, erro
for _, wo := range where {
db = db.Where(wo.Condition, wo.Value)
}
} else {
db = db.Where(fmt.Sprintf("%s = %d", FieldsForID, model.GetID()))
}
if db.Migrator().HasColumn(model, FieldsForDeleted) {
db = db.Where(FieldsForDeleted, DeleteStatusForNot)