package com.ruoyi.web.controller.system; 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.ruoyi.system.domain.SysGpsConfig; import com.ruoyi.system.service.IGpsConfigService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.SecurityUtils; /** * GPS配置Controller */ @RestController @RequestMapping("/system/gpsconfig") public class SysGpsConfigController extends BaseController { @Autowired private IGpsConfigService gpsConfigService; /** * 查询GPS配置列表 */ @PreAuthorize("@ss.hasPermi('system:gpsconfig:list')") @GetMapping("/list") public TableDataInfo list(SysGpsConfig gpsConfig) { startPage(); List list = gpsConfigService.selectGpsConfigList(gpsConfig); return getDataTable(list); } /** * 导出GPS配置列表 */ @PreAuthorize("@ss.hasPermi('system:gpsconfig:export')") @Log(title = "GPS配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SysGpsConfig gpsConfig) { List list = gpsConfigService.selectGpsConfigList(gpsConfig); ExcelUtil util = new ExcelUtil(SysGpsConfig.class); util.exportExcel(response, list, "GPS配置数据"); } /** * 获取GPS配置详细信息 */ @PreAuthorize("@ss.hasPermi('system:gpsconfig:query')") @GetMapping(value = "/{configId}") public AjaxResult getInfo(@PathVariable("configId") Long configId) { return success(gpsConfigService.selectGpsConfigById(configId)); } /** * 新增GPS配置 */ @PreAuthorize("@ss.hasPermi('system:gpsconfig:add')") @Log(title = "GPS配置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysGpsConfig gpsConfig) { gpsConfig.setCreateBy(SecurityUtils.getUsername()); gpsConfig.setUpdateBy(SecurityUtils.getUsername()); return toAjax(gpsConfigService.insertGpsConfig(gpsConfig)); } /** * 修改GPS配置 */ @PreAuthorize("@ss.hasPermi('system:gpsconfig:edit')") @Log(title = "GPS配置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysGpsConfig gpsConfig) { gpsConfig.setUpdateBy(SecurityUtils.getUsername()); return toAjax(gpsConfigService.updateGpsConfig(gpsConfig)); } /** * 删除GPS配置 */ @PreAuthorize("@ss.hasPermi('system:gpsconfig:remove')") @Log(title = "GPS配置", businessType = BusinessType.DELETE) @DeleteMapping("/{configIds}") public AjaxResult remove(@PathVariable Long[] configIds) { return toAjax(gpsConfigService.deleteGpsConfigByIds(configIds)); } /** * 获取有效的token */ @PreAuthorize("@ss.hasPermi('system:gpsconfig:query')") @GetMapping("/token/{configKey}") public AjaxResult getValidToken(@PathVariable("configKey") String configKey) { return success(gpsConfigService.getValidToken(configKey)); } }