|
@@ -0,0 +1,106 @@
|
|
|
+package com.slibra.web.controller.business;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+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.slibra.common.annotation.Log;
|
|
|
+import com.slibra.common.core.controller.BaseController;
|
|
|
+import com.slibra.common.core.domain.AjaxResult;
|
|
|
+import com.slibra.common.enums.BusinessType;
|
|
|
+import com.slibra.business.domain.City;
|
|
|
+import com.slibra.business.service.ICityService;
|
|
|
+import com.slibra.common.utils.poi.ExcelUtil;
|
|
|
+import com.slibra.common.core.page.TableDataInfo;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 全国省市区数据Controller
|
|
|
+ *
|
|
|
+ * @author slibra
|
|
|
+ * @date 2024-11-11
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/business/city")
|
|
|
+public class CityController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private ICityService cityService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询全国省市区数据列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:city:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(City city)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ List<City> list = cityService.selectCityList(city);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出全国省市区数据列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:city:export')")
|
|
|
+ @Log(title = "全国省市区数据", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, City city)
|
|
|
+ {
|
|
|
+ List<City> list = cityService.selectCityList(city);
|
|
|
+ ExcelUtil<City> util = new ExcelUtil<City>(City.class);
|
|
|
+ util.exportExcel(response, list, "全国省市区数据数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取全国省市区数据详细信息
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:city:query')")
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") String id)
|
|
|
+ {
|
|
|
+ return success(cityService.selectCityById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增全国省市区数据
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:city:add')")
|
|
|
+ @Log(title = "全国省市区数据", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody City city)
|
|
|
+ {
|
|
|
+// city.setCreateBy(getUsername());
|
|
|
+ return toAjax(cityService.insertCity(city));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改全国省市区数据
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:city:edit')")
|
|
|
+ @Log(title = "全国省市区数据", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody City city)
|
|
|
+ {
|
|
|
+// city.setUpdateBy(getUsername());
|
|
|
+ return toAjax(cityService.updateCity(city));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除全国省市区数据
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:city:remove')")
|
|
|
+ @Log(title = "全国省市区数据", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable String[] ids)
|
|
|
+ {
|
|
|
+ return toAjax(cityService.deleteCityByIds(ids));
|
|
|
+ }
|
|
|
+}
|