package com.chinaweal.aiccs.aiccs.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaweal.aiccs.aiccs.abnormal.entity.vo.DissentListVo;
import com.chinaweal.aiccs.aiccs.system.entity.LogVO;
import com.chinaweal.aiccs.aiccs.system.entity.TRBaseCode;
import com.chinaweal.aiccs.aiccs.system.mapper.LogMapper;
import com.chinaweal.aiccs.aiccs.system.mapper.TRBaseCodeMapper;
import com.chinaweal.aiccs.aiccs.system.service.LogService;
import com.chinaweal.aiccs.aiccs.system.service.TRBaseCodeService;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

@Service
public class LogServiceImpl extends BaseServiceImpl<LogMapper, LogVO> implements LogService {

    @Resource
    LogMapper logMapper;

    @Override
    public IPage<LogVO> queryAll(Page<DissentListVo> page, Map<String,Object> customParamMap) {
        Object searchDate = customParamMap.get("searchDate");
        if(searchDate instanceof List){
            List<String> list = (List<String>) searchDate;
            String startDate = list.get(0);
            String endDate = list.get(1);
            if(startDate.equals(endDate)){
                customParamMap.put("oneDate",startDate);
            }else {
                customParamMap.put("startDate",startDate);
                customParamMap.put("endDate",endDate);
            }
        }
        return logMapper.queryAll(page,customParamMap);
    }
}
