package com.nantian.cloud.dbcapp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nantian.cloud.dbcapp.entity.TApplyRecord;
import com.nantian.cloud.dbcapp.mapper.record.TApplyRecordMapper;
import com.nantian.cloud.dbcapp.service.TApplyRecordService;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("TApplyRecordService")
public class TApplyRecordImpl extends ServiceImpl<TApplyRecordMapper, TApplyRecord> implements TApplyRecordService {
    @Override
    public boolean insertInfo(TApplyRecord tApplyRecord) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        tApplyRecord.setApplyTime(sdf.format(System.currentTimeMillis()));
        tApplyRecord.setAuditType("2");
        return baseMapper.insertInfo(tApplyRecord);
    }

    @Override
    public boolean updateRecordById(TApplyRecord tApplyRecord) {
        return baseMapper.updateRecordById(tApplyRecord);
    }

    @Override
    public Map<String, Object> getList(String epc) {
        Map<String,Object> map = new HashMap<>();
        List<Map<String, Object>> list = baseMapper.getList(epc);
        map.put("list",list);
        return map;
    }

    @Override
    public IPage<TApplyRecord> getRecordPage(Page page, TApplyRecord tApplyRecord) {
        return baseMapper.getRecordPage(page,tApplyRecord);
    }

    @Override
    public IPage<TApplyRecord> getListByPage(Page page, TApplyRecord tApplyRecord) {
        return baseMapper.getListByPage(page,tApplyRecord);
    }
}
