package com.elephant.framework.galaxy.aroad.module.zhjg.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.zhjg.entity.ZhjgLzglCxysxk;
import com.elephant.framework.galaxy.aroad.module.zhjg.mapper.ZhjgLzglCxysxkMapper;
import com.elephant.framework.galaxy.aroad.module.zhjg.service.ZhjgLzglCxysxkService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 超限运输许可表
 *
 * @author wangjian
 * @date 2019-03-27 17:46:24
 */
@Service
@AllArgsConstructor
public class ZhjgLzglCxysxkServiceImpl extends ServiceImpl<ZhjgLzglCxysxkMapper, ZhjgLzglCxysxk> implements ZhjgLzglCxysxkService {

    private final ZhjgLzglCxysxkMapper ZhjgLzglCxysxkMapper;
    /**
     * 通过时间查询该时间段内的数据
     * @param startDate
     * @param endDate
     * @return
     */
    public List<ZhjgLzglCxysxk> findZhjgLzglCxysxkByDate(String startDate, String endDate){
        return ZhjgLzglCxysxkMapper.selectList(Wrappers.<ZhjgLzglCxysxk>query().lambda().
                ge(ZhjgLzglCxysxk::getRq,startDate).le(ZhjgLzglCxysxk::getRq,endDate));
    }

    /**
     *  根据许可单号查询超限许可信息是否已存在
     * @param xkdh
     * @return
     */
    public Integer getZhjgLzglCxysxkByXkdh(String xkdh){
        return ZhjgLzglCxysxkMapper.selectCount(Wrappers.<ZhjgLzglCxysxk>query().lambda().eq(ZhjgLzglCxysxk::getXkdh,xkdh));
    }
}
