package io.hmit.modules.serviceOrder.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionServiceDao;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
import io.hmit.modules.serviceOrder.service.PensionServiceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 服务表
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-01-26
 */
@Service
public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao, PensionServiceEntity, PensionServiceDTO> implements PensionServiceService {

    @Override
    public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String serviceTypeId = params.get("serviceTypeId") ==null?"":params.get("serviceTypeId").toString();
        String isFree = (String)params.get("isFree");


        QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.eq(StringUtils.isNotBlank(serviceTypeId), "service_type_id", serviceTypeId);
        wrapper.eq(StringUtils.isNotBlank(isFree), "is_free", isFree);

        return wrapper;
    }


}
