Browse Source

fix(app): 修复搜索功能相关问题

- 修复了 AppCoursesMapper、AppGameMapper 和 AppSiteMapper 中的 SQL 查询条件
- 优化了 AppHomeServiceImpl 中的搜索逻辑,增加了热门搜索词的保存功能
- 修改了 AppSearchHot 实体类,将 categoryId 字段改为 venueType
- 修复了 DetailServiceImpl 中的 AppSitePriceRules 查询条件
- 修正了 MsgInfoVO 中 msgContent 字段的描述
- 在 UserServiceImpl 中为 MsgVO 添加了 id 字段
SheepHy 2 weeks ago
parent
commit
dfaa7740a5

+ 20 - 11
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/AppHomeServiceImpl.java

@@ -171,6 +171,25 @@ public class AppHomeServiceImpl implements IAppHomeService {
 
     @Override
     public Object search(SearchDTO searchDTO) {
+        switch (searchDTO.getVenueType().charAt(0)) {
+            case '0':
+                    addAHotWordSearchHistory(searchDTO);
+                    return convertSearchPlaceVOPage(searchDTO);
+            case '1':
+                    addAHotWordSearchHistory(searchDTO);
+                    return convertSearchTrainVOPage(searchDTO);
+            case '2':
+                    addAHotWordSearchHistory(searchDTO);
+                    return convertSearchCompetitionVOPage(searchDTO);
+            case '3':
+                    addAHotWordSearchHistory(searchDTO);
+                    return convertSearchInstructorVOPage(searchDTO);
+        }
+
+        return new Page<>();
+    }
+
+    private void addAHotWordSearchHistory(SearchDTO searchDTO){
         AppSearchHot appSearchHot = appSearchHotMapper.selectOne(Wrappers.<AppSearchHot>lambdaQuery()
                 .eq(AppSearchHot::getSearchContent, searchDTO.getKeyword())
                 .last("LIMIT 1"));
@@ -179,21 +198,11 @@ public class AppHomeServiceImpl implements IAppHomeService {
                     .setSearchContent(searchDTO.getKeyword())
                     .setSearchCount(1)
                     .setIsActive(1)
+                    .setVenueType(searchDTO.getVenueType())
                     .setIsRecommend(0));
         }else {
             appSearchHotMapper.updateById(appSearchHot.setSearchCount(appSearchHot.getSearchCount() + 1));
         }
-        switch (searchDTO.getVenueType().charAt(0)) {
-            case '0':
-                    return convertSearchPlaceVOPage(searchDTO);
-            case '1':
-                    return convertSearchTrainVOPage(searchDTO);
-            case '2':
-                    return convertSearchCompetitionVOPage(searchDTO);
-            case '3':
-                    return convertSearchInstructorVOPage(searchDTO);
-        }
-        return new Page<>();
     }
 
     @Override

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/DetailServiceImpl.java

@@ -43,7 +43,7 @@ public class DetailServiceImpl implements IDetailService {
         AppSite appSite = appSiteMapper.selectById(id);
         PlaceInfoVO placeInfo = appSiteMapper.getPlaceInfo(id);
         AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery()
-                .eq(AppSitePriceRules::getSiteId, id)
+                .eq(AppSitePriceRules::getSitePlaceId, id)
                 .eq(AppSitePriceRules::getStatus, 0)
                 .last("limit 1"));
         List<PlaceInfoVO.InstructorVO> instructorVOList = new ArrayList<>();

+ 1 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/UserServiceImpl.java

@@ -106,6 +106,7 @@ public class UserServiceImpl implements IUserService {
                 MsgVO msgVO = new MsgVO()
                         .setReadFlag(sysAnnouncementSend.getReadFlag())
                         .setTitile(sysAnnouncement.getTitile())
+                        .setId(sysAnnouncement.getId())
                         .setSendTime(sysAnnouncement.getSendTime())
                         .setImgUrl(sysAnnouncement.getImgUrl()).setSender(sysAnnouncement.getSender());
                 msgVOList.add(msgVO);

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/MsgInfoVO.java

@@ -16,7 +16,7 @@ public class MsgInfoVO {
     private String titile;
     @Schema(description = "发布人")
     private String sender;
-    @Schema(description = "发布人")
+    @Schema(description = "内容")
     private String msgContent;
     @Schema(description = "发布时间")
     private java.util.Date sendTime;

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppSearchHot.java

@@ -36,7 +36,7 @@ public class AppSearchHot implements Serializable {
     @Schema(description = "是否推荐")
     private int isRecommend;
     @Schema(description = "关联分类ID")
-    private String categoryId;
+    private String venueType;
     @Schema(description = "最后一次搜索用户ID")
     private String lastUser;
 

+ 2 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml

@@ -26,8 +26,8 @@
                 GROUP BY
                     product_id
             ) d ON a.id = d.product_id WHERE 1 = 1
-        <if test="searchDTO.keyword != null and searchDTO.keyword == ''">
-            AND (a.name LIKE CONCAT('%',#{searchDTO.keyword},'%') OR a.address LIKE CONCAT('%',#{searchDTO.keyword},'%'))
+        <if test="searchDTO.keyword != null and searchDTO.keyword != ''">
+            AND (a.name LIKE CONCAT('%',#{searchDTO.keyword},'%') OR b.address LIKE CONCAT('%',#{searchDTO.keyword},'%'))
         </if>
         <if test="searchDTO.venueType != null and searchDTO.venueType == '1-2'">
             ORDER BY  a.good_rate DESC

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppGameMapper.xml

@@ -26,7 +26,7 @@
             ) g ON a.id = g.game_id
         WHERE
             a.end_time > NOW()
-        <if test="searchDTO.keyword != null and searchDTO.keyword == ''">
+        <if test="searchDTO.keyword != null and searchDTO.keyword != ''">
             AND (a.name LIKE CONCAT('%',#{searchDTO.keyword},'%') OR a.address LIKE CONCAT('%',#{searchDTO.keyword},'%'))
         </if>
         ORDER BY a.end_time ASC;

+ 3 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppSiteMapper.xml

@@ -47,13 +47,13 @@
         CASE
         WHEN EXISTS (
         SELECT SUM(inventory)
-        FROM nm_site_peice_rules
-        WHERE site_id = a.id
+        FROM nm_site_peice_rules e
+        WHERE e.site_place_id = a.id
         ) THEN 1
         ELSE 0
         END AS ticketWhether
         FROM nm_site a LEFT JOIN sys_depart b ON a.tenant_id = b.id WHERE 1=1
-        <if test="searchDTO.keyword != null and searchDTO.keyword == ''">
+        <if test="searchDTO.keyword != null and searchDTO.keyword != ''">
             AND (a.name LIKE CONCAT('%',#{searchDTO.keyword},'%') OR a.address LIKE CONCAT('%',#{searchDTO.keyword},'%'))
         </if>
         <if test="searchDTO.venueType != null and searchDTO.venueType == '0-2'">