mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-22 18:29:51 +08:00
增加全局配置
This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user