Fix option list bug

pull/146/head
johnniang 2019-04-25 10:16:35 +08:00
parent 4819a9824f
commit e854626366
4 changed files with 16 additions and 8 deletions

View File

@ -1,6 +1,5 @@
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;

View File

@ -1,7 +1,7 @@
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> {
}

View File

@ -1,9 +1,12 @@
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;
}
}

View File

@ -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()