package com.unis.crk.basic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.unis.crk.basic.entity.BasicTank;
import com.unis.crk.basic.entity.vo.BasicTankVo;
import com.unis.crk.basic.mapper.BasicTankMapper;
import com.unis.crk.basic.service.IBasicTankService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 油罐信息 服务实现类
 * </p>
 *
 * @author TangSong
 * @since 2021-11-25
 */
@Service
public class BasicTankServiceImpl extends ServiceImpl<BasicTankMapper, BasicTank> implements IBasicTankService {

    @Resource
    private BasicTankMapper basicTankMapper;

    /**
     * 按照条件查询油罐信息信息
     * @param pageQuery
     * @throws Exception
     */
    @Override
    public IPage<Map<String,Object>> findPageVo(BasicTankVo pageQuery){
        {
        //条形查询器
        QueryWrapper<BasicTank> queryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank(pageQuery.getBizNo())){
           queryWrapper.like("bizNo",pageQuery.getBizNo());
        }
        //分页相关
        Page<BasicTank> p =new Page<>(pageQuery.getPage(),pageQuery.getLimit());

        IPage<Map<String,Object>> page = basicTankMapper.selectMyMapsPage(p,queryWrapper);
        return page;
        }
    }

}
