package com.ruoyi.web.controller.smartor; 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.smartor.domain.ServiceOutPath; import com.smartor.service.IServiceOutPathService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 主键Controller * * @author lihu */ @Api("主键") @RestController @RequestMapping("/smartor/outPath") public class ServiceOutPathController extends BaseController { @Autowired private IServiceOutPathService serviceOutPathService; /** * 查询主键列表 */ @ApiOperation("查询主键列表") //@PreAuthorize("@ss.hasPermi('smartor:path:list')") @GetMapping("/list") public TableDataInfo list(ServiceOutPath serviceOutPath) { startPage(); List list = serviceOutPathService.selectServiceOutPathList(serviceOutPath); return getDataTable(list); } /** * param就是进制 * * @param param * @return */ @PostMapping("/getInfoByParam") public AjaxResult param(@Param("param") String param) { ServiceOutPath serviceOutPath=new ServiceOutPath(); serviceOutPath.setRadix(param); List list = serviceOutPathService.selectServiceOutPathList(serviceOutPath); ServiceOutPath serviceOutPath1 = list.get(0); serviceOutPath1.setId(null); serviceOutPath1.setRadix(null); if (CollectionUtils.isNotEmpty(list)) return success(serviceOutPath1); return success(null); } /** * 导出主键列表 */ @ApiOperation("导出主键列表") //@PreAuthorize("@ss.hasPermi('smartor:path:export')") @Log(title = "主键", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ServiceOutPath serviceOutPath) { List list = serviceOutPathService.selectServiceOutPathList(serviceOutPath); ExcelUtil util = new ExcelUtil(ServiceOutPath.class); util.exportExcel(response, list, "主键数据"); } /** * 获取主键详细信息 */ @ApiOperation("获取主键详细信息") @GetMapping(value = "/getInfo/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(serviceOutPathService.selectServiceOutPathById(id)); } /** * 新增主键 */ @ApiOperation("新增主键") @Log(title = "主键", businessType = BusinessType.INSERT) @PostMapping("/add") public AjaxResult add(@RequestBody ServiceOutPath serviceOutPath) { return toAjax(serviceOutPathService.insertServiceOutPath(serviceOutPath)); } /** * 修改主键 */ @ApiOperation("修改主键") //@PreAuthorize("@ss.hasPermi('smartor:path:edit')") @Log(title = "主键", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody ServiceOutPath serviceOutPath) { return toAjax(serviceOutPathService.updateServiceOutPath(serviceOutPath)); } /** * 删除主键 */ @ApiOperation("删除主键") //@PreAuthorize("@ss.hasPermi('smartor:path:remove')") @Log(title = "主键", businessType = BusinessType.DELETE) @GetMapping("/remove/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(serviceOutPathService.deleteServiceOutPathByIds(ids)); } }