|
|
@@ -0,0 +1,105 @@
|
|
|
+package org.dromara.system.controller;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import jakarta.validation.constraints.*;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
|
+import org.dromara.common.log.annotation.Log;
|
|
|
+import org.dromara.common.web.core.BaseController;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import org.dromara.common.core.domain.R;
|
|
|
+import org.dromara.common.core.validate.AddGroup;
|
|
|
+import org.dromara.common.core.validate.EditGroup;
|
|
|
+import org.dromara.common.log.enums.BusinessType;
|
|
|
+import org.dromara.common.excel.utils.ExcelUtil;
|
|
|
+import org.dromara.system.domain.vo.TblCountryVo;
|
|
|
+import org.dromara.system.domain.bo.TblCountryBo;
|
|
|
+import org.dromara.system.service.ITblCountryService;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 乡镇管理
|
|
|
+ *
|
|
|
+ * @author Lion Li
|
|
|
+ * @date 2024-09-27
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RestController
|
|
|
+@RequestMapping("/system/country")
|
|
|
+public class TblCountryController extends BaseController {
|
|
|
+
|
|
|
+ private final ITblCountryService tblCountryService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询乡镇管理列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("system:country:list")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<TblCountryVo> list(TblCountryBo bo, PageQuery pageQuery) {
|
|
|
+ return tblCountryService.queryPageList(bo, pageQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出乡镇管理列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("system:country:export")
|
|
|
+ @Log(title = "乡镇管理", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(TblCountryBo bo, HttpServletResponse response) {
|
|
|
+ List<TblCountryVo> list = tblCountryService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "乡镇管理", TblCountryVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取乡镇管理详细信息
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ */
|
|
|
+ @SaCheckPermission("system:country:query")
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public R<TblCountryVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable Long id) {
|
|
|
+ return R.ok(tblCountryService.queryById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增乡镇管理
|
|
|
+ */
|
|
|
+ @SaCheckPermission("system:country:add")
|
|
|
+ @Log(title = "乡镇管理", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public R<Void> add(@Validated(AddGroup.class) @RequestBody TblCountryBo bo) {
|
|
|
+ return toAjax(tblCountryService.insertByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改乡镇管理
|
|
|
+ */
|
|
|
+ @SaCheckPermission("system:country:edit")
|
|
|
+ @Log(title = "乡镇管理", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public R<Void> edit(@Validated(EditGroup.class) @RequestBody TblCountryBo bo) {
|
|
|
+ return toAjax(tblCountryService.updateByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除乡镇管理
|
|
|
+ *
|
|
|
+ * @param ids 主键串
|
|
|
+ */
|
|
|
+ @SaCheckPermission("system:country:remove")
|
|
|
+ @Log(title = "乡镇管理", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable Long[] ids) {
|
|
|
+ return toAjax(tblCountryService.deleteWithValidByIds(List.of(ids), true));
|
|
|
+ }
|
|
|
+}
|