/* package com.ltkj.web.controller.mall; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.utils.ResponseUtil; import com.ltkj.framework.config.UserHoder; import com.ltkj.hosp.domain.Wxuser; import com.ltkj.mall.domain.MallKeyword; import com.ltkj.mall.domain.MallSearchHistory; import com.ltkj.mall.service.IMallKeywordService; import com.ltkj.mall.service.IMallSearchHistoryService; import com.ltkj.web.controller.app.CurrentMember; import io.swagger.annotations.Api; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; import javax.validation.constraints.NotEmpty; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; */ /** * @Company: 西安路泰科技有限公司 * @Author: lige * @Date: 2023/7/13 08:53 *//* @RestController @RequestMapping("/cus/history") @Validated @Api(tags = "mall小程序搜索历史") public class WxMallSearchHistoryController{ private final Log logger = LogFactory.getLog(WxMallSearchHistoryController.class); @Autowired private IMallKeywordService mallKeywordService; @Resource private IMallSearchHistoryService searchHistoryService; */ /** * 搜索页面信息 * 如果用户已登录,则给出用户历史搜索记录; * 如果没有登录,则给出空历史搜索记录。 *//* @GetMapping("index") public AjaxResult index() { Wxuser wxuser = UserHoder.getWxuser(); if (null != wxuser) { List historyList = null; if (wxuser != null) { //取出用户历史关键字 LambdaQueryWrapper wq=new LambdaQueryWrapper(); wq.eq(MallSearchHistory::getUserId,wxuser.getId()); historyList=searchHistoryService.list(wq); } else { historyList = new ArrayList<>(0); } Map data = new HashMap(); data.put("historyKeywordList", historyList); return AjaxResult.success(data); } return AjaxResult.error(); } */ /** * 关键字提醒 *//* @GetMapping("helper") public Object helper(@NotEmpty String keyword) { LambdaQueryWrapper wq=new LambdaQueryWrapper(); wq.like(MallKeyword::getKeyword,keyword); List keywordsList = mallKeywordService.list(wq); String[] keys = new String[keywordsList.size()]; int index = 0; for (MallKeyword key : keywordsList) { keys[index++] = key.getKeyword(); } return ResponseUtil.ok(keys); } */ /** * 清除用户搜索历史 *//* @PostMapping("clearhistory") public AjaxResult clearhistory(@ApiIgnore @CurrentMember Wxuser currentMember) { Wxuser wxuser = UserHoder.getWxuser(); if (null != wxuser) { if (currentMember == null) { return AjaxResult.error(); } LambdaQueryWrapper wq=new LambdaQueryWrapper(); wq.eq(MallSearchHistory::getUserId,currentMember.getId()); final List list = searchHistoryService.list(wq); for (MallSearchHistory mallSearchHistory : list) { searchHistoryService.deleteMallSearchHistoryById(mallSearchHistory.getId()); } return AjaxResult.success(); } return AjaxResult.error(); } } */