提交 96663c41 authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 2bdff811
......@@ -18,8 +18,10 @@ import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.enums.resource.PriceOptionEnum;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.RelationAuthorMapper;
import com.zrqx.resource.bg.mapper.ResourceRelationMapper;
import com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryDiyTypeMapper;
import com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryLabelContentDiyTypeMapper;
......@@ -38,6 +40,7 @@ import com.zrqx.resource.commons.model.articlelibrary.ArticleLibraryDiyType;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibraryLabelContentDiyType;
import com.zrqx.resource.commons.model.membercollection.MemberCollection;
import com.zrqx.resource.commons.model.record.Record;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation;
import com.zrqx.resource.commons.model.shoppingcart.ShoppingCart;
import com.zrqx.resource.commons.vo.bg.articlelibrary.ArticleLibraryListVO;
......@@ -72,6 +75,8 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
private ArticleResourceMapper articleResourceMapper;
@Autowired
private ResourceRelationMapper resourceRelationMapper;
@Autowired
private RelationAuthorMapper bookAuthorMapper;
@Override
public BaseMapper<ArticleLibrary> getMapper() {
return mapper;
......@@ -82,13 +87,13 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
if(StringUtils.isNotBlank(form.getId())){
entity = mapper.selectByPrimaryKey(form.getId());
}
if(StringUtils.isNotBlank(form.getAuthorNameAndId())){
String[] authorNameAndId = form.getAuthorNameAndId().split(",");
form.setAuthor(authorNameAndId[0]);
if(authorNameAndId.length > 1){
form.setAuthorId(authorNameAndId[1]);
}
}
// if(StringUtils.isNotBlank(form.getAuthorNameAndId())){
// String[] authorNameAndId = form.getAuthorNameAndId().split(",");
// form.setAuthor(authorNameAndId[0]);
// if(authorNameAndId.length > 1){
// form.setAuthorId(authorNameAndId[1]);
// }
// }
BeanUtils.copyProperties(form, entity);
if(PriceOptionEnum.STATUS_0.getCode() == form.getPriceOption()){
entity.setRealPrice(new BigDecimal(0));
......@@ -120,6 +125,10 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
ArticleLibraryLabelContentDiyType alcdy = new ArticleLibraryLabelContentDiyType();
alcdy.setAlId(entity.getId());
alcdMapper.delete(alcdy);
// 删除作者关联表
RelationAuthor ba = new RelationAuthor();
ba.setResourceId(entity.getId());
bookAuthorMapper.delete(ba);
}
//添加当前对象与自定义分类的关系
if (form.getDiyTypeCode() != null && form.getDiyTypeCode().size() > 0) {
......@@ -143,6 +152,14 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
alcdMapper.insertList(aldcdList);
}
}
// 添加作者关系
if (ArrayUtils.isNotEmpty(form.getAuthorList())) {
List<RelationAuthor> baList = form.getAuthorList().stream().filter(a -> StringUtils.isNotBlank(a.getAuthor())).collect(Collectors.toList());
for (RelationAuthor li : baList) {
li.setResourceId(entity.getId());
}
bookAuthorMapper.insertList(baList);
}
return true;
}
@Override
......
......@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.List;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibraryLabelContentDiyType;
import com.zrqx.resource.commons.model.resourcerelation.RelationAuthor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -51,7 +52,8 @@ public class SaveUpdateArticleLibraryForm {
private Integer priceOption;
@ApiModelProperty("pdf名称")
private String pdfName;
@ApiModelProperty(value = "作者集合")
private List<RelationAuthor> authorList;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
private String authorNameAndId;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论