sys_config.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package system
  2. import (
  3. "hongze/fms_api/global"
  4. "time"
  5. )
  6. const (
  7. ConfigKeyCrmPermissionFiccClassify = "crm_permission_ficc_classify"
  8. )
  9. // SysConfig 系统配置
  10. type SysConfig struct {
  11. ConfigId int `gorm:"primaryKey;column:config_id" json:"config_id" description:"配置ID"`
  12. ConfigCode string `gorm:"column:config_code" json:"config_code" description:"配置编码"`
  13. ConfigValue string `gorm:"column:config_value" json:"config_value" description:"配置值"`
  14. Remark string `gorm:"column:remark" json:"remark" description:"备注信息"`
  15. CreateTime time.Time `gorm:"column:create_time" json:"create_time" description:"创建时间"`
  16. }
  17. func (c *SysConfig) TableName() string {
  18. return "sys_config"
  19. }
  20. func (c *SysConfig) Update(updateCols []string) (err error) {
  21. err = global.DEFAULT_MYSQL.Model(c).Select(updateCols).Updates(c).Error
  22. return
  23. }
  24. func (c *SysConfig) FetchByCondition(condition string, pars []interface{}) (item *SysConfig, err error) {
  25. err = global.DEFAULT_MYSQL.Model(c).
  26. Where(condition, pars...).
  27. First(&item).Error
  28. return
  29. }