Commit bdc0bbcb authored by shiyu's avatar shiyu

Merge remote-tracking branch 'origin/quanku_0914' into quanku_0914

parents 26d699b1 873b5665
......@@ -62,7 +62,6 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
FavoritesItemsRelationExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(favoritesId, criteria::andFavoritesIdEqualTo);
JdbcHelper.ifPresent(favoritesIds, criteria::andFavoritesIdIn);
example.orderBy("add_time desc");
return favoritesItemsRelationMapper.selectByExample(example);
}
......@@ -80,7 +79,7 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
FavoritesItemsRelationExample example = new FavoritesItemsRelationExample();
FavoritesItemsRelationExample.Criteria criteria = example.createCriteria();
criteria.andFavoritesIdEqualTo(favoritesId);
example.orderBy("add_time desc");
example.orderBy("update_time desc");
PageHelper.startPage(page, size);
List<FavoritesItemsRelation> list = favoritesItemsRelationMapper.selectByExample(example);
return new PageInfo<>(list);
......@@ -94,7 +93,7 @@ public class FavoritesItemsRelationDaoImpl implements FavoritesItemsRelationDao
if (type == 1) {
criteria.andFavoritesIdEqualTo(0L);
}
example.orderBy("add_time desc");
example.orderBy("update_time desc");
PageHelper.startPage(page, size);
List<FavoritesItemsRelation> list = favoritesItemsRelationMapper.selectByExample(example);
return new PageInfo<>(list);
......
......@@ -463,6 +463,17 @@ public class ItemServiceImpl implements ItemService {
public Result del(ItemRequestDto dto) {
try {
itemDao.deleteById(dto.getId());
UserItemsRelation userItemsRelation = userItemsRelationDao.find(dto.getId());
if (Objects.nonNull(userItemsRelation)) {
FavoritesItemsRelation favoritesItemsRelation = favoritesItemsRelationDao.selectByUserIdItemId(userItemsRelation.getUserId(), dto.getId());
if (Objects.nonNull(favoritesItemsRelation)) {
Long favoritesId = favoritesItemsRelation.getFavoritesId();
favoritesItemsRelationDao.deleteByUserIdItemId(userItemsRelation.getUserId(), dto.getId());
// 更新收藏册
favoritesDao.updateTime(favoritesId, null);
}
}
logger.info("【请求结束】藏品删除成功");
return Result.success();
} catch (Exception e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment