添加订单表

This commit is contained in:
闵宪瑞 2025-02-14 14:33:13 +08:00
parent 7cd44d430b
commit e6a0556d9f
5 changed files with 20 additions and 11 deletions

View File

@ -78,4 +78,9 @@ public class ItemDTO implements Serializable {
* 评论信息信息
*/
private List<OrderDTO> orderEntityList;
/**
* 是否收藏
*/
private Boolean IsFavorite;
}

View File

@ -23,6 +23,13 @@ public interface UserBehaviorService extends CrudService<UserBehaviorEntity, Use
public List<Long> getTopItems();
/**
* 查询是否收藏
* @param itemId
* @param type
* @return
*/
Boolean getIsFavorite(Long itemId,Integer type);

View File

@ -43,6 +43,11 @@ public class OrderServiceImpl extends CrudServiceImpl<OrderDao, OrderEntity, Ord
return wrapper;
}
/**
* 获取评论数据列表
* @param id
* @return
*/
@Override
public List<OrderDTO> getCommintList(Long id) {
LambdaQueryWrapper<OrderEntity> lwq = new LambdaQueryWrapper<>();

View File

@ -77,18 +77,13 @@ public class UserBehaviorServiceImpl extends CrudServiceImpl<UserBehaviorDao, Us
@Override
public Boolean getIsFavorite(Long itemId, Integer type) {
LambdaQueryWrapper<UserBehaviorEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(UserBehaviorEntity::getItemId,itemId);
wrapper.eq(UserBehaviorEntity::getType,type);
List<UserBehaviorEntity> list = baseDao.selectList(wrapper);
if (list.isEmpty()){
return false;
}
return true;
}

View File

@ -74,7 +74,6 @@ public class ItemController {
return new Result<PageData<ItemDTO>>().ok(page);
}
@Login
@GetMapping("list")
@Operation(summary = "查询收藏")
@ -105,7 +104,6 @@ public class ItemController {
return new Result<List<ItemEntity>>().ok(res);
}
// 分析
@GetMapping("commit")
@Operation(summary = "评论人数排行")
@ -123,10 +121,11 @@ public class ItemController {
public Result<ItemDTO> get(@PathVariable("id") Long id){
ItemDTO data = itemService.get(id);
data.setImage(uploadUrl + data.getImage());
// 添加预览
data.setView(data.getView() + 1);
itemService.update(data);
// data.setIsFavorite(userBehaviorService.getIsFavorite(data.getId(),1));
//是否收藏
data.setIsFavorite(userBehaviorService.getIsFavorite(data.getId(),1));
return new Result<ItemDTO>().ok(data);
}
@ -138,7 +137,6 @@ public class ItemController {
itemService.save(dto);
return new Result();
}
@PutMapping
@Operation(summary = "修改")
public Result update(@RequestBody ItemDTO dto){ //效验数据
@ -147,7 +145,6 @@ public class ItemController {
itemService.update(dto);
return new Result();
}
@DeleteMapping
@Operation(summary = "删除")
public Result delete(@RequestBody Long[] ids){