package com.sptg.estate.biz.service.impl;

import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.common.core.constant.OperationConstant;
import com.sptg.estate.api.dto.IntegratedServiceDto;
import com.sptg.estate.api.entity.IntegratedService;
import com.sptg.estate.biz.mapper.IntegratedServiceMapper;
import com.sptg.estate.biz.service.IntegratedServiceInterface;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

/**
 * title: MemberAndUserServicelmpl
 * package: com.sptg.estate.biz.security.impl
 * description: 综合服务方  服务层实现类
 *
 *               
 *                
 */
@Service
public class IntegratedServicelmpl extends ServiceImpl<IntegratedServiceMapper, IntegratedService> implements IntegratedServiceInterface {

    @Override
    public ResultBean<Page<IntegratedService>> showList(IntegratedServiceDto integratedServiceDto) {
        // 构建查询条件
        Wrapper<IntegratedService> wrapper = new EntityWrapper<>();
        //状态正常的数据
        wrapper.eq("i_status", OperationConstant.ZERO);
        //跟机构id
        wrapper.eq("l_root_org_id", integratedServiceDto.getRootOrgId());
        //根据名字查询
        if (StringUtils.isNotBlank(integratedServiceDto.getName())) {
            wrapper.like("s_name", integratedServiceDto.getName());
        }
        return new ResultBean<>(ResultEnum.SUCCESS, this.selectPage(integratedServiceDto.getPage(),wrapper));
    }
}
