package org.ta.pddserver.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.ta.pddserver.entity.LogOrderEntity;
import org.ta.pddserver.entity.LogOrderIoEntity;
import org.ta.pddserver.mapper.LogOrderIoMapper;
import org.ta.pddserver.mapper.LogOrderMapper;
import org.ta.pddserver.model.api.request.LogOrderIoRequest;
import org.ta.pddserver.model.api.request.LogOrderListRequest;
import org.ta.pddserver.model.api.response.LogOrderIoListResponse;
import org.ta.pddserver.model.api.response.LogOrderListResponse;
import org.ta.pddserver.service.LogOrderIoService;
import org.ta.pddserver.service.LogOrderService;

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

@Service
public class LogOrderIoImpl extends ServiceImpl<LogOrderIoMapper, LogOrderIoEntity> implements LogOrderIoService {


    public Map<String, Object> getListByRequest(LogOrderIoRequest param) {
        Integer count = baseMapper.countUsable(param);
        param.checkPage(count,20);
        List<LogOrderIoListResponse> list = baseMapper.getListByRequest(param);
        Map<String, Object> map = new HashMap<>();
        map.put("total", count);
        map.put("list", list);
        map.put("page", param.getPage());
        return map;
    }


}