hjl
2024-07-01 03c6572c7918beaa20365e69c9694a11f0d9948a
ruoyi-service/ruoyi-admin/src/main/java/com/ruoyi/admin/controller/RotateController.java
@@ -3,9 +3,13 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.admin.entity.RecoveryServe;
import com.ruoyi.admin.entity.Rotate;
import com.ruoyi.admin.service.RecoveryServeService;
import com.ruoyi.admin.service.RotateService;
import com.ruoyi.admin.vo.RotateResultVO;
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;
@@ -32,6 +36,8 @@
    @Resource
    private RotateService rotateService;
    @Resource
    private RecoveryServeService recoveryServeService;
    /**
     * 轮播图图片分页列表
@@ -40,6 +46,7 @@
     * @param pageSize 每页显示条数
     * @return 封装分页数据
     */
    @RequiresPermissions("system_rotate")
    @ApiOperation(value = "轮播图分页查询列表", tags = {"后台-系统设置-轮播图管理"})
    @GetMapping(value = "/page")
    @ApiImplicitParams({
@@ -48,17 +55,17 @@
    })
    public R<IPage<Rotate>> queryPageList(@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return R.ok(rotateService.lambdaQuery().eq(Rotate::getIsDelete, 0)
                .orderByDesc(Rotate::getCreateTime).page(Page.of(pageNum, pageSize)));
        return R.ok(rotateService.queryPage(Page.of(pageNum, pageSize)));
    }
    /**
     * 轮播图列表
     */
    @RequiresPermissions("system_rotate")
    @GetMapping(value = "/bannerList")
    public R<List<Rotate>> bannerList() {
        return R.ok(rotateService.lambdaQuery().eq(Rotate::getIsDelete, 0)
                .orderByAsc(Rotate::getOrder).list());
                .orderByAsc(Rotate::getSort).list());
    }
    /**
@@ -67,13 +74,23 @@
     * @param id 轮播图id
     * @return 封装分页数据
     */
    @RequiresPermissions("system_rotate")
    @ApiOperation(value = "轮播图详情", tags = {"后台-系统设置-轮播图管理"})
    @GetMapping(value = "/detail")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "轮播图id", name = "id", dataType = "Integer", required = true)
    })
    public R<Rotate> detail(@RequestParam Integer id) {
        return R.ok(rotateService.getById(id));
    public R<RotateResultVO> detail(@RequestParam Integer id) {
        RotateResultVO rotateResultVO = new RotateResultVO();
        Rotate rotate = rotateService.getById(id);
        rotateResultVO.setRotate(rotate);
        if (null != rotate.getRotateServeId()) {
            RecoveryServe recoveryServe = recoveryServeService.lambdaQuery()
                    .eq(RecoveryServe::getId, rotate.getRotateServeId())
                    .eq(RecoveryServe::getIsDelete, 0).one();
            rotateResultVO.setRecoveryServe(recoveryServe);
        }
        return R.ok(rotateResultVO);
    }
    /**
@@ -82,6 +99,7 @@
     * @param rotate 轮播图信息
     * @return 封装分页数据
     */
    @RequiresPermissions("system_rotate")
    @ApiOperation(value = "新增轮播图", tags = {"后台-系统设置-轮播图管理"})
    @PostMapping(value = "/save")
    public R<String> save(@RequestBody Rotate rotate) {
@@ -94,6 +112,7 @@
     * @param rotate 轮播图信息
     * @return 封装分页数据
     */
    @RequiresPermissions("system_rotate")
    @ApiOperation(value = "修改轮播图", tags = {"后台-系统设置-轮播图管理"})
    @PostMapping(value = "/update")
    public R<String> update(@RequestBody Rotate rotate) {
@@ -106,6 +125,7 @@
     * @param ids 轮播图多条id拼接
     * @return 封装分页数据
     */
    @RequiresPermissions("system_rotate")
    @ApiOperation(value = "批量删除轮播图", tags = {"后台-系统设置-轮播图管理"})
    @GetMapping(value = "/batchDelete")
    @ApiImplicitParams({