package com.cyksj.web.controller.manage.advertisement;

import com.cyksj.dto.Result;
import com.cyksj.enums.GatewayResponse;
import com.cyksj.model.entity.AdvertisementOrderDon;
import com.ejlchina.searcher.BeanSearcher;
import com.ejlchina.searcher.SearchResult;
import com.ejlchina.searcher.util.MapUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author chan
 * @date 2023/5/16 11:07 AM
 */
@RestController
@RequestMapping("manage/advertisement/order")
@Slf4j
@RequiredArgsConstructor
public class CmsAdvertisementOrderDonController {

    private final HttpServletRequest request;

    private final BeanSearcher beanSearcher;

    @GetMapping
    public Result<SearchResult<AdvertisementOrderDon>> get() {
        SearchResult<AdvertisementOrderDon> searchResult = beanSearcher.search(AdvertisementOrderDon.class,
                MapUtils.flatBuilder(request.getParameterMap())
                        .build());
        return GatewayResponse.SUCCESS.newBuilder().toResult(searchResult);
    }

}
