resultMap修正
This commit is contained in:
@@ -169,8 +169,9 @@ public class NCResourceServiceImpl implements ResourceService {
|
||||
}
|
||||
// 获取当前用户的部门角色
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
// 直接查询ResourceVO列表,SQL已经LEFT JOIN了recommend表
|
||||
// 直接查询ResourceVO列表
|
||||
List<ResourceVO> resourceVOList = resourceMapper.selectResourcesPageOrderByViewCount(filter, pageParam, userDeptRoles);
|
||||
logger.info("资源数量{}",resourceVOList.size());
|
||||
long total = resourceMapper.countResources(filter, userDeptRoles);
|
||||
pageParam.setTotalElements(total);
|
||||
pageParam.setTotalPages((int) Math.ceil((double) total / pageParam.getPageSize()));
|
||||
|
||||
@@ -347,11 +347,12 @@
|
||||
|
||||
<!-- ResourceVO结果映射(包含推荐信息) -->
|
||||
<resultMap id="ResourceVOResultMap" type="org.xyzh.common.vo.ResourceVO">
|
||||
<id column="resource_id" property="resource.resourceID" jdbcType="VARCHAR"/>
|
||||
<result column="is_top_recommend" property="isTopRecommend" jdbcType="BOOLEAN"/>
|
||||
<result column="is_ideological_recommend" property="isIdeologicalRecommend" jdbcType="BOOLEAN"/>
|
||||
<association property="resource" javaType="org.xyzh.common.dto.resource.TbResource">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="resource_id" property="resourceID" jdbcType="VARCHAR"/>
|
||||
<id column="resource_id" property="resourceID" jdbcType="VARCHAR"/>
|
||||
<result column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="title" property="title" jdbcType="VARCHAR"/>
|
||||
<result column="content" property="content" jdbcType="LONGVARCHAR"/>
|
||||
<result column="summary" property="summary" jdbcType="VARCHAR"/>
|
||||
@@ -408,13 +409,21 @@
|
||||
r.author, r.source, r.source_url, r.view_count, r.like_count, r.collect_count,
|
||||
r.status, r.is_recommend, r.is_banner, r.publish_time, r.creator, r.updater,
|
||||
r.create_time, r.update_time, r.delete_time, r.deleted
|
||||
ORDER BY r.view_count DESC, r.publish_time DESC, r.create_time DESC
|
||||
<if test="filter.orderTypes != null and filter.orderTypes.size() > 0">
|
||||
ORDER BY
|
||||
<foreach collection="filter.orderTypes" item="orderType" separator=", ">
|
||||
r.${orderType.field} ${orderType.order}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="filter.orderTypes == null or filter.orderTypes.size() == 0">
|
||||
ORDER BY r.view_count DESC, r.publish_time DESC, r.create_time DESC
|
||||
</if>
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
||||
</select>
|
||||
|
||||
<!-- 统计资源总数 - 添加权限过滤 -->
|
||||
<select id="countResources" resultType="long">
|
||||
SELECT COUNT(DISTINCT r.id)
|
||||
SELECT COUNT(DISTINCT r.resource_id)
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE r.deleted = 0
|
||||
|
||||
Reference in New Issue
Block a user