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.LayerInfo; import com.javaweb.platform.service.ILayerInfoService; 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/layerinfo") public class LayerInfoController extends BaseController { private String prefix = "platform/layerinfo"; @Autowired private ILayerInfoService layerInfoService; @RequiresPermissions("platform:layerinfo:view") @GetMapping() public String layerinfo() { return prefix + "/layerinfo"; } /** * 查询地层记录列表 */ @RequiresPermissions("platform:layerinfo:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(LayerInfo layerInfo) { startPage(); List list = layerInfoService.selectLayerInfoList(layerInfo); return getDataTable(list); } /** * 导出地层记录列表 */ @RequiresPermissions("platform:layerinfo:export") @Log(title = "地层记录", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(LayerInfo layerInfo) { List list = layerInfoService.selectLayerInfoList(layerInfo); ExcelUtil util = new ExcelUtil(LayerInfo.class); return util.exportExcel(list, "layerinfo"); } /** * 新增地层记录 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存地层记录 */ @RequiresPermissions("platform:layerinfo:add") @Log(title = "地层记录", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(LayerInfo layerInfo) { return toAjax(layerInfoService.insertLayerInfo(layerInfo)); } /** * 修改地层记录 */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") String id, ModelMap mmap) { LayerInfo layerInfo = layerInfoService.selectLayerInfoById(id); mmap.put("layerInfo", layerInfo); return prefix + "/edit"; } /** * 修改保存地层记录 */ @RequiresPermissions("platform:layerinfo:edit") @Log(title = "地层记录", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(LayerInfo layerInfo) { return toAjax(layerInfoService.updateLayerInfo(layerInfo)); } /** * 删除地层记录 */ @RequiresPermissions("platform:layerinfo:remove") @Log(title = "地层记录", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(layerInfoService.deleteLayerInfoByIds(ids)); } }