yupeng
2025-04-15 cd3d553f88fb74f1b15eca9fd50b4318956fb01d
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
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.ruoyi.web.controller.api;
 
 
import com.google.common.collect.Lists;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.model.TStreet;
import com.ruoyi.system.service.ITStreetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * <p>
 * 街道 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2025-03-19
 */
@Api(tags = {"街道相关接口"})
@RestController
@RequestMapping("/t-street")
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class TStreetController {
    private final ITStreetService tStreetService;
 
    @GetMapping("/list")
    @ApiOperation(value = "获取街道列表")
    public R<List<TStreet>> list() {
        return R.ok(tStreetService.list());
    }
    @GetMapping("/init")
    @ApiOperation(value = "初始化街道列表")
    public R<?> init(){
        ArrayList<String> strings = Lists.newArrayList("八廓街道", "吉日街道", "布达拉宫广场街道", "公德林街道", "扎细街道", "纳金街道", "娘热街道", "金珠西路街道", "堆龙德庆区东嘎街道", "两岛街道", "柳梧新区柳梧乡", "色拉街道", "蔡公堂街道", "娘热路街道", "夺底街道", "纳如街道");
        strings.forEach(streetName->{
            TStreet tStreet = new TStreet();
            tStreet.setStreetName(streetName);
            tStreetService.save(tStreet);
        });
        return R.ok();
    }
}