예제 #1
0
        public async Task <GetDecorationPageListResponseDto> GetDecorationPageListAsync(GetDecorationPageListRequestDto requestDto)
        {
            var sqlWhere = string.Empty;

            if (!string.IsNullOrWhiteSpace(requestDto.Keyword))
            {
                sqlWhere           = "and a.decoration_name like @Keyword";
                requestDto.Keyword = $"%{requestDto.Keyword}%";
            }
            if (!string.IsNullOrWhiteSpace(requestDto.ClassificationGuid))
            {
                sqlWhere = $"{sqlWhere} and a.classification_guid = @ClassificationGuid";
            }
            var sql    = $@"SELECT
	                        a.decoration_guid,
	                        a.decoration_name,
	                        b.classification_name,
	                        a.sort,
	                        a.creation_date ,
	                        a.enable 
                        FROM
	                        t_decoration a
	                        INNER JOIN t_decoration_classification b ON a.classification_guid = b.classification_guid 
                        WHERE
	                        a.`enable` = 1 { sqlWhere } 
                        ORDER BY
	                        a.sort,
	                        a.creation_date DESC"    ;
            var result = await MySqlHelper.QueryByPageAsync <GetDecorationPageListRequestDto, GetDecorationPageListResponseDto, GetDecorationPageListItemDto>(sql, requestDto);

            return(result);
        }
        public async Task <IActionResult> GetDecorationPageListAsync([FromQuery] GetDecorationPageListRequestDto requestDto)
        {
            var result = await new DecorationBiz().GetDecorationPageListAsync(requestDto);

            return(Success(result));
        }