TCountyLevelRegionController.java 3.07 KB
Newer Older
1 2 3 4 5
package com.zehong.web.controller.area;

import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
6
import com.zehong.common.core.page.TableDataInfo;
7
import com.zehong.common.enums.BusinessType;
8
import com.zehong.common.utils.poi.ExcelUtil;
9 10
import com.zehong.system.domain.TCountyLevelRegion;
import com.zehong.system.service.ITCountyLevelRegionService;
11 12 13 14
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

/**
 * 县级行政区Controller
 * 
 * @author zehong
 * @date 2024-06-06
 */
@RestController
@RequestMapping("/area/county")
public class TCountyLevelRegionController extends BaseController
{
    @Autowired
    private ITCountyLevelRegionService tCountyLevelRegionService;

    /**
     * 查询县级行政区列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TCountyLevelRegion tCountyLevelRegion)
    {
        startPage();
        List<TCountyLevelRegion> list = tCountyLevelRegionService.selectTCountyLevelRegionList(tCountyLevelRegion);
        return getDataTable(list);
    }

    /**
     * 导出县级行政区列表
     */
    @Log(title = "县级行政区", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TCountyLevelRegion tCountyLevelRegion)
    {
        List<TCountyLevelRegion> list = tCountyLevelRegionService.selectTCountyLevelRegionList(tCountyLevelRegion);
        ExcelUtil<TCountyLevelRegion> util = new ExcelUtil<TCountyLevelRegion>(TCountyLevelRegion.class);
        return util.exportExcel(list, "县级行政区数据");
    }

    /**
     * 获取县级行政区详细信息
     */
    @GetMapping(value = "/{fId}")
    public AjaxResult getInfo(@PathVariable("fId") Long fId)
    {
        return AjaxResult.success(tCountyLevelRegionService.selectTCountyLevelRegionById(fId));
    }

    /**
     * 新增县级行政区
     */
    @Log(title = "县级行政区", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TCountyLevelRegion tCountyLevelRegion)
    {
        return toAjax(tCountyLevelRegionService.insertTCountyLevelRegion(tCountyLevelRegion));
    }

    /**
     * 修改县级行政区
     */
    @Log(title = "县级行政区", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TCountyLevelRegion tCountyLevelRegion)
    {
        return toAjax(tCountyLevelRegionService.updateTCountyLevelRegion(tCountyLevelRegion));
    }

    /**
     * 删除县级行政区
     */
    @Log(title = "县级行政区", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fIds}")
    public AjaxResult remove(@PathVariable Long[] fIds)
    {
        return toAjax(tCountyLevelRegionService.deleteTCountyLevelRegionByIds(fIds));
    }
90 91 92 93 94 95 96 97 98

    /**
     * 获取系统设置县
     * @return
     */
    @GetMapping("/getDefaultCountyList")
    public AjaxResult getDefaultCountyList(){
        return AjaxResult.success(tCountyLevelRegionService.getDefaultCountyList());
    }
99
}