puzhibing
2026-04-30 afbd8e340732c17a56693ad425dca59d8a0a8f37
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
package com.xiaopeng.operation.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiaopeng.api.model.operation.XpFrequentlyAskedQuestions;
import com.xiaopeng.api.model.operation.XpSystemSetting;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.operation.dto.XpFrequentlyAskedQuestionsDTO;
import com.xiaopeng.operation.service.IXpFrequentlyAskedQuestionsService;
import com.xiaopeng.operation.service.XpSystemSettingService;
import com.xiaopeng.unifiedverification.interceptor.XpClientCheck;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
 
import org.springframework.stereotype.Controller;
 
import java.util.List;
 
/**
 * <p>
 * 常见问题 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2026-02-03
 */
 
@Slf4j
@RestController
public class XpFrequentlyAskedQuestionsController {
 
    private final IXpFrequentlyAskedQuestionsService xpFrequentlyAskedQuestionsService;
    private final XpSystemSettingService xpSystemSettingService;
 
    public XpFrequentlyAskedQuestionsController(IXpFrequentlyAskedQuestionsService xpFrequentlyAskedQuestionsService, XpSystemSettingService xpSystemSettingService) {
        this.xpFrequentlyAskedQuestionsService = xpFrequentlyAskedQuestionsService;
        this.xpSystemSettingService = xpSystemSettingService;
    }
 
 
    @GetMapping("/base/v1/mini-program/frequently-asked-questions/getList")
    @ApiOperation(value = "获取常见问题列表",tags = {"常见问题列表"},response = XpFrequentlyAskedQuestions.class)
    @XpClientCheck(checkToken = false, checkOtpToken = true)
    public R<List<XpFrequentlyAskedQuestions>> getList() {
        XpSystemSetting systemSetting = xpSystemSettingService.getOne(null);
        List<XpFrequentlyAskedQuestions> list = xpFrequentlyAskedQuestionsService.list(new LambdaQueryWrapper<XpFrequentlyAskedQuestions>().last("limit "+systemSetting.getHeadShowCount()));
        return R.ok(list);
    }
 
    @GetMapping("/api/v1/frequently-asked-questions/getList")
    @ApiOperation(value = "获取常见问题列表", tags = {"管理后台-内容中心"}, response = XpFrequentlyAskedQuestions.class)
    public R<List<XpFrequentlyAskedQuestions>> getQuestionList() {
        List<XpFrequentlyAskedQuestions> list = xpFrequentlyAskedQuestionsService.list();
        return R.ok(list);
    }
 
    @ApiOperation(value = "保存常见问题", tags = {"管理后台-内容中心"})
    @PostMapping("/api/v1/frequently-asked-questions/save")
    public R<?> saveQuestion(@RequestBody XpFrequentlyAskedQuestionsDTO dto) {
        xpFrequentlyAskedQuestionsService.saveQuestion(dto);
        return R.ok();
    }
 
}