提交 f577cc38 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 96befbe0
......@@ -215,7 +215,7 @@ public class EbookController {
aldtservice.delete(articleDiyType);
//删除推荐关联的文章
ResourceRelation relation =new ResourceRelation();
relation.setObjectId(articleLibrary.getId());
relation.setResourceId(articleLibrary.getId());
resourceRelationService.delete(relation);
}
//删除关联文章
......@@ -549,7 +549,7 @@ public class EbookController {
article.setSalesNum(0);
try {
alservice.insert(article);
//关联关系建立
/*//关联关系建立
ResourceRelation relation =new ResourceRelation();
relation.setObjectId(book.getId());
relation.setResourceId(article.getId());
......@@ -557,7 +557,7 @@ public class EbookController {
relation.setSort(maxSort);
relation.setGoodsType(2);
relation.setUploadTime(new Date());
resourceRelationService.insert(relation);
resourceRelationService.insert(relation);*/
} catch (Exception e) {
throw new BaseException(ev.getBook().getIsbn());
}
......@@ -620,7 +620,20 @@ public class EbookController {
ev.getChapterSet().forEach(chapter -> {
chapter.setBookid(book.getId());
chapter.setBookName(book.getName());
// clservice.insert(chapter);
//关联关系建立
Example example1=alservice.createExample();
example1.createCriteria().andEqualTo("bookId",book.getId()).andEqualTo("markid", chapter.getMarkid());
List<ArticleLibrary> list = alservice.selectByExample(example1);
if(list.size()>0) {
ResourceRelation relation1 =new ResourceRelation();
relation1.setObjectId(book.getId());
relation1.setResourceId(list.get(0).getId());
relation1.setSort(chapter.getOrderNum());
relation1.setGoodsType(2);
relation1.setUploadTime(new Date());
resourceRelationService.insert(relation1);
}
});
clservice.insertList(new ArrayList(ev.getChapterSet()));
try {
......@@ -665,12 +678,7 @@ public class EbookController {
edt.setCode(ev.getCode());
edt.setDiyTypeId(ev.getDtId());
dtservice.insert(edt);
ev.getChapterSet().forEach(chapter -> {
chapter.setBookid(ev.getBook().getId());
chapter.setBookName(ev.getBook().getName());
// clservice.insert(chapter);
});
clservice.insertList(new ArrayList(ev.getChapterSet()));
// 文章分类关联表
ev.getArticleSet().forEach(article -> {
article.setAuthor(ev.getBook().getAuthor());
......@@ -686,7 +694,7 @@ public class EbookController {
article.setSalesNum(0);
try {
alservice.insert(article);
//关联关系建立
/*//关联关系建立
ResourceRelation relation =new ResourceRelation();
relation.setObjectId(ev.getEbook().getId());
relation.setResourceId(article.getId());
......@@ -694,7 +702,7 @@ public class EbookController {
relation.setSort(maxSort);
relation.setGoodsType(2);
relation.setUploadTime(new Date());
resourceRelationService.insert(relation);
resourceRelationService.insert(relation);*/
} catch (Exception e) {
throw new BaseException(ev.getBook().getIsbn());
}
......@@ -704,6 +712,25 @@ public class EbookController {
aldt.setDtId(ev.getDtId());
aldtservice.insertSelective(aldt);
});
ev.getChapterSet().forEach(chapter -> {
chapter.setBookid(ev.getBook().getId());
chapter.setBookName(ev.getBook().getName());
// clservice.insert(chapter);
//关联关系建立
Example example2=alservice.createExample();
example2.createCriteria().andEqualTo("bookId",ev.getBook().getId()).andEqualTo("markid", chapter.getMarkid());
List<ArticleLibrary> list = alservice.selectByExample(example2);
if(list.size()>0) {
ResourceRelation relation =new ResourceRelation();
relation.setObjectId(ev.getBook().getId());
relation.setResourceId(list.get(0).getId());
relation.setSort(chapter.getOrderNum());
relation.setGoodsType(2);
relation.setUploadTime(new Date());
resourceRelationService.insert(relation);
}
});
clservice.insertList(new ArrayList(ev.getChapterSet()));
// 删除当前对象与年份的关系
EbookMainBodyRelation relation = new EbookMainBodyRelation();
relation.setObjectId(ev.getEbook().getId());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论