package com.zjrs.ggfw.shbzk.blo.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.mohrss.leaf.core.framework.domain.blo.impl.BLOImpl;
import org.mohrss.leaf.core.framework.persistens.PageResult;
import org.mohrss.leaf.core.framework.persistens.PageUtil;
import com.zjrs.ggfw.shbzk.blo.ShbzkBLO;
import com.zjrs.ggfw.shbzk.dto.FwwdQueryDTO;
import com.zjrs.ggfw.shbzk.entity.VRsShbzkFwwdMapper;
import com.zjrs.ggfw.shbzk.po.VRsShbzkFwwd;
import org.springframework.stereotype.Service;

@Service
public class ShbzkBLOImpl extends BLOImpl implements ShbzkBLO {

	@Resource
	VRsShbzkFwwdMapper vRsShbzkFwwdMapper;
	
	@Override
	public PageResult querySbkfwwd(FwwdQueryDTO dto) {
		QueryWrapper<VRsShbzkFwwd> queryWrapper = new QueryWrapper<>();
		//地区
		if(StringUtils.isNotBlank(dto.getDq())) {
			queryWrapper.eq("dq", dto.getDq());
		}
		queryWrapper.eq("ts_yxbz", "1");
    	queryWrapper.orderByAsc("jgmc");
    	
    	Page<VRsShbzkFwwd> page = new Page<>(dto.getPagenum(), dto.getPagesize());
    	Page<VRsShbzkFwwd> pageResult = (Page) this.vRsShbzkFwwdMapper.selectPage(page, queryWrapper);
        PageResult result = PageUtil.PageResult(pageResult);
		return result;
	}
	
}