zhaowenxuan
2025-06-05 b7adb9e5316030aabfb90a8ff1b43c848aa550ec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
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<MallSearchHistory> historyList = null;
            if (wxuser != null) {
                //取出用户历史关键字
                LambdaQueryWrapper<MallSearchHistory>  wq=new LambdaQueryWrapper();
                wq.eq(MallSearchHistory::getUserId,wxuser.getId());
                historyList=searchHistoryService.list(wq);
            } else {
                historyList = new ArrayList<>(0);
            }
 
            Map<String, Object> data = new HashMap<String, Object>();
            data.put("historyKeywordList", historyList);
            return AjaxResult.success(data);
        }
        return AjaxResult.error();
    }
 
    */
/**
     * 关键字提醒
     *//*
 
    @GetMapping("helper")
    public Object helper(@NotEmpty String keyword) {
        LambdaQueryWrapper<MallKeyword>  wq=new LambdaQueryWrapper();
        wq.like(MallKeyword::getKeyword,keyword);
        List<MallKeyword> 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<MallSearchHistory>  wq=new LambdaQueryWrapper();
            wq.eq(MallSearchHistory::getUserId,currentMember.getId());
            final List<MallSearchHistory> list = searchHistoryService.list(wq);
 
            for (MallSearchHistory mallSearchHistory : list) {
                searchHistoryService.deleteMallSearchHistoryById(mallSearchHistory.getId());
            }
            return AjaxResult.success();
        }
        return AjaxResult.error();
 
    }
 
}
*/