增加全局配置

This commit is contained in:
none
2023-03-09 13:58:51 +08:00
parent 82f0783cb8
commit 908b35f3de
10 changed files with 155 additions and 63 deletions

View File

@@ -3,6 +3,8 @@ package xyz.playedu.api.service;
import xyz.playedu.api.domain.AppConfig;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
* @author tengteng
* @description 针对表【app_config】的数据库操作Service
@@ -10,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface AppConfigService extends IService<AppConfig> {
Map<String, Long> allKeys();
}

View File

@@ -6,15 +6,22 @@ import xyz.playedu.api.service.AppConfigService;
import xyz.playedu.api.mapper.AppConfigMapper;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author tengteng
* @description 针对表【app_config】的数据库操作Service实现
* @createDate 2023-03-09 11:13:33
*/
* @author tengteng
* @description 针对表【app_config】的数据库操作Service实现
* @createDate 2023-03-09 11:13:33
*/
@Service
public class AppConfigServiceImpl extends ServiceImpl<AppConfigMapper, AppConfig>
implements AppConfigService{
implements AppConfigService {
@Override
public Map<String, Long> allKeys() {
return list().stream().collect(Collectors.toMap(AppConfig::getKeyName, AppConfig::getId));
}
}

View File

@@ -152,16 +152,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
public void updateWithCategoryIdsAndDepIds(Course course, String title, String thumb, Integer isShow, Integer[] categoryIds, Integer[] depIds) {
Course newCourse = new Course();
newCourse.setId(course.getId());
if (!course.getTitle().equals(title)) {
newCourse.setTitle(title);
}
if (!course.getThumb().equals(thumb)) {
newCourse.setThumb(thumb);
}
if (!course.getIsShow().equals(isShow)) {
newCourse.setIsShow(isShow);
}
newCourse.setTitle(title);
newCourse.setThumb(thumb);
newCourse.setIsShow(isShow);
updateById(newCourse);