AreaController.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.poteviohealth.ym.ipos.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.poteviohealth.cgp.common.controller.BaseWebController;
  4. import com.poteviohealth.cgp.common.integrated.IntegerParams;
  5. import com.poteviohealth.cgp.common.model.VaultsResponse;
  6. import com.poteviohealth.ym.ipos.model.Area;
  7. import com.poteviohealth.ym.ipos.service.IAreaService;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import org.springframework.http.MediaType;
  11. import org.springframework.web.bind.annotation.PostMapping;
  12. import org.springframework.web.bind.annotation.RequestBody;
  13. import org.springframework.web.bind.annotation.RequestMapping;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import javax.annotation.Resource;
  16. import java.util.List;
  17. /**
  18. * 区域
  19. * @author Qin
  20. */
  21. @RestController
  22. @RequestMapping("/ipos/web/area")
  23. @Api(value = "AreaController", tags = "地理区域", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  24. public class AreaController extends BaseWebController {
  25. @Resource
  26. private IAreaService areaService;
  27. @PostMapping("/listArea")
  28. @ApiOperation(httpMethod = "POST", value = "查询列表")
  29. public VaultsResponse<List<Area>> listArea(@RequestBody IntegerParams params) {
  30. QueryWrapper<Area> queryWrapper = new QueryWrapper<>();
  31. if(params.getId() == null){
  32. queryWrapper.isNull("parent_id");
  33. }else{
  34. queryWrapper.eq("parent_id",params.getId());
  35. }
  36. return VaultsResponse.success(areaService.list(queryWrapper));
  37. }
  38. }