package com.dcsoft.system.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.dcsoft.common.core.utils.DateUtils;
import com.dcsoft.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dcsoft.system.mapper.SysPeopleRecordMapper;
import com.dcsoft.system.domain.SysPeopleRecord;
import com.dcsoft.system.service.ISysPeopleRecordService;

/**
 * 人员识别记录Service业务层处理
 *
 * @author nichun
 * @date 2023-03-08
 */
@Service
public class SysPeopleRecordServiceImpl implements ISysPeopleRecordService
{
    @Autowired
    private SysPeopleRecordMapper sysPeopleRecordMapper;

    /**
     * 查询人员识别记录
     *
     * @param id 人员识别记录主键
     * @return 人员识别记录
     */
    @Override
    public SysPeopleRecord selectSysPeopleRecordById(Long id)
    {
        return sysPeopleRecordMapper.selectSysPeopleRecordById(id);
    }

    /**
     * 查询人员识别记录列表
     *
     * @param sysPeopleRecord 人员识别记录
     * @return 人员识别记录
     */
    @Override
    public List<SysPeopleRecord> selectSysPeopleRecordList(SysPeopleRecord sysPeopleRecord)
    {
        return sysPeopleRecordMapper.selectSysPeopleRecordList(sysPeopleRecord);
    }

    /**
     * 查询人员识别记录列表
     *
     * @param sysPeopleRecord 人员识别记录
     * @return 人员识别记录
     */
    @Override
    public List<SysPeopleRecord> selectSysPeopleRecordLists(SysPeopleRecord sysPeopleRecord)
    {
        return sysPeopleRecordMapper.selectSysPeopleRecordLists(sysPeopleRecord);
    }

    /**
     * 新增人员识别记录
     *
     * @param sysPeopleRecord 人员识别记录
     * @return 结果
     */
    @Override
    public int insertSysPeopleRecord(SysPeopleRecord sysPeopleRecord)
    {
        sysPeopleRecord.setCreateTime(DateUtils.getNowDate());
        return sysPeopleRecordMapper.insertSysPeopleRecord(sysPeopleRecord);
    }

    /**
     * 修改人员识别记录
     *
     * @param sysPeopleRecord 人员识别记录
     * @return 结果
     */
    @Override
    public int updateSysPeopleRecord(SysPeopleRecord sysPeopleRecord)
    {
        sysPeopleRecord.setUpdateTime(DateUtils.getNowDate());
        return sysPeopleRecordMapper.updateSysPeopleRecord(sysPeopleRecord);
    }

    /**
     * 批量删除人员识别记录
     *
     * @param ids 需要删除的人员识别记录主键
     * @return 结果
     */
    @Override
    public int deleteSysPeopleRecordByIds(Long[] ids)
    {
        return sysPeopleRecordMapper.deleteSysPeopleRecordByIds(ids);
    }

    /**
     * 删除人员识别记录信息
     *
     * @param id 人员识别记录主键
     * @return 结果
     */
    @Override
    public int deleteSysPeopleRecordById(Long id)
    {
        return sysPeopleRecordMapper.deleteSysPeopleRecordById(id);
    }

    @Override
    public AjaxResult topApi() {
        List<Map<String,Object>> list=sysPeopleRecordMapper.topApi();

        return AjaxResult.success(list);
    }


    @Override
    public String selectPeopleRecordById(String deviceKey) {
        return sysPeopleRecordMapper.selectPeopleRecordById(deviceKey);
    }

    /**
     * 查询通行统计数量（昨天，今天）
     * @return
     */
    @Override
    public List<SysPeopleRecord> queryThroughCount() {
        return sysPeopleRecordMapper.queryThroughCount();
    }
}
