package com.zcloud.service.integratedmanagement.access.impl;

import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.integratedmanagement.GateCarRecordMapper;
import com.zcloud.mapper.datasource.integratedmanagement.GatePeopleRecordMapper;
import com.zcloud.service.integratedmanagement.access.GatePeopleRecordService;
import com.zcloud.util.InitPageDataUtil;
import com.zcloud.util.Jurisdiction;
import lombok.Getter;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

@Service
public class GatePeopleRecordServiceImpl implements GatePeopleRecordService {

    @Getter
    @Resource
    private GatePeopleRecordMapper gatePeopleRecordMapper;
    @Resource
    private GateCarRecordMapper gateCarRecordMapper;
    @Resource
    private InitPageDataUtil initPageDataUtil;
    @Override
    public PageData findById(PageData pageData) {
        return gatePeopleRecordMapper.findById(pageData);
    }

    @Override
    public List<PageData> list(Page page) {
        return gatePeopleRecordMapper.datalistPage(page);
    }

    @Override
    @Transactional
    public void edit(PageData pageData) {
        initPageDataUtil.initEdit(pageData);
        gatePeopleRecordMapper.edit(pageData);
    }

    @Override
    @Transactional
    public void save(PageData pageData) {
        initPageDataUtil.initSave(pageData,"RECORD_ID");
        pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
        gatePeopleRecordMapper.save(pageData);
    }


    @Override
    public List<PageData> getBIEntryExitPeoLogList(Page pd) {
        return gatePeopleRecordMapper.getBIEntryExitPeoLoglistPage(pd);
    }

    @Override
    public List<PageData> getBIEntryExitCarLogList(Page page) {
        return gateCarRecordMapper.getBIEntryExitCarlistPage(page);
    }

    @Override
    public List<PageData> getBIPeopleFieldCondition(PageData pd) {
        return gatePeopleRecordMapper.getBIPeopleFieldCondition(pd);
    }
}
