コード例 #1
0
        public async Task <IActionResult> GetTargetCommentPageListAsync([FromBody] GetTargetCommentPageListRequestDto requestDto)
        {
            if (!string.IsNullOrWhiteSpace(UserID))
            {
                requestDto.UserId = UserID;
            }
            var response = await new CommentBiz().GetTargetCommentPageListAsync(requestDto);

            return(Success(response));
        }
コード例 #2
0
        /// <summary>
        /// 获取目标评论分页列表
        /// </summary>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        public async Task <GetTargetCommentPageListResponseDto> GetTargetCommentPageListAsync(GetTargetCommentPageListRequestDto requestDto)
        {
            var sql = @"SELECT
                          a.comment_guid,
	                        a.content,
	                        a.score,
	                        a.creation_date,
	                        b.nick_name ,
                            ifnull(hot.like_count,0) AS total_like,
	                        CONCAT(c.base_path,c.relative_path) as portrait,
                            CASE
		                        WHEN l.like_guid IS NULL THEN 0 
		                        ELSE 1 
	                        END AS is_like ,
	                        count(distinct son.comment_guid) as total_reply
                        FROM
	                        t_consumer_comment a
	                        LEFT JOIN t_utility_user b ON a.created_by = b.user_guid
	                        left join t_utility_accessory c on c.accessory_guid=b.portrait_guid
	                        left join t_consumer_comment son on son.target_guid=a.comment_guid
	                        left join t_utility_hot hot ON hot.owner_guid = a.comment_guid
                                AND hot.`enable` = 1
                            LEFT JOIN t_consumer_like l ON l.target_guid = a.comment_guid 
	                        AND l.created_by = @UserId 
	                        AND l.`enable` = 1 
	                    where a.`enable`=1 and a.target_guid=@TargetGuid
                        group by 
	                        a.comment_guid,
	                        a.content,
	                        a.score,
	                        a.creation_date,
	                        b.nick_name ,
                            total_like,
	                        portrait,
                            is_like
                        ORDER BY a.creation_date";

            return(await MySqlHelper.QueryByPageAsync <GetTargetCommentPageListRequestDto, GetTargetCommentPageListResponseDto, GetTargetCommentPageListItemDto>(sql, requestDto));
        }