package com.yida.data.user.controller;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.user.EduUserDeviceFactory;
import com.yida.data.user.service.EduUserDeviceFactoryService;
import com.yida.data.user.vo.UserDeviceInfoVO;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

@Api(tags = "用户与厂商关联管理")
@RequiredArgsConstructor
@RestController
@RequestMapping("/in/userDeviceFactory")
public class InEduUserDeviceFactoryController {
    private final EduUserDeviceFactoryService eduUserDeviceFactoryService;

    @ApiOperation("批量保存")
    @PostMapping("/batchSave")
    public ResultBean batchSave(@RequestBody List<EduUserDeviceFactory> userDeviceFactoryList) {
        eduUserDeviceFactoryService.batchSaveUserDeviceFactory(userDeviceFactoryList);
        return ResultBean.buildSuccess();
    }

    @ApiOperation("通过考勤设备方用户的唯一标识查询系统内用户信息")
    @GetMapping("/getUserInfoByDevciceFactory")
    public ResultBean<UserDeviceInfoVO> getUserInfoByDevciceFactory(@RequestParam("flag") String flag,
                                                             @RequestParam("type") String type){
        return ResultBean.buildSuccess(eduUserDeviceFactoryService.getUserInfoByDevciceFactory(flag,type));
    }
}
