|
@@ -1,10 +1,18 @@
|
|
|
package com.gis.cms.controller;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gis.admin.entity.po.SysUserEntity;
|
|
|
import com.gis.cms.entity.dto.*;
|
|
|
import com.gis.cms.entity.po.GoodsEntity;
|
|
|
import com.gis.cms.entity.po.VideoEntity;
|
|
|
+import com.gis.cms.entity.vo.SearchVo;
|
|
|
+import com.gis.cms.mapper.ImgMapper;
|
|
|
import com.gis.cms.service.*;
|
|
|
import com.gis.common.base.aop.WebControllerLog;
|
|
|
+import com.gis.common.base.entity.dto.PageDto;
|
|
|
+import com.gis.common.base.service.impl.IBaseService;
|
|
|
+import com.gis.common.util.RegexUtil;
|
|
|
import com.gis.common.util.Result;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -57,6 +65,13 @@ public class WebController {
|
|
|
@Autowired
|
|
|
CommentService commentService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ImgMapper imgMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IBaseService iBaseService;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -67,6 +82,32 @@ public class WebController {
|
|
|
// return webService.clearCache();
|
|
|
// }
|
|
|
|
|
|
+
|
|
|
+ @ApiOperation(value = "全局搜索-分页")
|
|
|
+ @PostMapping("/search")
|
|
|
+ public Result search(@RequestBody PageDto param) {
|
|
|
+ // 学校宣传片、美丽校园、军歌嘹亮、学籍查询
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ String searchKey = param.getSearchKey();
|
|
|
+ if (StrUtil.isBlank(searchKey)){
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+ searchKey = RegexUtil.sqlReplaceSpecialStr(searchKey);
|
|
|
+ builder.append(StrUtil.format("SELECT id, name, thumb, 'img' as type, null as file_path from tb_img WHERE is_delete=0 and display=1 and name like '%{}%'", searchKey));
|
|
|
+ builder.append(" UNION ALL ");
|
|
|
+ builder.append(StrUtil.format("SELECT id, name, thumb, 'video' as type, file_path from tb_video WHERE is_delete=0 and display=1 and name like '%{}%'", searchKey));
|
|
|
+ builder.append(" UNION ALL ");
|
|
|
+ builder.append(StrUtil.format("SELECT id, name, thumb, 'student' as type, null as file_path from tb_student WHERE is_delete=0 and display=1 and name like '%{}%'", searchKey));
|
|
|
+ builder.append(" UNION ALL ");
|
|
|
+ builder.append(StrUtil.format("SELECT id, name, thumb, 'music' as type, file_path from tb_music WHERE is_delete=0 and display=1 and name like '%{}%'", searchKey));
|
|
|
+
|
|
|
+ Page<SearchVo> res = imgMapper.webSearch(builder.toString(), iBaseService.initPage(param));
|
|
|
+
|
|
|
+
|
|
|
+ return Result.success(res);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@ApiOperation(value = "文物列表")
|
|
|
@PostMapping("goodList")
|
|
|
public Result goodList(@Valid @RequestBody GoodsPageDto param) {
|