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.NewsDao;
import io.hmit.modules.serviceOrder.dto.NewsDTO;
import io.hmit.modules.serviceOrder.entity.NewsEntity;
import io.hmit.modules.serviceOrder.service.NewsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 新闻管理
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-01-26
 */
@Service
public class NewsServiceImpl extends CrudServiceImpl<NewsDao, NewsEntity, NewsDTO> implements NewsService {

    @Override
    public QueryWrapper<NewsEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String status = (String)params.get("status");

        QueryWrapper<NewsEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.eq(StringUtils.isNotBlank(status), "status", status);

        return wrapper;
    }


}
