示例#1
0
        /// <summary>
        /// 搜索文章
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <SearchCourseResponseDto> SearchCourseAsync(SearchCourseRequestDto request)
        {
            var sqlWhere = $@"AND ENABLE = 1 AND visible = 1";

            if (!string.IsNullOrWhiteSpace(request.Keyword))
            {
                sqlWhere = $"{sqlWhere} AND (title like @Keyword  OR summary like @Keyword)";
            }
            var sql = $@"
SELECT * FROM(
	SELECT
		A.*,
		CONCAT( B.base_path, B.relative_path ) AS PictureUrl 
	FROM
		t_utility_course A
		LEFT JOIN t_utility_accessory B ON B.accessory_guid = A.logo_guid 
	) T 
WHERE
	1 = 1 {sqlWhere}
ORDER BY
	creation_date Desc
";

            request.Keyword = $"%{request.Keyword}%";
            return(await MySqlHelper.QueryByPageAsync <SearchCourseRequestDto, SearchCourseResponseDto, SearchCourseItemDto>(sql, request));
        }
示例#2
0
        public async Task <IActionResult> SearchCourseAsync([FromBody] SearchCourseRequestDto request)
        {
            var response = await new CourseBiz().SearchCourseAsync(request);

            return(Success(response));
        }