|
@@ -2,8 +2,10 @@ package com.huimv.receive.controller;
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.api.R;
|
|
|
import com.huimv.receive.common.utils.Result;
|
|
|
import com.huimv.receive.common.utils.ResultCode;
|
|
|
+import com.huimv.receive.common.utils.ResultUtil;
|
|
|
import com.huimv.receive.entity.BaseLocation;
|
|
|
import com.huimv.receive.entity.Exist;
|
|
|
import com.huimv.receive.service.IBaseLocationService;
|
|
@@ -11,6 +13,7 @@ import com.huimv.receive.service.IExistService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -27,40 +30,28 @@ import java.util.Map;
|
|
|
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("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("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("vistit_type", vistitType)
|
|
|
- .eq("id", 9)));
|
|
|
- }
|
|
|
- return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
|
|
|
- .eq("vistit_type", vistitType)
|
|
|
- .ne("location_type", 0)));
|
|
|
+ return new Result(ResultCode.SUCCESS,baseLocationService.list(new QueryWrapper<BaseLocation>().lambda()
|
|
|
+ .like(BaseLocation::getFarmIds,farmId)));
|
|
|
}
|
|
|
|
|
|
@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("vistit_type", 0).eq("parent_id", 0)));
|
|
|
+ .eq("is_luggage", 1).like("farmId", farmId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ public Result add(HttpServletRequest httpServletRequest, @RequestBody BaseLocation baseLocation){
|
|
|
+ return baseLocationService.add(httpServletRequest,baseLocation);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/delete")
|
|
|
+ public Result delete(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap){
|
|
|
+ return baseLocationService.delete(httpServletRequest,paramsMap);
|
|
|
}
|
|
|
}
|