This commit is contained in:
wangliwen 2022-12-28 09:58:56 +08:00
commit 3fc05f03bb
2 changed files with 8 additions and 15 deletions

View File

@ -81,11 +81,11 @@ public class ResourceBrowseServiceImpl extends CrudServiceImpl<ResourceBrowseDao
@Override
public PageData<ResourceBrowseDTO> selectResourceBrowseByTypeAndUser(Map<String, Object> map) {
List<ResourceBrowseDTO> list = resourceBrowseDao.selectResourceBrowseByTypeAndUser(map);
list = list.stream()
List<ResourceBrowseDTO> collect = list.stream()
.skip(Long.valueOf(map.get("pageNum").toString()))
.limit(Long.valueOf(map.get("pageSize").toString()))
.collect(Collectors.toList());
PageData<ResourceBrowseDTO> pageData = new PageData<ResourceBrowseDTO>(list, list.size());
PageData<ResourceBrowseDTO> pageData = new PageData<ResourceBrowseDTO>(collect, list.size());
return pageData;
}
}

View File

@ -54,20 +54,13 @@
<select id="selectResourceBrowseByTypeAndUser" parameterType="java.util.Map"
resultType="io.renren.modules.resourceBrowse.dto.ResourceBrowseDTO">
SELECT a.*, c.attr_value FROM tb_resource_browse a INNER JOIN tb_data_resource b ON a.resource_id = b.id
LEFT JOIN tb_data_attr c ON b.id = c.data_resource_id
WHERE a.state = 0
AND c.del_flag = 0
AND c.attr_type = '组件类型'
SELECT a.*, b.type FROM tb_resource_browse a INNER JOIN tb_data_resource b ON a.resource_id = b.id
WHERE a.state = 0 AND b.del_flag != 1
<if test="params.type != null and params.type != ''">
<choose>
<when test="params.type == '应用资源' or params.type == '知识库'">
AND b.type = #{params.type}
</when>
<otherwise>
AND c.attr_value = #{params.type}
</otherwise>
</choose>
</if>
<if test="params.userId != null and params.userId != ''">
AND a.user_id = #{params.userId}
</if>
<if test="params.name != null and params.name != ''">
AND (b.name LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))) OR b.type