BaseLocationController.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package com.huimv.receive.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.huimv.receive.common.utils.Result;
  4. import com.huimv.receive.common.utils.ResultCode;
  5. import com.huimv.receive.entity.BaseLocation;
  6. import com.huimv.receive.entity.Exist;
  7. import com.huimv.receive.service.IBaseLocationService;
  8. import com.huimv.receive.service.IExistService;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import java.util.Map;
  12. /**
  13. * <p>
  14. * 前端控制器
  15. * </p>
  16. *
  17. * @author author
  18. * @since 2023-07-21
  19. */
  20. @RestController
  21. @RequestMapping("/base-location")
  22. @CrossOrigin
  23. public class BaseLocationController {
  24. @Autowired
  25. private IBaseLocationService baseLocationService;
  26. @Autowired
  27. private IExistService existService;
  28. @PostMapping("/listAll")
  29. public Result listAll(@RequestBody Map<String, String> paramsMap){
  30. String farmId = paramsMap.get("farmId");
  31. String vistitType = paramsMap.get("vistitType");
  32. QueryWrapper<Exist> queryWrapper = new QueryWrapper<>();
  33. queryWrapper.eq("farm_id", farmId);
  34. Exist one = existService.getOne(queryWrapper);
  35. if (one.getExist() == 1 && vistitType.equals("0")) {
  36. return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
  37. .eq("farm_id", farmId).eq("vistit_type", vistitType)
  38. .ne("location_type", 0).ne("id",3)));
  39. }
  40. if (one.getExist() == 1 && vistitType.equals("3")) {
  41. return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
  42. .eq("farm_id", farmId).eq("vistit_type", vistitType)
  43. .ne("location_type", 0).ne("id",7)));
  44. }
  45. if (one.getExist() == 1 && vistitType.equals("5")) {
  46. return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
  47. .eq("farm_id", farmId).eq("vistit_type", vistitType)
  48. .eq("id",9)));
  49. }
  50. return new Result(ResultCode.SUCCESS, baseLocationService.list(new QueryWrapper<BaseLocation>()
  51. .eq("farm_id", farmId).eq("vistit_type", vistitType)
  52. .ne("location_type", 0)));
  53. }
  54. @PostMapping("/listLuggageLocation")
  55. public Result listLuggageLocation(@RequestBody Map<String, String> paramsMap){
  56. String farmId = paramsMap.get("farmId");
  57. return new Result(ResultCode.SUCCESS,baseLocationService.list(new QueryWrapper<BaseLocation>().eq("farm_id",farmId)
  58. .eq("vistit_type",0).eq("parent_id",0)));
  59. }
  60. }