作者 tangxuhui

数据结构调整

... ... @@ -52,6 +52,8 @@ func (systemSettingService *SystemSettingService) GetSystemSetting(getSystemSett
}
defaultSet[0].CompanyId = getSystemSettingQuery.CompanyId
systemSetting = defaultSet[0]
} else {
systemSetting = *systemSettings[0]
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -147,21 +149,20 @@ func (systemSettingService *SystemSettingService) UpdateSystemSetting(updateSyst
//未找到历史数据,使用默认配置
defaultSet := new(domain.SystemSetting).GetDefaultSetting(updateSystemSettingCommand.SettingCode)
if len(defaultSet) > 0 {
systemSetting = &defaultSet[0]
*systemSetting = defaultSet[0]
systemSetting.CompanyId = updateSystemSettingCommand.CompanyId
}
} else {
systemSetting = systemSettings[0]
}
if systemSetting == nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, "settingCode错误,settingCode="+updateSystemSettingCommand.SettingCode)
}
if err := systemSetting.Update(map[string]interface{}{
"value": updateSystemSettingCommand.Value,
}); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
}
if systemSetting == nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, "settingCode错误,settingCode="+updateSystemSettingCommand.SettingCode)
}
if systemSetting, err := systemSettingRepository.Save(systemSetting); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ...
... ... @@ -3,7 +3,7 @@ package domain
// 系统参数设置
type SystemSetting struct {
// 公司id
CompanyId int64 `json:"companyId"`
CompanyId int64 `json:"companyId,string"`
// 管控层级
ControlLevel string `json:"controlLevel"`
// 描述
... ... @@ -13,7 +13,7 @@ type SystemSetting struct {
// 设置对应的名称
SettingName string `json:"settingName"`
// 数据id
SystemSettingId int64 `json:"systemSettingId"`
SystemSettingId int64 `json:"systemSettingId,string"`
// 设定的值
Value string `json:"value"`
// 值类型
... ...