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::getDistrictsCode, area.getDistrictsCode()).eq(GoodsArea::getVip, area.getVip()));
|
if(null == one){
|
one = goodsAreaService.getOne(new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getCityCode, area.getCityCode()).eq(GoodsArea::getVip, area.getVip()));
|
if(null == one){
|
one = goodsAreaService.getOne(new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getProvinceCode, area.getProvinceCode()).eq(GoodsArea::getVip, area.getVip()));
|
}
|
}
|
return R.ok(one);
|
}
|
|
|
}
|