From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001
From: lee <4766465@qq.com>
Date: Wed, 18 Dec 2024 13:27:00 +0800
Subject: [PATCH] init

---
 yami-shop-api/src/main/java/com/yami/shop/api/controller/ProdBrowseLogController.java |   66 +++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/ProdBrowseLogController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/ProdBrowseLogController.java
new file mode 100644
index 0000000..8fe5dd2
--- /dev/null
+++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/ProdBrowseLogController.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
+ *
+ * https://www.mall4j.com/
+ *
+ * 未经允许,不可做商业用途!
+ *
+ * 版权所有,侵权必究!
+ */
+package com.yami.shop.api.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yami.shop.bean.app.dto.ProductDto;
+import com.yami.shop.bean.model.ProdBrowseLog;
+import com.yami.shop.common.response.ServerResponseEntity;
+import com.yami.shop.common.util.PageParam;
+import com.yami.shop.security.api.util.SecurityUtils;
+import com.yami.shop.service.ProdBrowseLogService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+
+/**
+ * 商品浏览记录表
+ *
+ * @author LGH
+ * @date 2021-11-01 10:43:09
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/p/prodBrowseLog" )
+@Tag(name = "商品浏览记录表")
+public class ProdBrowseLogController {
+
+    private final ProdBrowseLogService prodBrowseLogService;
+
+    @GetMapping("/page")
+    @Operation(summary = "获取商品浏览记录表列表" , description = "分页获取商品浏览记录表列表")
+    public ServerResponseEntity<IPage<ProdBrowseLog>> page(PageParam<ProductDto> page) {
+        String userId = SecurityUtils.getUser().getUserId();
+        IPage<ProdBrowseLog> pageRes = prodBrowseLogService.pageByUserId(page, userId);
+        return ServerResponseEntity.success(pageRes);
+    }
+
+    @PostMapping
+    @Operation(summary = "保存商品浏览记录表" , description = "保存商品浏览记录表")
+    public ServerResponseEntity<Void> save(@Valid @RequestBody ProdBrowseLog prodBrowseLog) {
+        String userId = SecurityUtils.getUser().getUserId();
+        prodBrowseLog.setUserId(userId);
+        prodBrowseLogService.saveInfo(prodBrowseLog);
+        return ServerResponseEntity.success();
+    }
+
+    @DeleteMapping
+    @Operation(summary = "根据prodBrowseLogIds批量删除商品浏览记录" , description = "根据prodBrowseLogIds批量删除商品浏览记录")
+    public ServerResponseEntity<Void> deleteByIds(@RequestBody List<Long> prodBrowseLogIds) {
+        prodBrowseLogService.deleteByIds(prodBrowseLogIds, SecurityUtils.getUser().getUserId());
+        return ServerResponseEntity.success();
+    }
+
+}

--
Gitblit v1.9.3