提交 39c60e75 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 d7a445a8
package com.zrqx.sysuser.bg.controller.permissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;
......@@ -25,8 +22,6 @@ import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.misc.BASE64Encoder;
import com.zrqx.core.constant.sysuser.SysUserRequestPath;
import com.zrqx.core.enums.ResponseCodeEnum;
import com.zrqx.core.enums.StatusEnum;
......@@ -43,6 +38,10 @@ import com.zrqx.sysuser.bg.service.modulepower.ModulepowerService;
import com.zrqx.sysuser.bg.service.operatepower.OperatepowerService;
import com.zrqx.sysuser.bg.service.user.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import sun.misc.BASE64Encoder;
/**
* 登录Controller
*/
......
......@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.sysuser.SysUserRequestPath;
import com.zrqx.core.form.resource.fg.pc.index.Pc_FgQueryForm;
import com.zrqx.core.model.sysuser.news.News;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
......@@ -38,6 +39,7 @@ public class FgNewsController {
@GetMapping(value = SysUserRequestPath.LIST)
public CallBack<List<FgIndexNewsListVO>> getListPage(){
List<FgIndexNewsListVO> list=service.list();
this.regEx(list);
return CallBack.success(list);
}
......@@ -59,4 +61,46 @@ public class FgNewsController {
return CallBack.success(new PageInfo<FgSearchListVO>(list));
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
private void regEx(List<FgIndexNewsListVO> list){
if(ArrayUtils.isNotEmpty(list)){
list.forEach(li -> {
if(StringUtils.isNotBlank(li.getContentSummary())){
li.setContentSummary(removeLabel(li.getContentSummary()));
}
});
}
}
/**
* 去标签
* @param list
* @author ycw
* @date: 2019年4月18日 上午11:57:55
*/
private String removeLabel(String text){
if(StringUtils.isNotBlank(text)){
//vo.setSummary(vo.getSummary().replaceAll("\\<.*?>", ""));
//定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>";
//定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style>
String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>";
// 定义HTML标签的正则表达式
String regEx_html = "<[^>]+>";
// 定义一些特殊字符的正则表达式 如:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String regEx_special = "\\&[a-zA-Z]{1,10};";
text = text.replaceAll(regEx_script, "")
.replaceAll(regEx_style, "")
.replaceAll(regEx_html, "")
.replaceAll(regEx_special, "");
return text;
}
return null;
}
}
......@@ -18,12 +18,12 @@ import com.zrqx.core.vo.resource.fg.pc.index.FgSearchListVO;
public interface FgNewsMapper extends BaseMapper<News>{
@Select("<script>"
+ "select be.newsid id,be.newsTitle name,be.cover,be.newPulishDate,be.contentSummary FROM sys_news be "
+ "where be.newsIsRecommend=1 order by be.newPulishDate desc LIMIT 5"
+ "where be.newsIsRecommend=1 and be.newsStatus=1 order by be.newPulishDate desc LIMIT 5"
+ "</script>")
List<FgIndexNewsListVO> list();
@Select("<script>"
+ "select be.newsid id,be.newsTitle name,be.cover,be.newPulishDate,be.contentSummary synopsis,be.clickNumber FROM sys_news be "
+ "where be.newsIsRecommend=1"
+ "where 1=1 and be.newsStatus=1 "
+ "<if test = '"+ NOTBLANK +"(form.keywords)' >"
+ " and be.newsTitle like concat('%',#{form.keywords}, '%') "
+ "</if>"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论