use of com.cas.sim.tis.entity.Preparation in project TeachingInSimulation by ScOrPiOzzy.
the class PreparationServiceImpl method findPreparationByTaskIdAndCreator.
@Override
public Preparation findPreparationByTaskIdAndCreator(Integer cid, int creator) {
Condition condition = new Condition(Preparation.class);
Criteria criteria = condition.createCriteria();
criteria.andEqualTo("catalogId", cid);
criteria.andEqualTo("creator", creator);
criteria.andEqualTo("del", 0);
List<Preparation> preparations = findByCondition(condition);
if (preparations.size() == 1) {
return preparations.get(0);
} else if (preparations.size() == 0) {
return null;
} else {
LOG.warn("关联编号{},创建人{}的有效备课信息应仅有一条!", cid, creator);
return preparations.get(0);
}
}
use of com.cas.sim.tis.entity.Preparation in project TeachingInSimulation by ScOrPiOzzy.
the class PreparationDetail method loadPreparation.
private void loadPreparation() {
int cid = task.getId();
int role = Session.get(Session.KEY_LOGIN_ROLE);
int creator = Session.get(Session.KEY_LOGIN_ID);
if (RoleConst.STUDENT == role) {
User user = SpringUtil.getBean(UserAction.class).findUserByID(creator);
creator = user.getTeacherId();
}
// 查询是否存在自定义备课内容
preparation = SpringUtil.getBean(PreparationAction.class).findPreparationByTaskIdAndCreator(cid, creator);
// 查询是否存在模版备课内容
if (preparation == null) {
// XXX 暂时规定默认备课模版创建人编号为0
preparation = SpringUtil.getBean(PreparationAction.class).findPreparationByTaskIdAndCreator(cid, 0);
}
if (preparation == null && RoleConst.TEACHER == role) {
preparation = new Preparation();
preparation.setCatalogId(cid);
preparation.setCreator(creator);
preparation = SpringUtil.getBean(PreparationAction.class).addPreparation(preparation);
}
}
Aggregations