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; /** *

* 街道 前端控制器 *

* * @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() { return R.ok(tStreetService.list()); } @GetMapping("/init") @ApiOperation(value = "初始化街道列表") public R init(){ ArrayList strings = Lists.newArrayList("八廓街道", "吉日街道", "布达拉宫广场街道", "公德林街道", "扎细街道", "纳金街道", "娘热街道", "金珠西路街道", "堆龙德庆区东嘎街道", "两岛街道", "柳梧新区柳梧乡", "色拉街道", "蔡公堂街道", "娘热路街道", "夺底街道", "纳如街道"); strings.forEach(streetName->{ TStreet tStreet = new TStreet(); tStreet.setStreetName(streetName); tStreetService.save(tStreet); }); return R.ok(); } }