Authored by peuei

fix

... ... @@ -29,7 +29,10 @@ public class PublicArticleLabelService {
* @param targetObject
*/
public void deleteData(PublicArticleLabel targetObject) {
final PublicArticleLabel existObject = publicArticleLabelRepository.findByLabelIdAndArticleId(targetObject.getLabelId(), targetObject.getLabelId());
/**
* 一个文章可以关联多个标签
*/
final PublicArticleLabel existObject = publicArticleLabelRepository.findByLabelIdAndArticleId(targetObject.getLabelId(), targetObject.getArticleId());
if (existObject == null) {
log.info("get nothing from database by condition labelId and articleId with targetObject {}", targetObject.toString());
return;
... ... @@ -43,6 +46,11 @@ public class PublicArticleLabelService {
* @param targetObject
*/
public void updateData(PublicArticleLabel targetObject) {
final PublicArticleLabel existObject = publicArticleLabelRepository.findByLabelIdAndArticleId(targetObject.getLabelId(), targetObject.getArticleId());
if (existObject != null) {
log.error("something goes wrong, in this operation, there's no update , just only insert");
return;
}
publicArticleLabelRepository.save(targetObject);
}
}
... ...