提交 0c099ccf authored 作者: zhouzhigang's avatar zhouzhigang

专题

上级 e9bf23ac
......@@ -17,4 +17,9 @@ public class QueryPopupResourceListForm {
@ApiModelProperty("专题id")
private String specialId;
@ApiModelProperty(value = "民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
}
......@@ -23,9 +23,42 @@ public interface SpecialResourceRelationMapper extends BaseMapper<SpecialResourc
"</if>"
+ "<if test = '" + NOTBLANK + "(form.resourceName)'>"
+ "and a.title like concat('%',#{form.resourceName},'%') "
+ "</if>"
+ "<if test = 'form.nationsType != null'>"
+ "and a.nationsType = #{form.nationsType} "
+ "</if>"
+ "<if test='ids != null and ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"+
"</script>")
List<PopupResourceListVo> popupPage(@Param("form") QueryPopupResourceListForm form);
List<PopupResourceListVo> popupPage(@Param("form") QueryPopupResourceListForm form,@Param("ids")List<String> ids);
@Select("<script>" +
" SELECT DISTINCT a.id as resourceId, a.name as resourceName,a.author,a.resourceType,a.status,e.uploadTime from res_book a " +
"LEFT JOIN res_ebook e ON a.id = e.id " +
" where 1=1 " +
"<if test = ' form.resourceType != null '>" +
" and a.resourceType = #{form.resourceType} " +
"</if>"
+ "<if test = '" + NOTBLANK + "(form.resourceName)'>"
+ "and a.title like concat('%',#{form.resourceName},'%') "
+ "</if>"
+ "<if test = 'form.nationsType != null'>"
+ "and a.nationsType = #{form.nationsType} "
+ "</if>"
+ "<if test='ids != null and ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"+
"</script>")
List<PopupResourceListVo> popupBookPage(@Param("form") QueryPopupResourceListForm form,@Param("ids") List<String> ids);
@Select("<script>" +
......
......@@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -69,16 +70,20 @@ public class SpecialResourceRelationServiceImpl extends BaseServiceImpl<SpecialR
pageParam.setOrderBy(" uploadTime desc ");
}
startPage(pageParam);
List<PopupResourceListVo> list = specialResourceRelationMapper.popupPage(form);
List<PopupResourceListVo> list;
List<String> ids = new ArrayList<>();
if(voList != null && voList.size() > 0){
ids = voList.stream().map(SpecialResourceRelation::getResourceId).collect(Collectors.toList());
}
//图书
if(1 == form.getResourceType().intValue()){
list = specialResourceRelationMapper.popupBookPage(form,ids);
}else{
list = specialResourceRelationMapper.popupPage(form,ids);
}
list.forEach(vo ->{
vo.setStatus_zh(LibraryStatusEnum.getName(vo.getStatus()));
});
if(voList != null && voList.size() > 0){
//过滤掉已经绑定的资源
List<PopupResourceListVo> relationList =list.stream()
.filter(v -> !voList.contains(v.getResourceId())).collect(Collectors.toList());
return new PageInfo<>(relationList);
}
return new PageInfo<>(list);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论