济菏高速数据中心代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
3.7 KiB

package com.zc.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zc.business.domain.DcRoadSection;
import com.zc.business.service.IDcRoadSectionService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 辖区路段Controller
*
* @author ruoyi
* @date 2024-01-11
*/
@RestController
@RequestMapping("/business/roadSection")
public class DcRoadSectionController extends BaseController
{
@Autowired
private IDcRoadSectionService dcRoadSectionService;
/**
* 查询辖区路段列表
*/
@PreAuthorize("@ss.hasPermi('business:roadSection:list')")
@GetMapping("/list")
public TableDataInfo list(DcRoadSection dcRoadSection)
{
startPage();
List<DcRoadSection> list = dcRoadSectionService.selectDcRoadSectionList(dcRoadSection);
return getDataTable(list);
}
/**
* 导出辖区路段列表
*/
@PreAuthorize("@ss.hasPermi('business:roadSection:export')")
@Log(title = "辖区路段", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcRoadSection dcRoadSection)
{
List<DcRoadSection> list = dcRoadSectionService.selectDcRoadSectionList(dcRoadSection);
ExcelUtil<DcRoadSection> util = new ExcelUtil<>(DcRoadSection.class);
util.exportExcel(response, list, "辖区路段数据");
}
/**
* 获取辖区路段详细信息
*/
@PreAuthorize("@ss.hasPermi('business:roadSection:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(dcRoadSectionService.selectDcRoadSectionById(id));
}
/**
* 新增辖区路段
*/
@PreAuthorize("@ss.hasPermi('business:roadSection:add')")
@Log(title = "辖区路段", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcRoadSection dcRoadSection)
{
return toAjax(dcRoadSectionService.insertDcRoadSection(dcRoadSection));
}
/**
* 修改辖区路段
*/
@PreAuthorize("@ss.hasPermi('business:roadSection:edit')")
@Log(title = "辖区路段", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcRoadSection dcRoadSection)
{
return toAjax(dcRoadSectionService.updateDcRoadSection(dcRoadSection));
}
/**
* 删除辖区路段
*/
@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与名称
@PostMapping("/roadList")
public AjaxResult roadList(){
return AjaxResult.success(dcRoadSectionService.selectRoadList());
}
}