feat: Enhance news information query with full-text keyword search support
This commit is contained in:
@@ -26,7 +26,7 @@ public class AppNewsInfoController extends BaseController {
|
||||
@Autowired
|
||||
private INewsInfoService newsInfoService;
|
||||
|
||||
@ApiOperation("查询已上架新闻资讯列表")
|
||||
@ApiOperation("查询已上架新闻资讯列表(支持标题和正文全文关键字 LIKE 查询)")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(NewsInfoQuery query) {
|
||||
startPage();
|
||||
|
||||
@@ -17,9 +17,12 @@ public class NewsInfoQuery {
|
||||
@ApiModelProperty("每页条数")
|
||||
private Integer pageSize = 10;
|
||||
|
||||
@ApiModelProperty("标题关键词")
|
||||
@ApiModelProperty("标题关键词(兼容 CMS 筛选)")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("全文关键词,匹配标题和正文")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("资讯模块字典值")
|
||||
private String module;
|
||||
|
||||
|
||||
@@ -46,6 +46,12 @@
|
||||
<if test="query.title != null and query.title != ''">
|
||||
and news.title like '%' || #{query.title}::varchar || '%'
|
||||
</if>
|
||||
<if test="query.keyword != null and query.keyword != ''">
|
||||
and (
|
||||
news.title like '%' || #{query.keyword}::varchar || '%'
|
||||
or news.content like '%' || #{query.keyword}::varchar || '%'
|
||||
)
|
||||
</if>
|
||||
<if test="query.module != null and query.module != ''">
|
||||
and news.module = #{query.module}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user