xuhy
2024-08-12 a17f15e196a89ab8a35fc8344384a6996c0864aa
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
@@ -1,6 +1,7 @@
package com.ruoyi.other.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
@@ -78,5 +79,31 @@
        return R.ok(idNameMap);
    }
    /**
     * 获取最高抵扣、最低起步价,最高折扣的会员
     * @param type 1=最高抵扣、2=最低起步价,3=最高折扣
     * @return
     */
    @PostMapping(value = "/getVipInfoByType")
    public R<TVip> getVipInfoByType(@RequestParam Integer type){
        switch (type){
            case 1:
                return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class)
                        .eq(TVip::getReveal,1)
                        .orderByDesc(TVip::getMaximumDeduction)
                        .last("LIMIT 1")));
            case 2:
                return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class)
                        .eq(TVip::getReveal,1)
                        .orderByAsc(TVip::getMonthlyCard)
                        .last("LIMIT 1")));
            default:
                return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class)
                        .eq(TVip::getReveal,1)
                        .orderByDesc(TVip::getMonthlyCardDiscount)
                        .last("LIMIT 1")));
        }
    }
}