Exemple #1
0
        public async Task <IActionResult> GetFAQsAnswerPageListAsync([FromQuery] GetFAQsAnswerPageListRequestDto requestDto)
        {
            var response = await new FaqsAnswerBiz().GetFAQsAnswerPageListAsync(requestDto);

            foreach (var item in response.CurrentPage)
            {
                if (item.ReceiveType.Equals(FaqsAnswerModel.AnswerReceiveTypeEnum.Money.ToString()))
                {
                    item.Score = item.Score / 100;
                }
            }
            return(Success(response));
        }
        /// <summary>
        /// 获取问题的回答分页列表
        /// </summary>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        public async Task <GetFAQsAnswerPageListResponseDto> GetFAQsAnswerPageListAsync(GetFAQsAnswerPageListRequestDto requestDto)
        {
            var sql = @"SELECT
	                        b.doctor_guid,
	                        a.answer_guid,
	                        a.main_answer,
	                        a.content,
	                        c.user_name AS doctor_name,
	                        CONCAT( acc.base_path, acc.relative_path ) AS portrait,
	                        b.hospital_name,
	                        b.office_name,
	                        d.config_name AS title_name,
	                        a.reward_intergral AS score,
	                        a.receive_type,
	                        hot.like_count,
	                        a.creation_date,
	                        CASE
		                        WHEN l.like_guid IS NULL THEN 0 
		                        ELSE 1 
	                        END AS is_like 
                        FROM
	                        t_faqs_answer a
	                        LEFT JOIN t_doctor b ON a.user_guid = b.doctor_guid
	                        LEFT JOIN t_utility_user c ON c.user_guid = b.doctor_guid
	                        LEFT JOIN t_manager_dictionary d ON d.dic_guid = b.title_guid
	                        LEFT JOIN t_utility_hot hot ON a.answer_guid = hot.owner_guid
	                        LEFT JOIN t_utility_accessory acc ON acc.accessory_guid = b.portrait_guid
	                        LEFT JOIN t_consumer_like l ON l.target_guid = a.answer_guid 
	                        AND l.created_by = @UserId 
	                        AND l.`enable` = 1 
                        WHERE
	                        a.question_guid = @QuestionGuid 
	                        AND a.`enable` = 1 
                        ORDER BY
	                        a.main_answer DESC,
	                        hot.like_count DESC,
                        a.creation_date DESC";

            return(await MySqlHelper.QueryByPageAsync <GetFAQsAnswerPageListRequestDto, GetFAQsAnswerPageListResponseDto, GetFAQsAnswerPageListItemDto>(sql, requestDto));
        }