package com.sundot.airport.web.controller.score;

import com.sundot.airport.common.core.controller.BaseController;
import com.sundot.airport.common.core.domain.AjaxResult;
import com.sundot.airport.ledger.service.IEmployeePortraitService;
import org.springframework.beans.factory.annotation.Autowired;
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;

@RestController
@RequestMapping("/score/portrait")
public class EmployeePortraitController extends BaseController {

    @Autowired
    private IEmployeePortraitService portraitService;

    @GetMapping("/searchUsers")
    public AjaxResult searchUsers(@RequestParam(required = false, defaultValue = "") String keyword) {
        return AjaxResult.success(portraitService.searchUsers(keyword));
    }

    @GetMapping("/employee")
    public AjaxResult getEmployee(
            @RequestParam String personName,
            @RequestParam(required = false) String beginTime,
            @RequestParam(required = false) String endTime) {
        return AjaxResult.success(portraitService.getPortrait(personName, beginTime, endTime));
    }
}
