use of tk.mybatis.mapper.entity.Condition in project TeachingInSimulation by ScOrPiOzzy.
the class CatalogServiceImpl method findCatalogsByParentId.
@Override
public List<Catalog> findCatalogsByParentId(Integer rid) {
Condition condition = new Condition(Catalog.class);
Criteria criteria = condition.createCriteria();
criteria.andEqualTo("rid", rid);
criteria.andEqualTo("del", 0);
CatalogMapper catalogMapper = (CatalogMapper) mapper;
catalogMapper.selectByCondition(condition);
List<Catalog> catalogs = null;
try {
catalogs = catalogMapper.selectByCondition(condition);
LOG.debug("查询到子节点数量:{}", catalogs.size());
} catch (Exception e) {
LOG.error("查询ID{}下子节点失败!", rid);
catalogs = Collections.emptyList();
}
return catalogs;
}
use of tk.mybatis.mapper.entity.Condition in project TeachingInSimulation by ScOrPiOzzy.
the class ClassServiceImpl method findClassesByTeacher.
@Override
public List<Class> findClassesByTeacher(int teacherId) {
Condition condition = new Condition(Class.class);
condition.orderBy("createDate").desc();
Criteria criteria = condition.createCriteria();
criteria.andEqualTo("teacherId", teacherId);
criteria.andEqualTo("del", 0);
return findByCondition(condition);
}
use of tk.mybatis.mapper.entity.Condition in project TeachingInSimulation by ScOrPiOzzy.
the class ElecCompServiceImpl method findElecCompByModel.
@Override
public ElecComp findElecCompByModel(String model) {
ElecCompMapper dao = (ElecCompMapper) mapper;
Condition condition = new Condition(ElecComp.class);
Criteria criteria = condition.createCriteria();
criteria.andEqualTo("model", model);
List<ElecComp> compList = dao.selectByCondition(condition);
if (compList.size() == 0) {
return null;
} else if (compList.size() > 1) {
throw new TooManyResultsException();
}
return compList.get(0);
}
use of tk.mybatis.mapper.entity.Condition in project TeachingInSimulation by ScOrPiOzzy.
the class QuestionServiceImpl method countQuestionByLibrary.
@Override
public int countQuestionByLibrary(int rid) {
Condition condition = new Condition(Question.class);
Criteria criteria = condition.createCriteria();
criteria.andEqualTo("relateId", rid);
return getTotalBy(condition);
}
use of tk.mybatis.mapper.entity.Condition in project TeachingInSimulation by ScOrPiOzzy.
the class QuestionServiceImpl method findQuestionsByLibraryAndQuestionType.
@Override
public List<Question> findQuestionsByLibraryAndQuestionType(int rid, int type) {
Condition condition = new Condition(Question.class);
Criteria criteria = condition.createCriteria();
criteria.andEqualTo("relateId", rid);
criteria.andEqualTo("type", type);
return findByCondition(condition);
}
Aggregations