123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package com.huimv.receive.controller;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.huimv.receive.common.utils.Result;
- import com.huimv.receive.common.utils.ResultCode;
- import com.huimv.receive.entity.BaseLocation;
- import com.huimv.receive.entity.Exist;
- import com.huimv.receive.service.IBaseLocationService;
- import com.huimv.receive.service.IExistService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.Map;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author author
- * @since 2023-07-21
- */
- @RestController
- @RequestMapping("/base-location")
- @CrossOrigin
- public class BaseLocationController {
- @Autowired
- private IBaseLocationService baseLocationService;
- @Autowired
- private IExistService existService;
- @PostMapping("/listAll")
- public Result listAll(@RequestBody Map<String, String> paramsMap){
- String farmId = paramsMap.get("farmId");
- String vistitType = paramsMap.get("vistitType");
- QueryWrapper<Exist> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("farm_id", farmId);
- Exist one = existService.getOne(queryWrapper);
- if (one.getExist() == 1 && vistitType.equals("0")) {
- return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
- .eq("farm_id", farmId).eq("vistit_type", vistitType)
- .ne("location_type", 0).ne("id",3)));
- }
- if (one.getExist() == 1 && vistitType.equals("3")) {
- return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
- .eq("farm_id", farmId).eq("vistit_type", vistitType)
- .ne("location_type", 0).ne("id",7)));
- }
- if (one.getExist() == 1 && vistitType.equals("5")) {
- return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
- .eq("farm_id", farmId).eq("vistit_type", vistitType)
- .eq("id",9)));
- }
- return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
- .eq("farm_id", farmId).eq("vistit_type", vistitType)
- .ne("location_type", 0)));
- }
- @PostMapping("/listLuggageLocation")
- public Result listLuggageLocation(@RequestBody Map<String, String> paramsMap){
- String farmId = paramsMap.get("farmId");
- return new Result(ResultCode.SUCCESS,baseLocationService.list(new QueryWrapper<BaseLocation>().eq("farm_id",farmId)
- .eq("vistit_type",0).eq("parent_id",0)));
- }
- }
|