12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package system
- import (
- "eta_gn/eta_api/global"
- "time"
- )
- type AdminConfig struct {
- ConfigId int `gorm:"primaryKey;column:config_id;type:int(11);not null"`
- AdminId int `gorm:"column:admin_id;type:int(11);not null;default:0"` // 系统客户id
- ConfigCode string `gorm:"column:config_code;type:varchar(50);default:''"` // 配置编码
- ConfigValue string `gorm:"column:config_value;type:text"` // 配置值
- Remark string `gorm:"column:remark;type:varchar(255);default:''"` // 备注信息
- CreateTime time.Time `gorm:"column:create_time;type:datetime"` // 创建时间
- }
- func (item *AdminConfig) Update(cols []string) (err error) {
- err = global.DEFAULT_DmSQL.Select(cols).Updates(item).Error
- return
- }
- func (item *AdminConfig) Create() (err error) {
- err = global.DEFAULT_DmSQL.Create(item).Error
- return
- }
- var EdbLanguageVar = `edb_language`
- var PredictEdbLanguageVar = `predict_edb_language`
- var ChartLanguageVar = `chart_language`
- func GetConfigDetailByCode(adminId int, configCode string) (item *AdminConfig, err error) {
- sql := ` SELECT * FROM admin_config WHERE admin_id = ? AND config_code=? `
- err = global.DEFAULT_DmSQL.Raw(sql, adminId, configCode).First(&item).Error
- return
- }
- func GetDefaultConfigDetailByCode(configCode string) (item *AdminConfig, err error) {
- sql := ` SELECT * FROM admin_config WHERE admin_id = ? AND config_code=? `
- err = global.DEFAULT_DmSQL.Raw(sql, 0, configCode).First(&item).Error
- return
- }
- type SetAdminConfigReq struct {
- ConfigCode string `description:"配置编码"`
- ConfigValue string `description:"配置值"`
- }
|