调整栏目查询异常
This commit is contained in:
parent
cbba37e4dc
commit
c07bdfd6c7
|
|
@ -95,7 +95,7 @@ public interface NewsMapper {
|
|||
"news.title like concat('%', #{keyword}, '%') " +
|
||||
"</if>" +
|
||||
"<if test=\"column != null\">" +
|
||||
"and news_column_rel.column_id in (#{column}) " +
|
||||
"and news_column_rel.column_id in (${column}) " +
|
||||
"</if>" +
|
||||
"<if test=\"status != null\">" +
|
||||
"and news.status = #{status} " +
|
||||
|
|
@ -129,7 +129,7 @@ public interface NewsMapper {
|
|||
"news.title like concat('%', #{keyword}, '%') " +
|
||||
"</if>" +
|
||||
"<if test=\"column != null\">" +
|
||||
"and news_column_rel.column_id in (#{column}) " +
|
||||
"and news_column_rel.column_id in (${column}) " +
|
||||
"</if>" +
|
||||
"<if test=\"status != null\">" +
|
||||
"and news.status = #{status} " +
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
|
@ -546,6 +547,17 @@ public class NewsService {
|
|||
offset = (Math.max(0, page - current)) * size;
|
||||
}
|
||||
|
||||
if (StringUtils.hasText(columnParam)) {
|
||||
String[] split = columnParam.split(",");
|
||||
for (String item : split) {
|
||||
try {
|
||||
Integer.parseInt(item);
|
||||
} catch (NumberFormatException e) {
|
||||
return PageObject.failedPage(400, "栏目列表ID异常! column = " + columnParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<News> newsList;
|
||||
try {
|
||||
newsList = newsMapper.queryNews(keyword, columnParam, status, last, orderBy, direction, size, offset);
|
||||
|
|
|
|||
Loading…
Reference in New Issue