Search in sources :

Example 1 with LibraryService

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();
    }
}
Also used : QuestionAction(com.cas.sim.tis.action.QuestionAction) ArrayList(java.util.ArrayList) Question(com.cas.sim.tis.entity.Question) Library(com.cas.sim.tis.entity.Library) LibraryService(com.cas.sim.tis.services.LibraryService)

Example 2 with LibraryService

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);
}
Also used : Library(com.cas.sim.tis.entity.Library) LibraryService(com.cas.sim.tis.services.LibraryService)

Aggregations

Library (com.cas.sim.tis.entity.Library)2 LibraryService (com.cas.sim.tis.services.LibraryService)2 QuestionAction (com.cas.sim.tis.action.QuestionAction)1 Question (com.cas.sim.tis.entity.Question)1 ArrayList (java.util.ArrayList)1