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; /** *

* 服务优势管理 前端控制器 *

* * @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> 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> 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 detail(@RequestParam Integer id) { return R.ok(serveAdvantageService.getById(id)); } /** * 修改服务优势 * * @param serveAdvantage 服务优势信息 */ @RequiresPermissions("advantage_update") @ApiOperation(value = "修改服务优势", tags = {"后台-系统设置-服务优势管理"}) @PostMapping(value = "/update") public R update(@RequestBody ServeAdvantage serveAdvantage) { return serveAdvantageService.updateById(serveAdvantage) ? R.ok() : R.fail(); } }