package com.ard.work.grid.controller; import jakarta.servlet.http.HttpServletResponse; import com.ard.common.core.utils.poi.ExcelUtil; import com.ard.common.core.web.controller.BaseController; import com.ard.common.core.web.domain.AjaxResult; import com.ard.common.core.web.page.TableDataInfo; import com.ard.common.log.enums.BusinessType; import com.ard.common.security.annotation.RequiresPermissions; import com.ard.work.grid.domain.ArdGridAreaEntity; import com.ard.work.grid.service.IArdGridAreaEntityService; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ard.common.log.annotation.Log; import java.util.List; /** * 网格信息Controller * * @author XiaJiJian * @date 2024-09-27 */ @Tag(name = "网格信息管理") @RestController @RequestMapping("/grid/area") public class ArdGridAreaEntityController extends BaseController { @Autowired private IArdGridAreaEntityService ardGridAreaEntityService; /** * 查询网格信息列表 */ @Operation(summary = "查询网格信息列表") @RequiresPermissions("grid:area:list") @GetMapping("/list") public TableDataInfo list(ArdGridAreaEntity ardGridAreaEntity) { startPage(); List list = ardGridAreaEntityService.selectArdGridAreaEntityList(ardGridAreaEntity); return getDataTable(list); } /** * 导出网格信息列表 */ @Operation(summary = "导出网格信息列表") @RequiresPermissions("grid:area:export") @Log(title = "网格信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ArdGridAreaEntity ardGridAreaEntity) { List list = ardGridAreaEntityService.selectArdGridAreaEntityList(ardGridAreaEntity); ExcelUtil util = new ExcelUtil(ArdGridAreaEntity.class); util.exportExcel(response, list, "网格信息数据"); } /** * 获取网格信息详细信息 */ @Operation(summary = "获取网格信息详细信息") @RequiresPermissions("grid:area:query") @GetMapping(value = "/{areaId}") public AjaxResult getInfo(@PathVariable("areaId") String areaId) { return success(ardGridAreaEntityService.selectArdGridAreaEntityByAreaId(areaId)); } /** * 新增网格信息 */ @Operation(summary = "新增网格信息") @RequiresPermissions("grid:area:add") @Log(title = "网格信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ArdGridAreaEntity ardGridAreaEntity) { return toAjax(ardGridAreaEntityService.insertArdGridAreaEntity(ardGridAreaEntity)); } /** * 修改网格信息 */ @Operation(summary = "修改网格信息") @RequiresPermissions("grid:area:edit") @Log(title = "网格信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ArdGridAreaEntity ardGridAreaEntity) { return toAjax(ardGridAreaEntityService.updateArdGridAreaEntity(ardGridAreaEntity)); } /** * 删除网格信息 */ @Operation(summary = "删除网格信息") @RequiresPermissions("grid:area:remove") @Log(title = "网格信息", businessType = BusinessType.DELETE) @DeleteMapping("/{areaIds}") public AjaxResult remove(@PathVariable String[] areaIds) { return toAjax(ardGridAreaEntityService.deleteArdGridAreaEntityByAreaIds(areaIds)); } }