Search in sources :

Example 46 with Condition

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;
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) CatalogMapper(com.cas.sim.tis.mapper.CatalogMapper) Criteria(tk.mybatis.mapper.entity.Example.Criteria) Catalog(com.cas.sim.tis.entity.Catalog)

Example 47 with Condition

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);
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) Criteria(tk.mybatis.mapper.entity.Example.Criteria)

Example 48 with 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);
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) ElecCompMapper(com.cas.sim.tis.mapper.ElecCompMapper) TooManyResultsException(org.apache.ibatis.exceptions.TooManyResultsException) ElecComp(com.cas.sim.tis.entity.ElecComp) Criteria(tk.mybatis.mapper.entity.Example.Criteria)

Example 49 with Condition

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);
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) Criteria(tk.mybatis.mapper.entity.Example.Criteria)

Example 50 with 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);
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) Criteria(tk.mybatis.mapper.entity.Example.Criteria)

Aggregations

Condition (tk.mybatis.mapper.entity.Condition)69 Criteria (tk.mybatis.mapper.entity.Example.Criteria)25 Transactional (org.springframework.transaction.annotation.Transactional)21 PostMapping (org.springframework.web.bind.annotation.PostMapping)21 MachineOrder (com.eservice.api.model.machine_order.MachineOrder)15 Machine (com.eservice.api.model.machine.Machine)13 TaskRecord (com.eservice.api.model.task_record.TaskRecord)10 Date (java.util.Date)10 PageInfo (com.github.pagehelper.PageInfo)9 ArrayList (java.util.ArrayList)9 ProcessRecord (com.eservice.api.model.process_record.ProcessRecord)8 ServerToClientMsg (com.eservice.api.service.mqtt.ServerToClientMsg)7 Contract (com.eservice.api.model.contract.Contract)6 ContractSign (com.eservice.api.model.contract_sign.ContractSign)6 Task (com.eservice.api.model.task.Task)6 PanoramicRealTimeConsumptionGather (com.monitor.model.realtimeconsumptiongather.PanoramicRealTimeConsumptionGather)6 OrderSign (com.eservice.api.model.order_sign.OrderSign)5 User (com.cas.sim.tis.entity.User)4 User (com.eservice.api.model.user.User)4 AbnormalRecord (com.eservice.api.model.abnormal_record.AbnormalRecord)3