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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.fhjw.dao.FhjwQuestionDao;
import io.hmit.modules.fhjw.dto.FhjwQuestionDTO;
import io.hmit.modules.fhjw.entity.FhjwQuestionEntity;
import io.hmit.modules.fhjw.service.FhjwQuestionService;
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-06-02
 */
@Service
public class FhjwQuestionServiceImpl extends CrudServiceImpl<FhjwQuestionDao, FhjwQuestionEntity, FhjwQuestionDTO> implements FhjwQuestionService {

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

        QueryWrapper<FhjwQuestionEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.eq(StringUtils.isNotBlank(tempId), "temp_id", tempId);
        wrapper.like(StringUtils.isNotBlank(question), "question", question);

        return wrapper;
    }


}
