package com.unis.crk.business.qcrk.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.business.qcrk.entity.FlBillRelation;
import com.unis.crk.business.qcrk.entity.vo.FlBillRelationVo;
import com.unis.crk.business.qcrk.mapper.FlBillRelationMapper;
import com.unis.crk.business.qcrk.service.IFlBillRelationService;
import com.unis.crk.utils.ResultUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 通知单状态表 服务实现类
 * </p>
 *
 * @author TangSong
 * @since 2021-10-13
 */
@Service
public class FlBillRelationServiceImpl extends ServiceImpl<FlBillRelationMapper, FlBillRelation> implements IFlBillRelationService {

    @Resource
    private FlBillRelationMapper flBillRelationMapper;


    /**
     * 按照条件查询通知单状态表信息
     *
     * @param pageQuery
     * @throws Exception
     */
    @Override
    public IPage<Map<String, Object>> findPageVo(FlBillRelationVo pageQuery) {
        {
            //条形查询器
            QueryWrapper<FlBillRelation> queryWrapper = new QueryWrapper<>();
            if (StringUtils.isNotBlank(pageQuery.getBizNo())) {
                queryWrapper.like("bizNo", ResultUtil.getQueryWrapperformat(pageQuery.getBizNo()));
            }
            //分页相关
            Page<FlBillRelation> p = new Page<>(pageQuery.getPage(), pageQuery.getLimit());

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

}
