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.HoleRecord; import com.javaweb.platform.service.IHoleRecordService; 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 ruoyi * @date 2022-03-22 */ @Controller @RequestMapping("/platform/holerecord") public class HoleRecordController extends BaseController { private String prefix = "platform/holerecord"; @Autowired private IHoleRecordService holeRecordService; @RequiresPermissions("platform:holerecord:view") @GetMapping() public String holerecord() { return prefix + "/holerecord"; } /** * 查询钻孔记录列表 */ @RequiresPermissions("platform:holerecord:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(HoleRecord holeRecord) { startPage(); List list = holeRecordService.selectHoleRecordList(holeRecord); return getDataTable(list); } /** * 导出钻孔记录列表 */ @RequiresPermissions("platform:holerecord:export") @Log(title = "钻孔记录", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(HoleRecord holeRecord) { List list = holeRecordService.selectHoleRecordList(holeRecord); ExcelUtil util = new ExcelUtil(HoleRecord.class); return util.exportExcel(list, "holerecord"); } /** * 新增钻孔记录 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存钻孔记录 */ @RequiresPermissions("platform:holerecord:add") @Log(title = "钻孔记录", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(HoleRecord holeRecord) { return toAjax(holeRecordService.insertHoleRecord(holeRecord)); } /** * 修改钻孔记录 */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") String id, ModelMap mmap) { HoleRecord holeRecord = holeRecordService.selectHoleRecordById(id); mmap.put("holeRecord", holeRecord); return prefix + "/edit"; } /** * 修改保存钻孔记录 */ @RequiresPermissions("platform:holerecord:edit") @Log(title = "钻孔记录", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(HoleRecord holeRecord) { return toAjax(holeRecordService.updateHoleRecord(holeRecord)); } /** * 删除钻孔记录 */ @RequiresPermissions("platform:holerecord:remove") @Log(title = "钻孔记录", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(holeRecordService.deleteHoleRecordByIds(ids)); } }