|
|
@ -21,6 +21,8 @@ import com.tamguo.modules.book.model.DocumentEntity;
|
|
|
|
import com.tamguo.modules.book.model.enums.DocumentStatusEnum;
|
|
|
|
import com.tamguo.modules.book.model.enums.DocumentStatusEnum;
|
|
|
|
import com.tamguo.modules.book.service.IBookService;
|
|
|
|
import com.tamguo.modules.book.service.IBookService;
|
|
|
|
import com.tamguo.modules.book.service.IDocumentService;
|
|
|
|
import com.tamguo.modules.book.service.IDocumentService;
|
|
|
|
|
|
|
|
import com.tamguo.modules.member.model.MemberEntity;
|
|
|
|
|
|
|
|
import com.tamguo.modules.member.service.IMemberService;
|
|
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
@Controller
|
|
|
|
public class BookController {
|
|
|
|
public class BookController {
|
|
|
@ -31,14 +33,19 @@ public class BookController {
|
|
|
|
private IBookService iBookService;
|
|
|
|
private IBookService iBookService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IDocumentService iDocumentService;
|
|
|
|
private IDocumentService iDocumentService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMemberService iMemberService;
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@RequestMapping(value="book/{id}.html" , method=RequestMethod.GET)
|
|
|
|
@RequestMapping(value="book/{id}.html" , method=RequestMethod.GET)
|
|
|
|
public ModelAndView book(@PathVariable String id , ModelAndView model) {
|
|
|
|
public ModelAndView book(@PathVariable String id , ModelAndView model) {
|
|
|
|
BookEntity book = iBookService.selectById(id);
|
|
|
|
BookEntity book = iBookService.selectById(id);
|
|
|
|
|
|
|
|
MemberEntity member = iMemberService.selectById(book.getOwner());
|
|
|
|
|
|
|
|
if(member != null) {
|
|
|
|
|
|
|
|
book.setOwner(member.getUsername());
|
|
|
|
|
|
|
|
}
|
|
|
|
model.addObject("book", book);
|
|
|
|
model.addObject("book", book);
|
|
|
|
model.setViewName("book/book");
|
|
|
|
model.setViewName("book/book");
|
|
|
|
|
|
|
|
|
|
|
|
// 查询第一章
|
|
|
|
// 查询第一章
|
|
|
|
List<DocumentEntity> documentList = iDocumentService.selectList(Condition.create().eq("book_id", id).eq("status", DocumentStatusEnum.NORMAL.getValue()).eq("parent_id", "0").orderAsc(Arrays.asList("create_date")));
|
|
|
|
List<DocumentEntity> documentList = iDocumentService.selectList(Condition.create().eq("book_id", id).eq("status", DocumentStatusEnum.NORMAL.getValue()).eq("parent_id", "0").orderAsc(Arrays.asList("create_date")));
|
|
|
|
if(!CollectionUtils.isEmpty(documentList)) {
|
|
|
|
if(!CollectionUtils.isEmpty(documentList)) {
|
|
|
|