package com.zc.business.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.zc.business.domain.DcRoadSection; import com.zc.business.enums.UniversalEnum; import com.zc.business.service.IDcRoadSectionService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 辖区路段Controller * * @author ruoyi * @date 2024-01-11 */ @Api(tags = "辖区路段") @RestController @RequestMapping("/business/roadSection") public class DcRoadSectionController extends BaseController { @Autowired private IDcRoadSectionService dcRoadSectionService; /** * 查询辖区路段列表 */ @ApiOperation("查询辖区路段列表") // @PreAuthorize("@ss.hasPermi('business:roadSection:list')") @GetMapping("/list") public TableDataInfo list(DcRoadSection dcRoadSection) { startPage(); List list = dcRoadSectionService.selectDcRoadSectionList(dcRoadSection); return getDataTable(list); } //查询全路段名称与id @GetMapping("/listName") public AjaxResult listRoadName() { return AjaxResult.success(dcRoadSectionService.selectName()); } /** * 查询辖区路段列表(不分页) */ @ApiOperation("查询辖区路段列表") //@PreAuthorize("@ss.hasPermi('business:roadSection:list')") @GetMapping("/listAll") public AjaxResult listAll(DcRoadSection dcRoadSection) { return AjaxResult.success(dcRoadSectionService.selectDcRoadSectionListAll(dcRoadSection)); } /** * 导出辖区路段列表 */ @ApiOperation("导出辖区路段列表") // @PreAuthorize("@ss.hasPermi('business:roadSection:export')") @Log(title = "辖区路段", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, DcRoadSection dcRoadSection) { List list = dcRoadSectionService.selectDcRoadSectionList(dcRoadSection); ExcelUtil util = new ExcelUtil<>(DcRoadSection.class); util.exportExcel(response, list, UniversalEnum.DISTRICT_ROAD_DATA.getValue()); } /** * 获取辖区路段详细信息 */ @ApiOperation("获取辖区路段详细信息") // @PreAuthorize("@ss.hasPermi('business:roadSection:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(dcRoadSectionService.selectDcRoadSectionById(id)); } /** * 新增辖区路段 */ @ApiOperation("新增辖区路段") // @PreAuthorize("@ss.hasPermi('business:roadSection:add')") @Log(title = "辖区路段", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcRoadSection dcRoadSection) { return toAjax(dcRoadSectionService.insertDcRoadSection(dcRoadSection)); } /** * 修改辖区路段 */ @ApiOperation("修改辖区路段") // @PreAuthorize("@ss.hasPermi('business:roadSection:edit')") @Log(title = "辖区路段", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody DcRoadSection dcRoadSection) { return toAjax(dcRoadSectionService.updateDcRoadSection(dcRoadSection)); } /** * 删除辖区路段 */ @ApiOperation("删除辖区路段") // @PreAuthorize("@ss.hasPermi('business:roadSection:remove')") @Log(title = "辖区路段", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(dcRoadSectionService.deleteDcRoadSectionByIds(ids)); } //查询路线id与名称 @ApiOperation("查询路线id与名称") @PostMapping("/roadList") public AjaxResult roadList(){ return AjaxResult.success(dcRoadSectionService.selectRoadList()); } //处理桩号归属的路段id @PostMapping("/selectMileage") public AjaxResult selectMileage(){ dcRoadSectionService.selectMileage(); return AjaxResult.success(); } }