hjl
2024-07-23 562699fa6d0c279fe0f4f81ce87c336a34a3fb91
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
package com.ruoyi.admin.controller;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.admin.entity.ServeAdvantage;
import com.ruoyi.admin.service.ServeAdvantageService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * <p>
 * 服务优势管理 前端控制器
 * </p>
 *
 * @author hjl
 * @since 2024-05-29
 */
@RestController
@RequestMapping("/advantage")
@Api(tags = {"后台-系统设置-服务优势管理"})
public class ServeAdvantageController {
 
    @Resource
    private ServeAdvantageService serveAdvantageService;
 
    /**
     * 服务优势分页列表
     *
     * @param pageNum  页码
     * @param pageSize 每页显示条数
     */
    @RequiresPermissions("system_advantage")
    @ApiOperation(value = "服务优势分页查询列表", tags = {"后台-系统设置-服务优势管理"})
    @GetMapping(value = "/page")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "页码", name = "pageNum", dataType = "Integer", required = true),
            @ApiImplicitParam(value = "每页条数", name = "pageSize", dataType = "Integer", required = true)
    })
    public R<IPage<ServeAdvantage>> queryPageList(@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return R.ok(serveAdvantageService.lambdaQuery().eq(ServeAdvantage::getIsDelete, 0)
                .orderByDesc(ServeAdvantage::getCreateTime).page(Page.of(pageNum, pageSize)));
    }
 
    /**
     * 服务优势查询列表
     */
    @GetMapping(value = "/advantageList")
    public R<List<ServeAdvantage>> advantageList() {
        return R.ok(serveAdvantageService.lambdaQuery().eq(ServeAdvantage::getIsDelete, 0)
                .orderByDesc(ServeAdvantage::getCreateTime).list());
    }
 
    /**
     * 服务优势详情
     *
     * @param id 服务优势id
     */
    @ApiOperation(value = "服务优势详情", tags = {"后台-系统设置-服务优势管理"})
    @GetMapping(value = "/detail")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "服务优势id", name = "id", dataType = "Integer", required = true)
    })
    public R<ServeAdvantage> detail(@RequestParam Integer id) {
        return R.ok(serveAdvantageService.getById(id));
    }
 
    /**
     * 修改服务优势
     *
     * @param serveAdvantage 服务优势信息
     */
    @RequiresPermissions("advantage_update")
    @ApiOperation(value = "修改服务优势", tags = {"后台-系统设置-服务优势管理"})
    @PostMapping(value = "/update")
    public R<String> update(@RequestBody ServeAdvantage serveAdvantage) {
        return serveAdvantageService.updateById(serveAdvantage) ? R.ok() : R.fail();
    }
 
}