Commit 625b0a0c by 吴迪

【修改】高级查询修改

parent 9cd35792
...@@ -535,7 +535,7 @@ public class NewsController extends AbstractController { ...@@ -535,7 +535,7 @@ public class NewsController extends AbstractController {
@RequestMapping("/api/getSearchInfo") @RequestMapping("/api/getSearchInfo")
// @RequiresPermissions("manage:product:findPage") // @RequiresPermissions("manage:product:findPage")
public R getSearchInfo(@RequestBody Map<String, String> param) { public R getSearchInfo(@RequestBody Map<String, String> param) {
Page<SearchVo> pag = this.newsService.getSearchInfo(param.get("name") == null ? null : param.get("name"), Page<SearchVo> pag = this.newsService.getSearchInfo(param.get("name") == null ? null : param.get("name"),param.get("type") == null ? null : param.get("type"),
new Page(Integer.valueOf(param.get("page")), new Page(Integer.valueOf(param.get("page")),
Integer.valueOf(param.get("size")))); Integer.valueOf(param.get("size"))));
PageUtils pageUtils = new PageUtils(pag); PageUtils pageUtils = new PageUtils(pag);
......
...@@ -94,5 +94,5 @@ public interface NewsDao extends BaseMapper<NewsEntity> { ...@@ -94,5 +94,5 @@ public interface NewsDao extends BaseMapper<NewsEntity> {
List<NewsEntity> relatedLinks(Map<String, Object> params); List<NewsEntity> relatedLinks(Map<String, Object> params);
List<SearchVo> getSearchInfo(@Param("name") String name, Page page); List<SearchVo> getSearchInfo(@Param("name") String name,@Param("type") String type, Page page);
} }
...@@ -92,6 +92,6 @@ public interface NewsService extends IService<NewsEntity> { ...@@ -92,6 +92,6 @@ public interface NewsService extends IService<NewsEntity> {
List<NewsEntity> relatedLinks(Map<String, Object> params); List<NewsEntity> relatedLinks(Map<String, Object> params);
Page<SearchVo> getSearchInfo(String name, Page page); Page<SearchVo> getSearchInfo(String name,String type, Page page);
} }
...@@ -542,12 +542,20 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements ...@@ -542,12 +542,20 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
@Override @Override
public Page<SearchVo> getSearchInfo(String name, Page page) { public Page<SearchVo> getSearchInfo(String name, String type,Page page) {
List<SearchVo> list = this.newsDao.getSearchInfo(name, page);
if(CollectionUtils.isNotEmpty(list)) {
for (SearchVo searchVo : list) {
if(StringUtils.isNotBlank(type)&&type.indexOf(",")>-1) {
String[] splitStr = type.split(",");
String finalStr = "";
for (String s : splitStr) {
finalStr=s+",";
}
type= finalStr.substring(0,finalStr.length()-1);
}
List<SearchVo> list = this.newsDao.getSearchInfo(name, type,page);
if(CollectionUtils.isNotEmpty(list)) {
for (SearchVo searchVo : list) {
if(StringUtils.isNotBlank(searchVo.getContent())) { if(StringUtils.isNotBlank(searchVo.getContent())) {
searchVo.setContent(searchVo.getContent().replaceAll(name,"<font color='red'>"+name+"</font>")); searchVo.setContent(searchVo.getContent().replaceAll(name,"<font color='red'>"+name+"</font>"));
} }
......
...@@ -611,9 +611,16 @@ order by releasedate desc ...@@ -611,9 +611,16 @@ order by releasedate desc
<select id="getSearchInfo" parameterType="string" resultType="io.office.modules.manage.vo.response.SearchVo"> <select id="getSearchInfo" parameterType="string" resultType="io.office.modules.manage.vo.response.SearchVo">
select * from NewsSearch select * from NewsSearch
<where>
<if test="name!=null and name!=''"> <if test="name!=null and name!=''">
where (title like concat('%',#{name},'%') or keyword like concat('%',#{name},'%') or content like concat('%',#{name},'%')) (title like concat('%',#{name},'%') or keyword like concat('%',#{name},'%') or content like concat('%',#{name},'%'))
</if> </if>
<if test="type!=null and type!=''">
and type in (${type})
</if>
</where>
</select> </select>
......
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