提交 e8546263 编写于 作者: J johnniang

Fix option list bug

上级 4819a982
package run.halo.app.model.properties;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
......
package run.halo.app.service;
import run.halo.app.model.entity.Journal;
import run.halo.app.service.base.CrudService;
import run.halo.app.service.base.BaseCommentService;
/**
* Journal service interface.
......@@ -9,6 +9,6 @@ import run.halo.app.service.base.CrudService;
* @author johnniang
* @date 19-4-24
*/
public interface JournalService extends CrudService<Journal, Long> {
public interface JournalService extends BaseCommentService<Journal> {
}
package run.halo.app.service.impl;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import run.halo.app.model.entity.Journal;
import run.halo.app.repository.JournalRepository;
import run.halo.app.repository.PostRepository;
import run.halo.app.service.JournalService;
import run.halo.app.service.base.AbstractCrudService;
import run.halo.app.service.OptionService;
/**
* Journal service implementation.
......@@ -11,12 +14,16 @@ import run.halo.app.service.base.AbstractCrudService;
* @author johnniang
* @date 19-4-24
*/
public class JournalServiceImpl extends AbstractCrudService<Journal, Long> implements JournalService {
@Service
public class JournalServiceImpl extends BaseCommentServiceImpl<Journal> implements JournalService {
private final JournalRepository journalRepository;
public JournalServiceImpl(JournalRepository journalRepository) {
super(journalRepository);
public JournalServiceImpl(JournalRepository journalRepository,
PostRepository postRepository,
OptionService optionService,
ApplicationEventPublisher eventPublisher) {
super(journalRepository, postRepository, optionService, eventPublisher);
this.journalRepository = journalRepository;
}
}
......@@ -130,7 +130,7 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
Set<String> keys = ServiceUtils.fetchProperty(options, Option::getKey);
Map<String, Object> result = ServiceUtils.convertToMap(options, Option::getKey, option -> {
Map<String, Object> userDefinedOptionMap = ServiceUtils.convertToMap(options, Option::getKey, option -> {
String key = option.getKey();
PropertyEnum propertyEnum = propertyEnumMap.get(key);
......@@ -142,6 +142,8 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
return PropertyEnum.convertTo(option.getValue(), propertyEnum);
});
Map<String, Object> result = new HashMap<>(userDefinedOptionMap);
// Add default property
propertyEnumMap.keySet()
.stream()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册