build / build-push (push) Successful in 1m28s
- 契约对齐 YschTheme《主题设置与通道改动》§3.5:读已登录可开放且可空不兜底(与 getSchSettings 的 default-theme 兜底语义刻意区分);写仅学校管理员/超管(权限先例照抄 UserSettingsServiceImpl.findSchWallpaperManageList:type==1 或 OtherUtil.isAdminById(roleId));清空=置空 theme 字段(sch_settings 行还承载 logo 等配置不能删行,置空后读侧 null,效果与删行等价) - 存储形态:theme_name 列存紧凑四段编码 theme|sideDeep01|gradOn01|sideFollow01(如 teal|0|1|1)——不拆列零 DDL;列宽未确认故不存整份 JSON;读侧只认该格式,旧档名/脏值一律视同未配置(防旧库值意外生效);写入侧四字段校验从严 - schId 解析:超管=显式参数或 0(平台默认层);其余=当前角色学校(UserCurrentRole),兜底主归属 - ISchSettingsService 新增 findBySchIdRaw(无兜底原样读,可空语义专用);既有 saveSchTheme/saveSchLogo/getSchSettings 不动(无其他调用方,影响面零)
50 lines
1.6 KiB
Java
50 lines
1.6 KiB
Java
package com.yunhai.userhome.service.impl;
|
|
|
|
import com.yunhai.userhome.entity.SchSettings;
|
|
import com.yunhai.userhome.repository.SchSettingsRepository;
|
|
import com.yunhai.userhome.service.ISchSettingsService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.Optional;
|
|
|
|
/**
|
|
* 学校设置服务:学校设置完全本地化(sch_settings 表),不再依赖跨仓 schConfig。
|
|
* <p>findBySchId 直接查本地表,查不到兜底默认主题;saveSchTheme/saveSchLogo 写本地表即可闭环。</p>
|
|
*/
|
|
@Service
|
|
public class SchSettingsServiceImpl implements ISchSettingsService {
|
|
|
|
@Autowired
|
|
private SchSettingsRepository schSettingsRepository;
|
|
|
|
@Override
|
|
public void save(SchSettings schSettings) {
|
|
schSettingsRepository.save(schSettings);
|
|
}
|
|
|
|
@Override
|
|
public Optional<SchSettings> findBySchIdRaw(Integer schId) {
|
|
return schSettingsRepository.findFirstBySchId(schId);
|
|
}
|
|
|
|
@Override
|
|
public Optional<SchSettings> findBySchId(Integer schId) {
|
|
Optional<SchSettings> local = schSettingsRepository.findFirstBySchId(schId);
|
|
if (local.isPresent()) {
|
|
return local;
|
|
}
|
|
SchSettings def = new SchSettings();
|
|
def.setSchId(schId);
|
|
def.setThemeName("default-theme");
|
|
def.setAppBgUrl("");
|
|
def.setLogoUrl("");
|
|
return Optional.of(def);
|
|
}
|
|
|
|
@Override
|
|
public java.util.List<SchSettings> findBySchIds(java.util.List<Integer> schId) {
|
|
return schSettingsRepository.getSchSettingList(schId);
|
|
}
|
|
}
|