Commit 98bb99f3 authored by 赵啸非's avatar 赵啸非

添加新闻来源

parent 9c908849
Pipeline #2380 canceled with stages
package com.mortals.xhx.module.hotword.service.impl;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -6,6 +7,8 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.hotword.dao.HotwordDao;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.service.HotwordService;
import org.springframework.util.ObjectUtils;
/**
* HotwordService
* 热门词汇业务 service实现
......@@ -15,5 +18,5 @@ import com.mortals.xhx.module.hotword.service.HotwordService;
*/
@Service("hotwordService")
public class HotwordServiceImpl extends AbstractCRUDServiceImpl<HotwordDao, HotwordEntity, Long> implements HotwordService {
}
\ No newline at end of file
package com.mortals.xhx.module.hotword.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.NewsSourceEnum;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -51,4 +54,14 @@ public class HotwordController extends BaseCRUDJsonBodyMappingController<Hotword
this.addDict(model, "newsSource", NewsSourceEnum.getEnumMap());
super.init(model, context);
}
@Override
protected void saveBefore(HotwordEntity entity, Map<String, Object> model, Context context) throws AppException {
HotwordEntity hotwordEntity = this.service.selectOne(new HotwordQuery().siteId(entity.getSiteId()));
if(!ObjectUtils.isEmpty(hotwordEntity)){
entity.setId(hotwordEntity.getId());
}
super.saveBefore(entity, model, context);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment