use of com.zyd.blog.business.entity.ArticleTags in project OneBlog by zhangyd-c.
the class BizArticleTagsServiceImpl method insertList.
/**
* 批量添加
*
* @param tagIds
* @param articleId
*/
@Override
public void insertList(Long[] tagIds, Long articleId) {
if (tagIds == null || tagIds.length == 0) {
return;
}
List<ArticleTags> list = new ArrayList<>();
ArticleTags articleTags = null;
for (Long tagId : tagIds) {
articleTags = new ArticleTags();
articleTags.setTagId(tagId);
articleTags.setArticleId(articleId);
list.add(articleTags);
}
this.insertList(list);
}
use of com.zyd.blog.business.entity.ArticleTags in project OneBlog by zhangyd-c.
the class BizArticleTagsServiceImpl method insertList.
/**
* 批量插入,支持批量插入的数据库可以使用,例如MySQL,H2等,另外该接口限制实体包含id属性并且必须为自增列
*
* @param entities
*/
@Override
public void insertList(List<ArticleTags> entities) {
Assert.notNull(entities, "ArticleTagss不可为空!");
List<BizArticleTags> list = new ArrayList<>();
for (ArticleTags entity : entities) {
entity.setUpdateTime(new Date());
entity.setCreateTime(new Date());
list.add(entity.getBizArticleTags());
}
bizArticleTagsMapper.insertList(list);
}
Aggregations