|
|
@@ -412,16 +412,36 @@ public class _ContentController extends JBaseCRUDController<Content> {
|
|
|
|
|
|
boolean isSameAsOld = true;
|
|
|
Content oldContent = null;
|
|
|
+ List<BigInteger> ids = getOrCreateTaxonomyIds(content.getModule());
|
|
|
if (content.getId() != null) {
|
|
|
oldContent = ContentQuery.me().findById(content.getId());
|
|
|
|
|
|
//判断内容是否改变,否则不提交到数据库
|
|
|
- //TODO content 与 oldContent 数据一致了
|
|
|
+ // content 与 oldContent 数据一致了
|
|
|
+
|
|
|
+ //元数据
|
|
|
+ List<Metadata> oldContentListMetas = oldContent.getMetadatas();
|
|
|
+ Map<String, String> oldContentMapMetas = new HashMap<String, String>();
|
|
|
+ if (oldContentListMetas != null) {
|
|
|
+ for (Metadata metadata : oldContentListMetas) {
|
|
|
+ oldContentMapMetas.put(metadata.getMetaKey(), metadata.getMetaValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //分类
|
|
|
+ List<Mapping> oldContentMappings = MappingQuery.me().findListByContentId(oldContent.getId());
|
|
|
+ List<BigInteger> oldTaxonomyIds = new ArrayList<BigInteger>();
|
|
|
+ if (oldContentMappings != null && oldContentMappings.size() > 0) {
|
|
|
+ for (Mapping mapping : oldContentMappings) {
|
|
|
+ oldTaxonomyIds.add(mapping.getTaxonomyId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (!StringUtils.isEqual(content.getAuthor(),oldContent.getAuthor())) {
|
|
|
isSameAsOld = false;
|
|
|
- } else if (!MyCollectionUtils.isEqualCollection(content.getMetadatas(),oldContent.getMetadatas())) {
|
|
|
+ } else if (!(oldContentMapMetas.equals(metas) || (oldContentMapMetas.size() == 0 && metas == null))) {
|
|
|
isSameAsOld = false;
|
|
|
- } else if (!MyCollectionUtils.isEqualCollection(content.getTaxonomys(),oldContent.getTaxonomys())) {
|
|
|
+ } else if (!MyCollectionUtils.isEqualCollection(ids,oldTaxonomyIds)) {
|
|
|
isSameAsOld = false;
|
|
|
} else if (!StringUtils.isEqual(content.getTitle(),oldContent.getTitle())) {
|
|
|
isSameAsOld = false;
|
|
|
@@ -455,7 +475,6 @@ public class _ContentController extends JBaseCRUDController<Content> {
|
|
|
|
|
|
content.updateCommentCount();
|
|
|
|
|
|
- List<BigInteger> ids = getOrCreateTaxonomyIds(content.getModule());
|
|
|
if (ids == null || ids.size() == 0) {
|
|
|
MappingQuery.me().deleteByContentId(content.getId());
|
|
|
} else {
|