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

import com.cyksj.dto.Result;
import com.cyksj.enums.GatewayResponse;
import com.cyksj.model.entity.QyServicesIntentionUserRecord;
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;

/**
 * 项目名: yhlxj2
 * 文件名: QyServicesIntentionController
 * 创建者: JavaZou
 * 创建时间:2025/3/17 16:26
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/manage/qy")
public class QyServicesIntentionController {
	private final BeanSearcher beanSearcher;

	private final HttpServletRequest request;

	/**
	 * 企业服务意向用户列表
	 */
	@GetMapping("/get")
	public Result<SearchResult<QyServicesIntentionUserRecord>> get() {
		SearchResult<QyServicesIntentionUserRecord> search = beanSearcher.search(QyServicesIntentionUserRecord.class, MapUtils.flatBuilder(request.getParameterMap()).orderBy(QyServicesIntentionUserRecord::getId).desc().build());
		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
	}
}
