| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- package com.ruoyi.web.controller.system;
- import java.util.List;
- import javax.servlet.http.HttpServletResponse;
- import com.ruoyi.common.annotation.Anonymous;
- import com.ruoyi.common.core.page.TableDataInfo;
- import io.swagger.v3.oas.annotations.Operation;
- import org.springframework.security.access.prepost.PreAuthorize;
- 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.ruoyi.common.annotation.Log;
- import com.ruoyi.common.core.controller.BaseController;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.enums.BusinessType;
- import com.ruoyi.system.domain.SysArea;
- import com.ruoyi.system.service.ISysAreaService;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- /**
- * 区域-省市区县Controller
- *
- * @author ruoyi
- * @date 2025-09-29
- */
- @RestController
- @RequestMapping("/system/area")
- public class SysAreaController extends BaseController
- {
- @Autowired
- private ISysAreaService sysAreaService;
- /**
- * 查询区域-省市区县列表
- */
- @PreAuthorize("@ss.hasPermi('system:area:list')")
- @GetMapping("/list")
- public AjaxResult list(SysArea sysArea)
- {
- List<SysArea> list = sysAreaService.selectSysAreaList(sysArea);
- return success(list);
- }
- @GetMapping("list/tree")
- @Operation(summary = "树形结构")
- @Anonymous
- public TableDataInfo listTree(SysArea criteria) {
- List<SysArea> data = sysAreaService.listTree(criteria);
- return getDataTable(data);
- }
- /**
- * 导出区域-省市区县列表
- */
- @PreAuthorize("@ss.hasPermi('system:area:export')")
- @Log(title = "区域-省市区县", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, SysArea sysArea)
- {
- List<SysArea> list = sysAreaService.selectSysAreaList(sysArea);
- ExcelUtil<SysArea> util = new ExcelUtil<SysArea>(SysArea.class);
- util.exportExcel(response, list, "区域-省市区县数据");
- }
- /**
- * 获取区域-省市区县详细信息
- */
- @PreAuthorize("@ss.hasPermi('system:area:query')")
- @GetMapping(value = "/{areaId}")
- public AjaxResult getInfo(@PathVariable("areaId") Long areaId)
- {
- return success(sysAreaService.selectSysAreaByAreaId(areaId));
- }
- /**
- * 新增区域-省市区县
- */
- @PreAuthorize("@ss.hasPermi('system:area:add')")
- @Log(title = "区域-省市区县", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody SysArea sysArea)
- {
- return toAjax(sysAreaService.insertSysArea(sysArea));
- }
- /**
- * 修改区域-省市区县
- */
- @PreAuthorize("@ss.hasPermi('system:area:edit')")
- @Log(title = "区域-省市区县", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody SysArea sysArea)
- {
- return toAjax(sysAreaService.updateSysArea(sysArea));
- }
- /**
- * 删除区域-省市区县
- */
- @PreAuthorize("@ss.hasPermi('system:area:remove')")
- @Log(title = "区域-省市区县", businessType = BusinessType.DELETE)
- @DeleteMapping("/{areaIds}")
- public AjaxResult remove(@PathVariable Long[] areaIds)
- {
- return toAjax(sysAreaService.deleteSysAreaByAreaIds(areaIds));
- }
- }
|