package com.dsh.guns.modular.system.controller.code; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.dsh.guns.modular.system.model.TCity; import com.dsh.guns.modular.system.service.ICityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/base") public class CommontController { @Autowired private ICityService cityService; /** * 获取所有省份 */ @RequestMapping("/region/getProvince") public List getProvince() { return cityService.list(new LambdaQueryWrapper() .eq(TCity::getParentId, 0)); } /** * 获取所有城市 */ @RequestMapping("/region/getCity") public List getCity() { return cityService.list(new LambdaQueryWrapper() .isNotNull(TCity::getCitycode)); } }