1.增加了APP查询热点榜接口

2.解决了标题简介查询BUG
This commit is contained in:
2210088963 2025-02-17 15:47:05 +08:00
parent ca612e8a72
commit a545961a40
6 changed files with 54 additions and 6 deletions

View File

@ -281,8 +281,21 @@ public class LiveForeignController {
}
/**
* 根据APP搜索条件查找满足要求的对象
* @param appSearchDto 查询条件封装类
* @return 200
*/
@GetMapping("/appSearch")
public R appSearch(@RequestBody AppSearchDto appSearchDto) {
return R.ok().put("appSearch",liveSceneService.appSearch(appSearchDto));
}
/**
* APP查询热点榜
*/
@GetMapping("/getHotList")
public R getHotList() {
return R.ok().put("hotSpot",liveSceneService.getHotList());
}
}

View File

@ -1,16 +1,27 @@
package com.platform.modules.foreign.dto;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Data
public class AppSearchDto {
private String title;
private String liveDesc;
private Date startTime;
private Date endTime;
private String channelName;
private List<String> channelNameList;
private Integer page;
private Integer size;
public List<String> getChannelNameList() {
if(StringUtils.isBlank(channelName)) {
return Collections.emptyList();
}
return Arrays.asList(channelName.split(","));
}
}

View File

@ -61,4 +61,7 @@ public interface LiveSceneDao extends BaseMapper<LiveSceneEntity> {
List<LiveSceneDTO> appSearch(@Param("appSearchDto") AppSearchDto appSearchDto, Page<LiveSceneDTO> page);
@Select("select ls.id,ls.title,ls.title_image,ls.live_state from live_scene ls left join live_scene_count lsc on ls.id = lsc.scene_id where ls.scene_state = 2 and hot_spot = 1 order by lsc.views_show desc;")
List<LiveSceneDTO> getHotList();
}

View File

@ -179,4 +179,6 @@ public interface LiveSceneService extends IService<LiveSceneEntity> {
List<SceneEntityVo> getAppAllScene(Integer page,Integer size);
List<LiveSceneDTO> appSearch(AppSearchDto appSearchDto);
List<LiveSceneDTO> getHotList();
}

View File

@ -2921,7 +2921,20 @@ public class LiveSceneServiceImpl extends ServiceImpl<LiveSceneDao, LiveSceneEnt
@Override
public List<LiveSceneDTO> appSearch(AppSearchDto appSearchDto) {
Page<LiveSceneDTO> page = new Page<>(appSearchDto.getPage(), appSearchDto.getSize());
if(appSearchDto.getStartTime() != null && appSearchDto.getEndTime() == null) {
appSearchDto.setEndTime(new Date());
}
appSearchDto.setChannelNameList(appSearchDto.getChannelNameList());
return liveSceneDao.appSearch(appSearchDto, page);
}
@Override
public List<LiveSceneDTO> getHotList() {
List<LiveSceneDTO> hotList = liveSceneDao.getHotList();
if(CollectionUtil.isNotEmpty(hotList)) {
return hotList;
}
return Collections.emptyList();
}
}

View File

@ -150,17 +150,23 @@
FROM
live_scene
WHERE scene_state = 2
<if test="appSearchDto.title != null and appSearchDto.title != ''">
AND `title` LIKE CONCAT('%', #{appSearchDto.title}, '%')
</if>
<!-- <if test="appSearchDto.title != null and appSearchDto.title != ''">-->
<!-- AND `title` LIKE CONCAT('%', #{appSearchDto.title}, '%')-->
<!-- </if>-->
<if test="appSearchDto.liveDesc != null and appSearchDto.liveDesc != ''">
AND live_desc LIKE CONCAT('%', #{appSearchDto.liveDesc}, '%')
AND (
`title` LIKE CONCAT('%', #{appSearchDto.liveDesc}, '%')
OR live_desc LIKE CONCAT('%', #{appSearchDto.liveDesc}, '%')
)
</if>
<if test="appSearchDto.startTime != null and appSearchDto.endTime != null">
AND live_start BETWEEN #{appSearchDto.startTime} AND #{appSearchDto.endTime}
</if>
<if test="appSearchDto.channelName != null and appSearchDto.channelName != ''">
AND channels_name = #{appSearchDto.channelName}
AND channels_name IN
<foreach collection="appSearchDto.channelNameList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>