|
@@ -7,6 +7,7 @@ import com.zglc.fm.entity.BookEntity;
|
|
|
//import com.zglc.fm.entity.FaultEntity;
|
|
|
import com.zglc.fm.entity.CatalogueEntity;
|
|
|
import com.zglc.fm.utils.DocToPdf;
|
|
|
+import com.zglc.fm.utils.ExcelUtils;
|
|
|
import com.zglc.fm.utils.FileTypeUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import tk.mybatis.mapper.entity.Example;
|
|
@@ -113,12 +114,23 @@ public class BookService {
|
|
|
return bookDao.findByName("%" + name + "%");
|
|
|
}
|
|
|
|
|
|
- public List<CatalogueEntity> listAllDoccatalogue(Integer bookId) {
|
|
|
+ public List<CatalogueEntity> listAllDoccatalogue(Integer bookId) throws Exception {
|
|
|
// return catalogueDao.listAllDoccatalogue(bookId);
|
|
|
- Example example = new Example(CatalogueEntity.class);
|
|
|
- Example.Criteria criteria = example.createCriteria();
|
|
|
- criteria.andEqualTo("book_id", bookId);
|
|
|
- return catalogueDao.selectByExample(example);
|
|
|
+ BookEntity data = bookDao.selectByPrimaryKey(bookId);
|
|
|
+ if (data.getFile_path().endsWith(ExcelUtils.DOC) || data.getFile_path().endsWith(ExcelUtils.DOCX)){
|
|
|
+ if (data.getIs_catalogue()!=1){
|
|
|
+ addDoccatalogue(bookId);
|
|
|
+ data.setIs_catalogue(1);
|
|
|
+ edit(data);
|
|
|
+ }
|
|
|
+ Example example = new Example(CatalogueEntity.class);
|
|
|
+ Example.Criteria criteria = example.createCriteria();
|
|
|
+ criteria.andEqualTo("book_id", bookId);
|
|
|
+ return catalogueDao.selectByExample(example);
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public BookEntity getOutline(Integer id) {
|