Pu Zhibing
2025-04-03 1f09f6daaf73bc83cceb4ae22b862b7b365635cf
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
package com.ruoyi.other.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.GoodsArea;
import com.ruoyi.other.service.GoodsAreaService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
 
/**
 * @author zhibing.pu
 * @Date 2024/11/28 9:35
 */
@RestController
@RequestMapping("/goodsArea")
public class GoodsAreaController {
    
    
    @Resource
    private GoodsAreaService goodsAreaService;
    
    
    /**
     * 根据省市区获取地区价格配置
     * @param area
     * @return
     */
    @PostMapping("/getGoodsArea")
    public R<GoodsArea> getGoodsArea(@RequestBody GoodsArea area){
        GoodsArea one = goodsAreaService.getOne(new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getGoodsId, area.getGoodsId()).eq(GoodsArea::getDistrictsCode, area.getDistrictsCode()).eq(GoodsArea::getVip, area.getVip()));
        if(null == one){
            one = goodsAreaService.getOne(new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getGoodsId, area.getGoodsId()).eq(GoodsArea::getCityCode, area.getCityCode()).eq(GoodsArea::getVip, area.getVip()));
            if(null == one){
                one = goodsAreaService.getOne(new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getGoodsId, area.getGoodsId()).eq(GoodsArea::getProvinceCode, area.getProvinceCode()).eq(GoodsArea::getVip, area.getVip()));
            }
        }
        return R.ok(one);
    }
    
    
}