use of com.cas.sim.tis.services.LibraryService in project TeachingInSimulation by ScOrPiOzzy.
the class LibraryImportTest method importExcel.
private void importExcel(File source) {
String name = FileUtil.getFileName(source.getAbsolutePath());
Library library = new Library();
library.setName(name);
library.setNum(0);
library.setTime(100);
library.setType(0);
library.setCreator(1);
LibraryService libraryService = (LibraryService) libraryServiceFactory.getObject();
libraryService.save(library);
List<Library> librarys = libraryService.findAll();
library = librarys.get(librarys.size() - 1);
rid = library.getId();
List<Question> questions = new ArrayList<>();
if (!loadChoice(source, questions) || !loadJudgment(source, questions) || !loadBlank(source, questions) || !loadSubjective(source, questions)) {
return;
}
try {
SpringUtil.getBean(QuestionAction.class).addQuestions(rid, questions);
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.cas.sim.tis.services.LibraryService in project TeachingInSimulation by ScOrPiOzzy.
the class LibraryAction method deleteLibrary.
public void deleteLibrary(int id) {
LibraryService service = getService();
Library library = service.findById(id);
library.setDel(1);
library.setUpdater(Session.get(Session.KEY_LOGIN_ID));
service.update(library);
}
Aggregations