|
|
@@ -6,6 +6,7 @@ import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.base.entity.NewsInfo;
|
|
|
import com.jpsoft.employment.modules.base.service.NewsInfoService;
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -24,6 +25,9 @@ public class NewsInfoController {
|
|
|
|
|
|
@Autowired
|
|
|
private NewsInfoService newsInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
|
|
|
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@@ -49,6 +53,7 @@ public class NewsInfoController {
|
|
|
newsInfo.setDelFlag(false);
|
|
|
newsInfo.setCreateBy(subject);
|
|
|
newsInfo.setCreateTime(new Date());
|
|
|
+ newsInfo.setBrowseNumber(0);
|
|
|
|
|
|
int affectCount = newsInfoService.insert(newsInfo);
|
|
|
|
|
|
@@ -195,7 +200,7 @@ public class NewsInfoController {
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
- String id,
|
|
|
+ String title,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
HttpServletRequest request){
|
|
|
@@ -209,15 +214,22 @@ public class NewsInfoController {
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ if (StringUtils.isNotEmpty(title)) {
|
|
|
+ searchParams.put("title","%" + title + "%");
|
|
|
}
|
|
|
|
|
|
|
|
|
Page<NewsInfo> page = newsInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
+ for (NewsInfo newsInfo:page) {
|
|
|
+ String category = dataDictionaryService.findNameByCatalogNameAndValue("新闻类型",newsInfo.getCategory());
|
|
|
+ if(StringUtils.isNotEmpty(category)){
|
|
|
+ newsInfo.setCategoryN(category);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|