1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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"` // 创建时间
- }
- // Update 更新基础信息
- 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`
- // GetConfigDetailByCode 获取详情
- 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
- }
- // GetDefaultConfigDetailByCode 获取默认配置详情
- 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
- }
- // SetAdminConfigReq 设置用户的配置
- type SetAdminConfigReq struct {
- ConfigCode string `description:"配置编码"`
- ConfigValue string `description:"配置值"`
- }
|