| package com.ruoyi.web.controller.api; | 
|   | 
|   | 
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 
| import com.ruoyi.common.core.domain.R; | 
| import com.ruoyi.system.model.TRegion; | 
| import com.ruoyi.system.service.TRegionService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.GetMapping; | 
| import org.springframework.web.bind.annotation.PostMapping; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.RestController; | 
|   | 
| import java.util.List; | 
|   | 
| /** | 
|  * <p> | 
|  * 省市管理 前端控制器 | 
|  * </p> | 
|  * | 
|  * @author xiaochen | 
|  * @since 2024-02-29 | 
|  */ | 
| @Api(tags = "省市管理") | 
| @RestController | 
| @RequestMapping("/tRegion") | 
| public class TRegionController { | 
|   | 
|     private final TRegionService regionService; | 
|   | 
|     @Autowired | 
|     public TRegionController(TRegionService regionService) { | 
|         this.regionService = regionService; | 
|     } | 
|   | 
|   | 
|     @ApiOperation(value = "查询省市管理") | 
|     @GetMapping(value = "/getRegion") | 
|     public R<List<TRegion>> getRegion() { | 
|         return R.ok(regionService.getRegion()); | 
|     } | 
|   | 
|     @ApiOperation(value = "查询省") | 
|     @PostMapping(value = "/getProvince") | 
|     public R<List<TRegion>> getProvince() { | 
|         return R.ok(regionService.list(Wrappers.lambdaQuery(TRegion.class).eq(TRegion::getParentId,0))); | 
|     } | 
| } |