无关风月
2025-04-03 fe7c2fff004e4a64dae5f0982ab28663c600c778
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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<TCity> getProvince() {
        return cityService.list(new LambdaQueryWrapper<TCity>()
                .eq(TCity::getParentId, 0));
    }
 
    /**
     * 获取所有城市
     */
    @RequestMapping("/region/getCity")
    public List<TCity> getCity() {
        return cityService.list(new LambdaQueryWrapper<TCity>()
                .isNotNull(TCity::getCitycode));
    }
 
}