예제 #1
0
        public async Task <GetAdvisePageResponseDto> GetAdvisePageAsync(GetAdvisePageRequestDto request)
        {
            var sqlWhere = $@"1 = 1";

            if (request.BeginDate != null)
            {
                request.BeginDate = request.BeginDate?.Date;
                sqlWhere          = $"{sqlWhere} AND creation_date > @BeginDate";
            }
            if (request.EndDate != null)
            {
                request.EndDate = request.EndDate?.AddDays(1).Date;
                sqlWhere        = $"{sqlWhere} AND creation_date < @EndDate";
            }

            var sqlOrderBy = "creation_date desc";
            var sql        = $@"
SELECT * FROM
    t_consumer_advise
 WHERE
	{sqlWhere}
ORDER BY
	{sqlOrderBy}"    ;

            return(await MySqlHelper.QueryByPageAsync <GetAdvisePageRequestDto, GetAdvisePageResponseDto, GetAdvisePageItemDto>(sql, request));
        }
예제 #2
0
        public async Task <GetAdvisePageResponseDto> GetAdvisePageAsync(GetAdvisePageRequestDto request)
        {
            var sqlWhere = $@"1 = 1";

            if (request.BeginDate != null)
            {
                request.BeginDate = request.BeginDate?.Date;
                sqlWhere          = $"{sqlWhere} AND creation_date > @BeginDate";
            }
            if (request.EndDate != null)
            {
                request.EndDate = request.EndDate?.AddDays(1).Date;
                sqlWhere        = $"{sqlWhere} AND creation_date < @EndDate";
            }
            if (!string.IsNullOrWhiteSpace(request.PlatformType))
            {
                if (request.PlatformType.ToLower() == PlatformType.CloudDoctor.ToString().ToLower())
                {
                    sqlWhere = $"{sqlWhere} and platform_type = @PlatformType";
                }
                else
                {
                    sqlWhere = $"{sqlWhere} and platform_type != '{PlatformType.CloudDoctor.ToString()}'";
                }
            }
            var sqlOrderBy = "creation_date desc";
            var sql        = $@"
SELECT * FROM
    t_consumer_advise
 WHERE
	{sqlWhere}
ORDER BY
	{sqlOrderBy}"    ;

            return(await MySqlHelper.QueryByPageAsync <GetAdvisePageRequestDto, GetAdvisePageResponseDto, GetAdvisePageItemDto>(sql, request));
        }
        public async Task <IActionResult> GetAdvisePageAsync([FromBody] GetAdvisePageRequestDto request)
        {
            var response = await new AdviseBiz().GetAdvisePageAsync(request);

            return(Success(response));
        }