package com.kxs.user.biz.controller.kxsapp;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kxs.common.core.util.R;
import com.kxs.common.security.annotation.Inner;
import com.kxs.user.api.model.KxsLeader;
import com.kxs.user.biz.service.KxsLeaderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * KXS 盟主控制器
 *
 * @author 没秃顶的码农
 * @date 2024-04-09
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("leader")
public class KxsLeaderController {

    private final KxsLeaderService kxsLeaderService;


    @Inner
    @GetMapping("getDateBetweenLeaders")
    public R getDateBetweenLeaders(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){

        return R.ok(kxsLeaderService.list(Wrappers.<KxsLeader>lambdaQuery()
                .select(KxsLeader::getUserId, KxsLeader::getLeaderType)
                .between(KxsLeader::getLastBuyDate, startTime, endTime)));
    }

}
