diff --git a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/SearchHistoryController.java b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/SearchHistoryController.java index e75c2e2..4ccab69 100644 --- a/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/SearchHistoryController.java +++ b/waynboot-mobile-api/src/main/java/com/wayn/mobile/api/controller/SearchHistoryController.java @@ -1,13 +1,14 @@ package com.wayn.mobile.api.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.wayn.common.base.BaseController; import com.wayn.common.util.R; +import com.wayn.mobile.api.domain.SearchHistory; import com.wayn.mobile.api.service.ISearchHistoryService; +import com.wayn.mobile.framework.security.util.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** *
@@ -28,4 +29,23 @@ public class SearchHistoryController extends BaseController {
public R list() {
return R.success().add("data", iSearchHistoryService.selectList());
}
+
+ @PostMapping
+ public R add(@RequestBody SearchHistory searchHistory) {
+ Long memberId = SecurityUtils.getUserId();
+ searchHistory.setUserId(memberId);
+ return R.result(iSearchHistoryService.save(searchHistory));
+ }
+
+ @DeleteMapping("{id}")
+ public R delete(@PathVariable Long id) {
+ return R.result(iSearchHistoryService.removeById(id));
+ }
+
+ @DeleteMapping("all")
+ public R delete() {
+ Long memberId = SecurityUtils.getUserId();
+ return R.result(iSearchHistoryService.remove(new QueryWrapper