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 @Override
public PageData<ResourceBrowseDTO> selectResourceBrowseByTypeAndUser(Map<String, Object> map) { public PageData<ResourceBrowseDTO> selectResourceBrowseByTypeAndUser(Map<String, Object> map) {
List<ResourceBrowseDTO> list = resourceBrowseDao.selectResourceBrowseByTypeAndUser(map); List<ResourceBrowseDTO> list = resourceBrowseDao.selectResourceBrowseByTypeAndUser(map);
list = list.stream() List<ResourceBrowseDTO> collect = list.stream()
.skip(Long.valueOf(map.get("pageNum").toString())) .skip(Long.valueOf(map.get("pageNum").toString()))
.limit(Long.valueOf(map.get("pageSize").toString())) .limit(Long.valueOf(map.get("pageSize").toString()))
.collect(Collectors.toList()); .collect(Collectors.toList());
PageData<ResourceBrowseDTO> pageData = new PageData<ResourceBrowseDTO>(list, list.size()); PageData<ResourceBrowseDTO> pageData = new PageData<ResourceBrowseDTO>(collect, list.size());
return pageData; return pageData;
} }
} }

View File

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