SD
private final TagService tagService;
private final ArticleRepository articleRepository;
private final TagRepository tagRepository;
private final UserRepository userRepository;
@Autowired
public ArticleServiceImpl(TagService tagService, ArticleRepository articleRepository, TagRepository tagRepository, UserRepository userRepository) {
this.tagService = tagService;
this.articleRepository = articleRepository;
this.tagRepository = tagRepository;
this.userRepository = userRepository;
}
@Override
@Transactional
public void articleAdd(String userId, String title, String describeInfo, String tagInfos, String details, String detailsHtml, String status) {
ArticleEntity articleEntity = new ArticleEntity();
articleEntity.setId(UUIDUtils.getUUID());
articleEntity.setState(Integer.parseInt(status));
articleEntity.setTitle(title);
articleEntity.setDetails(details);
articleEntity.setDescribeInfo(describeInfo);
articleEntity.setDetailsHtml(detailsHtml);
articleEntity.setCreateTime(new Date());
articleEntity.setCreatePerson(userId);
articleEntity.setUpdateTime(new Date());
articleRepository.save(articleEntity);
tagService.tagAdd(userId,tagInfos, articleEntity.getId());
}