소스 검색

fix:热门搜索

liujunchi 3 년 전
부모
커밋
b2c6ba7740

+ 12 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/HotSearchSearch.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.dto.search;
 
+import com.yonge.cooleshow.biz.dal.enums.HotSearchEnum;
 import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import com.yonge.toolset.base.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
@@ -20,6 +21,17 @@ public class HotSearchSearch extends QueryInfo {
     @ApiModelProperty(value = "状态  0:停用,1:启用",dataType = "int")
     private YesOrNoEnum status;
 
+    @ApiModelProperty("类型 MUSIC:曲目和专辑 COURSE:课程")
+    private HotSearchEnum type;
+
+    public HotSearchEnum getType() {
+        return type;
+    }
+
+    public void setType(HotSearchEnum type) {
+        this.type = type;
+    }
+
     @Override
     public String getSearch() {
         return search;

+ 15 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/HotSearch.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.yonge.cooleshow.biz.dal.enums.HotSearchEnum;
 import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -32,6 +33,11 @@ public class HotSearch implements Serializable {
     @NotBlank(message = "关键词不能为空")
     private String key;
 
+    @ApiModelProperty("MUSIC:曲目和专辑 COURSE:课程 ")
+    @TableField(value = "type_")
+    @NotNull(message = "类型不能为空")
+    private HotSearchEnum type;
+
     @ApiModelProperty("状态 1启用 0禁用 ")
     @TableField(value = "status_")
     private YesOrNoEnum status;
@@ -61,6 +67,15 @@ public class HotSearch implements Serializable {
     @TableField(value = "update_by_")
     private Long updateBy;
 
+
+    public HotSearchEnum getType() {
+        return type;
+    }
+
+    public void setType(HotSearchEnum type) {
+        this.type = type;
+    }
+
     public Long getId() {
         return id;
     }

+ 33 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/HotSearchEnum.java

@@ -0,0 +1,33 @@
+package com.yonge.cooleshow.biz.dal.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.yonge.toolset.base.enums.BaseEnum;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-07-05
+ */
+public enum HotSearchEnum implements BaseEnum<String,HotSearchEnum> {
+
+    MUSIC("曲目和专辑"),
+    COURSE("课程");
+    @EnumValue
+    private String code;
+    private String name;
+
+    HotSearchEnum(String name) {
+        this.code = this.name();
+        this.name = name;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+
+    public String getName() {
+        return name;
+    }
+}

+ 3 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/HotSearchMapper.xml

@@ -15,6 +15,9 @@
             <if test="query.search != null and query.search != ''">
                 and (hs.key_ like concat('%',#{query.search},'%') or hs.id_ like concat('%',#{query.search},'%'))
             </if>
+            <if test="query.type != null">
+                and hs.type_ = #{query.type}
+            </if>
         </where>
     order by  hs.order_ ,hs.id_ desc
     </select>