|
@@ -0,0 +1,75 @@
|
|
|
|
|
+package org.dromara.system.controller.system;
|
|
|
|
|
+
|
|
|
|
|
+import jakarta.validation.constraints.NotEmpty;
|
|
|
|
|
+import jakarta.validation.constraints.NotNull;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
|
+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.annotation.Log;
|
|
|
|
|
+import org.dromara.common.log.enums.BusinessType;
|
|
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
+import org.dromara.common.web.core.BaseController;
|
|
|
|
|
+import org.dromara.system.domain.bo.SysTagBo;
|
|
|
|
|
+import org.dromara.system.domain.vo.SysTagVo;
|
|
|
|
|
+import org.dromara.system.service.ISysTagService;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+
|
|
|
|
|
+@Validated
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/system/tag")
|
|
|
|
|
+public class SysTagController extends BaseController {
|
|
|
|
|
+
|
|
|
|
|
+ private final ISysTagService iSysTagService;
|
|
|
|
|
+
|
|
|
|
|
+ /** 查询标签列表 */
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/list")
|
|
|
|
|
+ public TableDataInfo<SysTagVo> list(SysTagBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ return iSysTagService.queryPageList(bo, pageQuery);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 获取标签详细信息 */
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/{id}")
|
|
|
|
|
+ public R<SysTagVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
|
|
|
|
+ return R.ok(iSysTagService.queryById(id));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 新增标签 */
|
|
|
|
|
+
|
|
|
|
|
+ @Log(title = "标签定义", businessType = BusinessType.INSERT)
|
|
|
|
|
+ @PostMapping
|
|
|
|
|
+ public R<Void> add(@Validated(AddGroup.class) @RequestBody SysTagBo bo) {
|
|
|
|
|
+ return toAjax(iSysTagService.insertByBo(bo));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 修改标签 */
|
|
|
|
|
+
|
|
|
|
|
+ @Log(title = "标签定义", businessType = BusinessType.UPDATE)
|
|
|
|
|
+ @PutMapping
|
|
|
|
|
+ public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysTagBo bo) {
|
|
|
|
|
+ return toAjax(iSysTagService.updateByBo(bo));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 修改标签状态 */
|
|
|
|
|
+
|
|
|
|
|
+ @Log(title = "标签定义", businessType = BusinessType.UPDATE)
|
|
|
|
|
+ @PutMapping("/changeStatus")
|
|
|
|
|
+ public R<Void> changeStatus(@RequestBody SysTagBo bo) {
|
|
|
|
|
+ return toAjax(iSysTagService.updateByBo(bo));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 删除标签 */
|
|
|
|
|
+
|
|
|
|
|
+ @Log(title = "标签定义", businessType = BusinessType.DELETE)
|
|
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
|
|
+ public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
|
|
|
|
+ return toAjax(iSysTagService.deleteWithValidByIds(Arrays.asList(ids), true));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|