package com.javaweb.geo.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.geo.domain.CollectStatistics; import com.javaweb.geo.service.ICollectStatisticsService; 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 cxy * @date 2022-12-26 */ @Controller @RequestMapping("/geo/statistics") public class CollectStatisticsController extends BaseController { private String prefix = "geo/statistics"; @Autowired private ICollectStatisticsService collectStatisticsService; @RequiresPermissions("geo:statistics:view") @GetMapping() public String statistics() { return prefix + "/statistics"; } /** * 查询统计汇总列表 */ @RequiresPermissions("geo:statistics:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(CollectStatistics collectStatistics) { startPage(); List list = collectStatisticsService.selectCollectStatisticsList(collectStatistics); return getDataTable(list); } /** * 导出统计汇总列表 */ @RequiresPermissions("geo:statistics:export") @Log(title = "统计汇总", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(CollectStatistics collectStatistics) { List list = collectStatisticsService.selectCollectStatisticsList(collectStatistics); ExcelUtil util = new ExcelUtil(CollectStatistics.class); return util.exportExcel(list, "statistics"); } /** * 新增统计汇总 */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * 新增保存统计汇总 */ @RequiresPermissions("geo:statistics:add") @Log(title = "统计汇总", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(CollectStatistics collectStatistics) { return toAjax(collectStatisticsService.insertCollectStatistics(collectStatistics)); } /** * 修改统计汇总 */ @GetMapping("/edit/{ids}") public String edit(@PathVariable("ids") String ids, ModelMap mmap) { CollectStatistics collectStatistics = collectStatisticsService.selectCollectStatisticsById(ids); mmap.put("collectStatistics", collectStatistics); return prefix + "/edit"; } /** * 修改保存统计汇总 */ @RequiresPermissions("geo:statistics:edit") @Log(title = "统计汇总", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(CollectStatistics collectStatistics) { return toAjax(collectStatisticsService.updateCollectStatistics(collectStatistics)); } /** * 删除统计汇总 */ @RequiresPermissions("geo:statistics:remove") @Log(title = "统计汇总", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(collectStatisticsService.deleteCollectStatisticsByIds(ids)); } }