package com.huimv.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huimv.admin.common.utils.Result;
import com.huimv.admin.common.utils.ResultCode;
import com.huimv.admin.entity.BizBaseStage;
import com.huimv.admin.mapper.BizBaseStageMapper;
import com.huimv.admin.service.IBizBaseStageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2023-09-20
 */
@Service
public class BizBaseStageServiceImpl extends ServiceImpl<BizBaseStageMapper, BizBaseStage> implements IBizBaseStageService {
    @Resource
    private BizBaseStageMapper bizBaseStageMapper;
    @Override
    public Result listBizBaseStage(Map<String, String> param) {
        String pageNo = param.get("pageNo");
        String pageSize = param.get("pageSize");
        String stageCode = param.get("stageCode");
        String stageName = param.get("stageName");

        Page<BizBaseStage> page = new Page<>(Integer.valueOf(pageNo), Integer.valueOf(pageSize));
        QueryWrapper<BizBaseStage> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotBlank(stageCode),"stage_code", stageCode);
        queryWrapper.like(StringUtils.isNotBlank(stageName),"stage_name", stageName);
        Page<BizBaseStage> bizBaseStagePage = bizBaseStageMapper.selectPage(page, queryWrapper);
        return new Result(ResultCode.SUCCESS,bizBaseStagePage);
    }
}
