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.
119 lines
3.5 KiB
119 lines
3.5 KiB
10 months ago
|
package com.zc.business.controller;
|
||
|
|
||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||
|
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.zc.business.domain.DcRegion;
|
||
|
import com.zc.business.service.impl.DcRegionServiceImpl;
|
||
|
import io.swagger.annotations.Api;
|
||
|
import io.swagger.annotations.ApiOperation;
|
||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import javax.validation.Valid;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* 地区信息Controller
|
||
|
*
|
||
|
* @author zhaoxianglong
|
||
|
*/
|
||
|
@Api(tags = {"地区信息"})
|
||
|
@RestController
|
||
|
@RequestMapping("/business/region")
|
||
|
public class DcRegionController extends BaseController {
|
||
|
@Resource
|
||
|
private DcRegionServiceImpl dcRegionService;
|
||
|
|
||
|
//*********************************道路增删改查******************************************
|
||
|
|
||
|
/**
|
||
|
* 分页查询道路列表
|
||
|
*
|
||
|
* @param dcRegion 请求参数
|
||
|
* @return 分页查询结果
|
||
|
*/
|
||
|
@ApiOperation("分页查询道路列表")
|
||
|
@PreAuthorize("@ss.hasPermi('iot:road:list')")
|
||
|
@GetMapping("list")
|
||
|
public TableDataInfo listRoad(DcRegion dcRegion) {
|
||
|
return getDataTable(dcRegionService.list());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 无分页查询道路列表
|
||
|
*
|
||
|
* @param dcRegion 请求参数
|
||
|
* @return 查询结果
|
||
|
*/
|
||
|
@ApiOperation("无分页查询道路列表")
|
||
|
@PreAuthorize("@ss.hasPermi('iot:road:query')")
|
||
|
@GetMapping("query")
|
||
|
public AjaxResult queryRoad(DcRegion dcRegion) {
|
||
|
return AjaxResult.success(dcRegionService.list());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 根据id查询道路信息
|
||
|
*
|
||
|
* @param id id
|
||
|
* @return 查询结果
|
||
|
*/
|
||
|
@ApiOperation("根据id查询道路信息")
|
||
|
@PreAuthorize("@ss.hasPermi('iot:road:query')")
|
||
|
@GetMapping("{id}")
|
||
|
public AjaxResult getRoad(@PathVariable String id) {
|
||
|
return AjaxResult.success(dcRegionService.getById(id));
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 新增
|
||
|
*
|
||
|
* @param dcRegion 新增参数
|
||
|
* @return 新增操作结果
|
||
|
*/
|
||
|
@ApiOperation("新增")
|
||
|
@PreAuthorize("@ss.hasPermi('iot:road:add')")
|
||
|
@Log(title = "新增道路", businessType = BusinessType.INSERT)
|
||
|
@PostMapping
|
||
|
public AjaxResult addRoad(@Valid @RequestBody DcRegion dcRegion) {
|
||
|
return toAjax(dcRegionService.save(dcRegion));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 修改
|
||
|
*
|
||
|
* @param dcRegion 修改参数
|
||
|
* @return 修改操作结果
|
||
|
*/
|
||
|
@ApiOperation("修改")
|
||
|
@PreAuthorize("@ss.hasPermi('iot:road:edit')")
|
||
|
@Log(title = "修改道路", businessType = BusinessType.UPDATE)
|
||
|
@PutMapping
|
||
|
public AjaxResult editRoad(@Valid @RequestBody DcRegion dcRegion) {
|
||
|
LambdaQueryWrapper<DcRegion> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||
|
lambdaQueryWrapper.eq(DcRegion::getId,dcRegion.getId());
|
||
|
return toAjax(dcRegionService.update(dcRegion,lambdaQueryWrapper));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 删除
|
||
|
*
|
||
|
* @param ids id集
|
||
|
* @return 删除操作结果
|
||
|
*/
|
||
|
@ApiOperation("删除")
|
||
|
@PreAuthorize("@ss.hasPermi('iot:road:remove')")
|
||
|
@Log(title = "删除", businessType = BusinessType.DELETE)
|
||
|
@DeleteMapping("{ids}")
|
||
|
public AjaxResult removeRoad(@PathVariable List<String> ids) {
|
||
|
return toAjax(dcRegionService.removeByIds(ids));
|
||
|
}
|
||
|
|
||
|
}
|