package io.modules.item.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.util.StrUtil;
import io.common.service.impl.CrudServiceImpl;
import io.modules.item.dao.TopicDao;
import io.modules.item.dto.TopicDTO;
import io.modules.item.entity.TopicEntity;
import io.modules.item.service.TopicService;
import org.springframework.stereotype.Service;
import java.util.Map;

/**
 * 健康资讯
 */
@Service
public class TopicServiceImpl extends CrudServiceImpl<TopicDao, TopicEntity, TopicDTO> implements TopicService {

    @Override
    public QueryWrapper<TopicEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String title = (String)params.get("title");
        String view = (String)params.get("view");
        QueryWrapper<TopicEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.eq(StrUtil.isNotBlank(title), "title", title);
        wrapper.orderByDesc(StrUtil.isNotBlank(view), "view");
        return wrapper;
    }


}