package com.sptg.statistics.biz.controller;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.common.core.constant.OperationConstant;
import com.sptg.statistics.api.dto.AppMemberLoginRecordsDto;
import com.sptg.statistics.api.entity.AppMemberLoginRecords;
import com.sptg.statistics.api.feigns.AppMemberLoginRecordsFeign;
import com.sptg.statistics.biz.service.AppMemberLoginRecordsServiceInterface;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * title: AppMemberLoginRecordsController
 * package: com.sptg.statistics.biz.controller
 * description: 会员登录记录-控制器
 *
 *                
 *                
 */
@RestController
@RequiredArgsConstructor
public class AppMemberLoginRecordsController implements AppMemberLoginRecordsFeign {

    private final AppMemberLoginRecordsServiceInterface appMemberLoginRecordsServiceInterface;

    @PostMapping(value = "/statistics/appMemberLoginRecords/addAppMemberLoginRecords")
    @Override
    public ResultBean<Boolean> addAppMemberLoginRecords(@RequestBody AppMemberLoginRecords AppMemberLoginRecords) {
        boolean result=appMemberLoginRecordsServiceInterface.insert(AppMemberLoginRecords);
        return new ResultBean<>(ResultEnum.SUCCESS,result);
    }

    @Override
    @PostMapping(value = "/statistics/appMemberLoginRecords/getMemberLoginCountList")
    public ResultBean<List<Map<String,Object>>> getMemberLoginCountList(@RequestBody AppMemberLoginRecordsDto appMemberLoginRecordsDto){
        List<Map<String,Object>> list= this.appMemberLoginRecordsServiceInterface.getMemberLoginCountList(appMemberLoginRecordsDto);
        return  new ResultBean<List<Map<String,Object>>>(ResultEnum.SUCCESS,list);
    }
}
