liujiandao
2023-12-22 f26ee7ab795bb21be7d31dc2cca1e7a206ef4b8b
model/system_set.go
@@ -8,10 +8,10 @@
type (
   SystemSet struct {
      Id         int    `json:"id" gorm:"column:id;primaryKey;autoIncrement;not null"`
      Name       string `json:"name" gorm:"type:varchar(255);comment:名称"`
      Value      string `json:"value" gorm:"type:varchar(255);comment:值"`
      SystemType string `json:"systemType" gorm:"type:varchar(255);comment:系统类型"`
      Id       int    `json:"id" gorm:"column:id;primaryKey;autoIncrement;not null"`
      Name     string `json:"name" gorm:"type:varchar(255);comment:名称"`
      Value    string `json:"value" gorm:"type:varchar(255);comment:值"`
      ModeType string `json:"modeType" gorm:"type:varchar(255);comment:模块类型"`
   }
   SystemSetSearch struct {
      SystemSet
@@ -40,6 +40,10 @@
   slf.Name = name
   return slf
}
func (slf *SystemSetSearch) SetModeType(modeType string) *SystemSetSearch {
   slf.ModeType = modeType
   return slf
}
func (slf *SystemSetSearch) build() *gorm.DB {
   var db = slf.Orm.Table(slf.TableName())
@@ -50,6 +54,9 @@
   if slf.Name != "" {
      db = db.Where("name = ?", slf.Name)
   }
   if slf.ModeType != "" {
      db = db.Where("mode_type = ?", slf.ModeType)
   }
   return db
}