package com.javaweb.platform.controller; import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.javaweb.common.annotation.Log; import com.javaweb.common.enums.BusinessType; import com.javaweb.platform.domain.TestInfo; import com.javaweb.platform.service.ITestInfoService; import com.javaweb.common.core.controller.BaseController; import com.javaweb.common.core.domain.AjaxResult; import com.javaweb.common.utils.poi.ExcelUtil; import com.javaweb.common.core.page.TableDataInfo; /** * 测试记录Controller * * @author zzf * @date 2022-03-25 */ @Controller @RequestMapping("/platform/testinfo") public class TestInfoController extends BaseController { private String prefix = "platform/testinfo"; @Autowired private ITestInfoService testInfoService; @RequiresPermissions("platform:testinfo:view") @GetMapping() public String testinfo() { return prefix + "/testinfo"; } /** * 查询测试记录列表 */ @RequiresPermissions("platform:testinfo:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(TestInfo testInfo) { startPage(); List list = testInfoService.selectTestInfoList(testInfo); return getDataTable(list); } /** * 导出测试记录列表 */ @RequiresPermissions("platform:testinfo:export") @Log(title = "测试记录", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(TestInfo testInfo) { List list = testInfoService.selectTestInfoList(testInfo); ExcelUtil util = new ExcelUtil(TestInfo.class); return util.exportExcel(list, "testinfo"); } /** * 新增测试记录 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存测试记录 */ @RequiresPermissions("platform:testinfo:add") @Log(title = "测试记录", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(TestInfo testInfo) { return toAjax(testInfoService.insertTestInfo(testInfo)); } /** * 修改测试记录 */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") String id, ModelMap mmap) { TestInfo testInfo = testInfoService.selectTestInfoById(id); mmap.put("testInfo", testInfo); return prefix + "/edit"; } /** * 修改保存测试记录 */ @RequiresPermissions("platform:testinfo:edit") @Log(title = "测试记录", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(TestInfo testInfo) { return toAjax(testInfoService.updateTestInfo(testInfo)); } /** * 删除测试记录 */ @RequiresPermissions("platform:testinfo:remove") @Log(title = "测试记录", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(testInfoService.deleteTestInfoByIds(ids)); } }