|
@@ -11,7 +11,9 @@ import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.vo.QuestionIds2VO;
|
|
|
+import com.diagbot.vo.QuestionNameVO;
|
|
|
import com.diagbot.vo.QuestionVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -105,6 +107,36 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据名称获取标签
|
|
|
+ *
|
|
|
+ * @param questionNameVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public QuestionDTO getByName(QuestionNameVO questionNameVO) {
|
|
|
+ QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ List<Integer> sexTypeList = Lists.newArrayList();
|
|
|
+ sexTypeList.add(questionNameVO.getSexType());
|
|
|
+ if (!questionNameVO.getSexType().equals(3)) {
|
|
|
+ sexTypeList.add(3);
|
|
|
+ }
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in(ListUtil.isNotEmpty(sexTypeList), "sex_type", sexTypeList)
|
|
|
+ .apply("({0} between age_begin and age_end)", questionNameVO.getAge())
|
|
|
+ .eq("tag_name", questionNameVO.getName());
|
|
|
+ QuestionInfo questionInfo = this.getOne(questionInfoQueryWrapper);
|
|
|
+ if (questionInfo != null) {
|
|
|
+ QuestionVO questionVO = new QuestionVO();
|
|
|
+ questionVO.setId(questionInfo.getId());
|
|
|
+ questionVO.setSexType(questionNameVO.getSexType());
|
|
|
+ questionVO.setAge(questionNameVO.getAge());
|
|
|
+ QuestionDTO questionDTO = this.getById(questionVO);
|
|
|
+ return questionDTO;
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询多个id返回标签内容
|
|
@@ -223,5 +255,4 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
mappIds.addAll(list);
|
|
|
return EntityUtil.makeEntityListMap(questionMapping1, "parentQuestion");
|
|
|
}
|
|
|
-
|
|
|
}
|