From 00beb9134f167d3692c26fa8362907b07ed89d19 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 23 六月 2025 21:03:31 +0800
Subject: [PATCH] 标签、标签分类管理

---
 framework/src/main/java/cn/lili/modules/lmk/mapper/TagMapper.java                |   21 +
 manager-api/src/main/java/cn/lili/controller/lmk/TagTypeController.java          |   71 ++++
 framework/src/main/java/cn/lili/modules/lmk/service/TagTypeService.java          |   60 +++
 framework/src/main/java/cn/lili/modules/lmk/service/impl/TagServiceImpl.java     |  129 +++++++
 framework/src/main/java/cn/lili/modules/lmk/domain/query/TagTypeQuery.java       |   33 +
 framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagVO.java                 |   48 ++
 framework/src/main/java/cn/lili/modules/lmk/service/TagService.java              |   67 +++
 manager-api/src/main/java/cn/lili/controller/lmk/TagController.java              |   63 +++
 framework/src/main/java/cn/lili/modules/lmk/domain/entity/Tag.java               |   29 +
 framework/src/main/resources/mapper/lmk/TagTypeMapper.xml                        |   42 ++
 framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java           |   31 +
 framework/src/main/java/cn/lili/modules/lmk/service/impl/TagTypeServiceImpl.java |  108 ++++++
 framework/src/main/resources/mapper/lmk/TagMapper.xml                            |   28 +
 framework/src/main/java/cn/lili/modules/lmk/enums/general/TagTypeKeyEnum.java    |   55 +++
 framework/src/main/java/cn/lili/modules/lmk/domain/form/TagForm.java             |   47 ++
 framework/src/main/java/cn/lili/modules/lmk/domain/form/TagTypeForm.java         |   52 +++
 framework/src/main/java/cn/lili/modules/lmk/domain/entity/TagType.java           |   29 +
 framework/src/main/java/cn/lili/modules/lmk/mapper/TagTypeMapper.java            |   24 +
 framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagTypeVO.java             |   50 ++
 19 files changed, 987 insertions(+), 0 deletions(-)

diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/Tag.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/Tag.java
new file mode 100644
index 0000000..a85ad80
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/Tag.java
@@ -0,0 +1,29 @@
+package cn.lili.modules.lmk.domain.entity;
+
+import cn.lili.mybatis.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * @author zxl
+ * @since 2025-05-14
+ */
+@Data
+@TableName("lmk_tag")
+public class Tag extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+
+    @TableField("tag_name")
+    private String tagName;
+
+    @TableField("tag_type_id")
+    private String tagTypeId;
+
+
+    @TableField("sort_num")
+    private Integer sortNum;
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/TagType.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/TagType.java
new file mode 100644
index 0000000..1960dee
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/TagType.java
@@ -0,0 +1,29 @@
+package cn.lili.modules.lmk.domain.entity;
+
+import cn.lili.mybatis.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * @author zxl
+ * @since 2025-05-14
+ */
+@Data
+@TableName("lmk_tag_type")
+public class TagType extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("tag_type_name")
+    private String tagTypeName;
+
+    @TableField("type_key")
+    private String typeKey;
+
+    @TableField("parent_id")
+    private String parentId;
+
+    @TableField("sort_num")
+    private Integer sortNum;
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/TagForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/TagForm.java
new file mode 100644
index 0000000..fbaa5be
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/TagForm.java
@@ -0,0 +1,47 @@
+package cn.lili.modules.lmk.domain.form;
+
+import cn.lili.base.AbsForm;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.modules.lmk.domain.entity.Tag;
+import cn.lili.modules.lmk.domain.entity.VideoTag;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 瑙嗛鏍囩琛ㄥ崟
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Data
+@ApiModel(value = "VideoTag琛ㄥ崟", description = "瑙嗛鏍囩琛ㄥ崟")
+public class TagForm extends AbsForm {
+
+    @NotBlank(message = "鏍囩鍚嶇О涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("鏍囩鍚嶇О")
+    private String tagName;
+
+    @NotNull(message = "鏍囩鍒嗙被涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("鏍囩鍒嗙被")
+    private String tagTypeId;
+
+    @NotNull(message = "搴忓彿涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("搴忓彿")
+    private Integer sortNum;
+
+    public static Tag getEntityByForm(@NonNull TagForm form, Tag entity) {
+        if (entity == null) {
+            entity = new Tag();
+        }
+        BeanUtils.copyProperties(form, entity);
+        return entity;
+    }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/TagTypeForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/TagTypeForm.java
new file mode 100644
index 0000000..6e82fa0
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/TagTypeForm.java
@@ -0,0 +1,52 @@
+package cn.lili.modules.lmk.domain.form;
+
+import cn.lili.base.AbsForm;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.modules.lmk.domain.entity.TagType;
+import cn.lili.modules.lmk.domain.entity.VideoTag;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 瑙嗛鏍囩琛ㄥ崟
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Data
+@ApiModel(value = "VideoTag琛ㄥ崟", description = "瑙嗛鏍囩琛ㄥ崟")
+public class TagTypeForm extends AbsForm {
+
+    @NotBlank(message = "鏍囩鍚嶇О涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("鏍囩鍚嶇О")
+    private String tagTypeName;
+
+    @NotNull(message = "鍒嗙被鏍囪瘑涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("鍒嗙被鏍囪瘑")
+    private String typeKey;
+
+    @NotNull(message = "鐖惰妭鐐逛笉鑳戒负绌�", groups = {Add.class, Update.class})
+    @ApiModelProperty("鐖惰妭鐐�")
+    private String parentId;
+
+
+    @NotNull(message = "搴忓彿涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+    @ApiModelProperty("搴忓彿")
+    private Integer sortNum;
+
+    public static TagType getEntityByForm(@NonNull TagTypeForm form, TagType entity) {
+        if (entity == null) {
+            entity = new TagType();
+        }
+        BeanUtils.copyProperties(form, entity);
+        return entity;
+    }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java
new file mode 100644
index 0000000..605e894
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java
@@ -0,0 +1,31 @@
+package cn.lili.modules.lmk.domain.query;
+
+import cn.lili.base.AbsQuery;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 瑙嗛鏍囩鏌ヨ
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Data
+@ApiModel(value = "Tag鏌ヨ鍙傛暟", description = "鏍囩鏌ヨ鍙傛暟")
+public class TagQuery extends AbsQuery {
+
+    @ApiModelProperty("鏍囩鍚嶇О")
+    private String tagName;
+
+    @ApiModelProperty("鏍囩鍒嗙被")
+    private String tagTypeId;
+
+
+}
+
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagTypeQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagTypeQuery.java
new file mode 100644
index 0000000..6c65a35
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagTypeQuery.java
@@ -0,0 +1,33 @@
+package cn.lili.modules.lmk.domain.query;
+
+import cn.lili.base.AbsQuery;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 瑙嗛鏍囩鏌ヨ
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Data
+@ApiModel(value = "Tag鍒嗙被鏌ヨ鍙傛暟", description = "鏍囩鍒嗙被鏌ヨ鍙傛暟")
+public class TagTypeQuery extends AbsQuery {
+
+    @ApiModelProperty("鏍囩鍚嶇О")
+    private String tagTypeName;
+
+    @ApiModelProperty("鍒嗙被鏍囪瘑")
+    private String typeKey;
+
+    @ApiModelProperty("鐖惰妭鐐�")
+    private String parentId;
+
+}
+
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagTypeVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagTypeVO.java
new file mode 100644
index 0000000..6e0fce6
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagTypeVO.java
@@ -0,0 +1,50 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.modules.lmk.domain.entity.TagType;
+import cn.lili.modules.lmk.domain.entity.VideoTag;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * 瑙嗛鏍囩灞曠ず
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Data
+@ApiModel(value = "鏍囩鍒嗙被鍝嶅簲鏁版嵁", description = "鏍囩鍒嗙被鍝嶅簲鏁版嵁")
+public class TagTypeVO extends AbsVo {
+
+    @ApiModelProperty("鏍囩鍚嶇О")
+    private String tagTypeName;
+
+    @ApiModelProperty("鍒嗙被鏍囪瘑")
+    private String typeKey;
+
+    @ApiModelProperty("鐖惰妭鐐�")
+    private String parentId;
+
+    @ApiModelProperty("搴忓彿")
+    private Integer sortNum;
+
+    private List<TagVO> children;
+
+    public static TagTypeVO getVoByEntity(@NonNull TagType entity, TagTypeVO vo) {
+        if (vo == null) {
+            vo = new TagTypeVO();
+        }
+        BeanUtils.copyProperties(entity, vo);
+        return vo;
+    }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagVO.java
new file mode 100644
index 0000000..e472c74
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/TagVO.java
@@ -0,0 +1,48 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.modules.lmk.domain.entity.Tag;
+import cn.lili.modules.lmk.domain.entity.VideoTag;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 瑙嗛鏍囩灞曠ず
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Data
+@ApiModel(value = "鏍囩鍝嶅簲鏁版嵁", description = "鏍囩鍝嶅簲鏁版嵁")
+public class TagVO extends AbsVo {
+
+    @ApiModelProperty("鏍囩鍚嶇О")
+    private String tagName;
+
+    @ApiModelProperty("鏍囩鍒嗙被")
+    private String tagTypeId;
+
+    @ApiModelProperty("鏍囩鍒嗙被")
+    private String tagTypeName;
+
+
+    @ApiModelProperty("搴忓彿")
+    private Integer sortNum;
+
+    public static TagVO getVoByEntity(@NonNull Tag entity, TagVO vo) {
+        if (vo == null) {
+            vo = new TagVO();
+        }
+        BeanUtils.copyProperties(entity, vo);
+        return vo;
+    }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/enums/general/TagTypeKeyEnum.java b/framework/src/main/java/cn/lili/modules/lmk/enums/general/TagTypeKeyEnum.java
new file mode 100644
index 0000000..a580c68
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/enums/general/TagTypeKeyEnum.java
@@ -0,0 +1,55 @@
+package cn.lili.modules.lmk.enums.general;
+
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Getter
+public enum TagTypeKeyEnum {
+    USER("USER", "鐢ㄦ埛"),
+    GOODS("GOODS", "鍟嗗搧");
+
+    private final String value;
+
+
+    private final String desc;
+
+    TagTypeKeyEnum(String value, String desc) {
+        this.value = value;
+        this.desc = desc;
+    }
+
+    /**
+     * 鑾峰彇鍚箟
+     *
+     * @param value
+     * @return
+     */
+    public static String getDescByValue(String value) {
+        if (StringUtils.isBlank(value)) {
+            return null;
+        }
+        for (TagTypeKeyEnum e : TagTypeKeyEnum.values()) {
+            if (value.equals(e.getValue())) {
+                return e.getDesc();
+            }
+        }
+        return null;
+    }
+
+    public static List<Map<String, Object>> getList() {
+        return Arrays.stream(TagTypeKeyEnum.values())
+                .map(e -> {
+                    Map<String, Object> map = new LinkedHashMap<>();
+                    map.put("value", e.getValue());
+                    map.put("label", e.getDesc());
+                    return map;
+                })
+                .collect(Collectors.toList());
+    }
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/TagMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/TagMapper.java
new file mode 100644
index 0000000..987da9a
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/TagMapper.java
@@ -0,0 +1,21 @@
+package cn.lili.modules.lmk.mapper;
+
+import cn.lili.modules.lmk.domain.entity.Tag;
+import cn.lili.modules.lmk.domain.query.TagQuery;
+import cn.lili.modules.lmk.domain.vo.TagVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 瑙嗛鏍囩 Mapper 鎺ュ彛
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Mapper
+public interface TagMapper extends BaseMapper<Tag> {
+
+    IPage<TagVO> getPage(IPage<TagVO> page, @Param("query") TagQuery query);
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/TagTypeMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/TagTypeMapper.java
new file mode 100644
index 0000000..89d8c3a
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/TagTypeMapper.java
@@ -0,0 +1,24 @@
+package cn.lili.modules.lmk.mapper;
+
+import cn.lili.modules.lmk.domain.entity.TagType;
+import cn.lili.modules.lmk.domain.vo.TagTypeVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 瑙嗛鏍囩 Mapper 鎺ュ彛
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Mapper
+public interface TagTypeMapper extends BaseMapper<TagType> {
+
+
+    List<TagTypeVO> getTree(@Param("typeKey") String typeKey, @Param("tagTypeName") String tagTypeName);
+
+    List<TagTypeVO> getByParentId(@Param("id") String id);
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/TagService.java b/framework/src/main/java/cn/lili/modules/lmk/service/TagService.java
new file mode 100644
index 0000000..97f5cd2
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/TagService.java
@@ -0,0 +1,67 @@
+package cn.lili.modules.lmk.service;
+
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.entity.Tag;
+import cn.lili.modules.lmk.domain.form.TagForm;
+import cn.lili.modules.lmk.domain.query.TagQuery;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 鏍囩 鏈嶅姟绫�
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+public interface TagService extends IService<Tag> {
+
+    /**
+     * 娣诲姞
+     *
+     * @param form
+     * @return
+     */
+    Result add(TagForm form);
+
+    /**
+     * 淇敼
+     *
+     * @param form
+     * @return
+     */
+    Result update(TagForm form);
+
+    /**
+     * 鎵归噺鍒犻櫎
+     *
+     * @param ids
+     * @return
+     */
+    Result remove(List<String> ids);
+
+    /**
+     * id鍒犻櫎
+     *
+     * @param id
+     * @return
+     */
+    Result removeById(String id);
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     *
+     * @param query
+     * @return
+     */
+    Result page(TagQuery query);
+
+    /**
+     * 鍒楄〃
+     *
+     * @param tagName
+     * @return
+     */
+    Result all(String tagName);
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/TagTypeService.java b/framework/src/main/java/cn/lili/modules/lmk/service/TagTypeService.java
new file mode 100644
index 0000000..030e03a
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/TagTypeService.java
@@ -0,0 +1,60 @@
+package cn.lili.modules.lmk.service;
+
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.entity.TagType;
+import cn.lili.modules.lmk.domain.form.TagTypeForm;
+import cn.lili.modules.lmk.domain.query.TagTypeQuery;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 鏍囩鍒嗙被 鏈嶅姟绫�
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+public interface TagTypeService extends IService<TagType> {
+
+    /**
+     * 娣诲姞
+     *
+     * @param form
+     * @return
+     */
+    Result add(TagTypeForm form);
+
+    /**
+     * 淇敼
+     *
+     * @param form
+     * @return
+     */
+    Result update(TagTypeForm form);
+
+    /**
+     * 鎵归噺鍒犻櫎
+     *
+     * @param ids
+     * @return
+     */
+    Result remove(List<String> ids);
+
+    /**
+     * id鍒犻櫎
+     *
+     * @param id
+     * @return
+     */
+    Result removeById(String id);
+
+
+    /**
+     * 鍒楄〃
+     *
+     * @param tagTypeName
+     * @return
+     */
+    Result getTree(String keyType, String tagTypeName);
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/TagServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/TagServiceImpl.java
new file mode 100644
index 0000000..2fa9260
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/TagServiceImpl.java
@@ -0,0 +1,129 @@
+package cn.lili.modules.lmk.service.impl;
+
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.entity.Tag;
+import cn.lili.modules.lmk.domain.form.TagForm;
+import cn.lili.modules.lmk.domain.query.TagQuery;
+import cn.lili.modules.lmk.domain.vo.TagVO;
+import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
+import cn.lili.modules.lmk.mapper.TagMapper;
+import cn.lili.modules.lmk.service.TagService;
+import cn.lili.utils.PageUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 瑙嗛鏍囩 鏈嶅姟瀹炵幇绫�
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Service
+@RequiredArgsConstructor
+public class TagServiceImpl extends ServiceImpl<TagMapper, Tag> implements TagService {
+
+
+    /**
+     * 娣诲姞
+     *
+     * @param form
+     * @return
+     */
+    @Override
+    public Result add(TagForm form) {
+        Tag entity = TagForm.getEntityByForm(form, null);
+        baseMapper.insert(entity);
+        return Result.ok("娣诲姞鎴愬姛");
+    }
+
+    /**
+     * 淇敼
+     *
+     * @param form
+     * @return
+     */
+    @Override
+    public Result update(TagForm form) {
+        Tag entity = baseMapper.selectById(form.getId());
+
+        // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
+        Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
+        BeanUtils.copyProperties(form, entity);
+        baseMapper.updateById(entity);
+        return Result.ok("淇敼鎴愬姛");
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎
+     *
+     * @param ids
+     * @return
+     */
+    @Override
+    public Result remove(List<String> ids) {
+        baseMapper.deleteBatchIds(ids);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+    /**
+     * id鍒犻櫎
+     *
+     * @param id
+     * @return
+     */
+    @Override
+    public Result removeById(String id) {
+        baseMapper.deleteById(id);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     *
+     * @param query
+     * @return
+     */
+    @Override
+    public Result page(TagQuery query) {
+        IPage<TagVO> page = PageUtil.getPage(query, TagVO.class);
+        page = baseMapper.getPage(page, query);
+        return Result.ok().data(page.getRecords()).total(page.getTotal());
+    }
+
+
+    /**
+     * 鍒楄〃
+     *
+     * @param tagName
+     * @return
+     */
+    @Override
+    public Result all(String tagName) {
+//        List<Tag> entities = new LambdaQueryChainWrapper<>(baseMapper)
+//                .select(Tag::getId, Tag::getTagName)
+//                .like(StringUtils.isNotBlank(tagName), Tag::getTagName, tagName)
+//                .orderByDesc(Tag::getUseNum)
+//                .list();
+//        List<SimpleTagVO> vos = entities.stream()
+//                .map(entity -> {
+//                    SimpleTagVO vo = new SimpleTagVO();
+//                    BeanUtils.copyProperties(entity, vo);
+//                    return vo;
+//                })
+//                .collect(Collectors.toList());
+//        return Result.ok().data(vos);
+        return Result.ok().data(new ArrayList<>());
+    }
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/TagTypeServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/TagTypeServiceImpl.java
new file mode 100644
index 0000000..4253114
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/TagTypeServiceImpl.java
@@ -0,0 +1,108 @@
+package cn.lili.modules.lmk.service.impl;
+
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.entity.TagType;
+import cn.lili.modules.lmk.domain.form.TagForm;
+import cn.lili.modules.lmk.domain.form.TagTypeForm;
+import cn.lili.modules.lmk.domain.query.TagQuery;
+import cn.lili.modules.lmk.domain.query.TagTypeQuery;
+import cn.lili.modules.lmk.domain.vo.TagTypeVO;
+import cn.lili.modules.lmk.domain.vo.TagVO;
+import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
+import cn.lili.modules.lmk.mapper.TagMapper;
+import cn.lili.modules.lmk.mapper.TagTypeMapper;
+import cn.lili.modules.lmk.service.TagService;
+import cn.lili.modules.lmk.service.TagTypeService;
+import cn.lili.utils.PageUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 瑙嗛鏍囩 鏈嶅姟瀹炵幇绫�
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Service
+@RequiredArgsConstructor
+public class TagTypeServiceImpl extends ServiceImpl<TagTypeMapper, TagType> implements TagTypeService {
+
+    /**
+     * 娣诲姞
+     *
+     * @param form
+     * @return
+     */
+    @Override
+    public Result add(TagTypeForm form) {
+        TagType entity = TagTypeForm.getEntityByForm(form, null);
+        baseMapper.insert(entity);
+        return Result.ok("娣诲姞鎴愬姛");
+    }
+
+    /**
+     * 淇敼
+     *
+     * @param form
+     * @return
+     */
+    @Override
+    public Result update(TagTypeForm form) {
+        TagType entity = baseMapper.selectById(form.getId());
+
+        // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
+        Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
+        BeanUtils.copyProperties(form, entity);
+        baseMapper.updateById(entity);
+        return Result.ok("淇敼鎴愬姛");
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎
+     *
+     * @param ids
+     * @return
+     */
+    @Override
+    public Result remove(List<String> ids) {
+        baseMapper.deleteBatchIds(ids);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+    /**
+     * id鍒犻櫎
+     *
+     * @param id
+     * @return
+     */
+    @Override
+    public Result removeById(String id) {
+        baseMapper.deleteById(id);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+
+    /**
+     * 鍒楄〃
+     *
+     * @param tagTypeName
+     * @return
+     */
+    @Override
+    public Result getTree(String keyType, String tagTypeName) {
+        List<TagTypeVO> list = baseMapper.getTree(keyType, tagTypeName);
+        return Result.ok().data(list);
+    }
+
+
+}
diff --git a/framework/src/main/resources/mapper/lmk/TagMapper.xml b/framework/src/main/resources/mapper/lmk/TagMapper.xml
new file mode 100644
index 0000000..c8ceb7f
--- /dev/null
+++ b/framework/src/main/resources/mapper/lmk/TagMapper.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.lili.modules.lmk.mapper.TagMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.TagVO">
+        <id column="id" property="id"/>
+        <result column="tag_type_id" property="tagTypeId"/>
+        <result column="tag_type_name" property="tagTypeName"/>
+        <result column="tag_name" property="tagName"/>
+        <result column="sort_num" property="sortNum"/>
+
+    </resultMap>
+    <select id="getPage" resultMap="BaseResultMap">
+        select t.id,t.tag_type_id,t.tag_name,t.sort_num,tt.tag_type_name as tag_type_name
+        from lmk_tag t
+        left join lmk_tag_type tt on t.tag_type_id = tt.id
+        where t.delete_flag = false
+        <if test="query.tagName != null and query.tagName  != ''">
+            and t.tag_name like concat('%',#{query.tagName},'%')
+        </if>
+        <if test="query.tagTypeId != null and query.tagTypeId  != ''">
+            and t.tag_type_id like concat('%',#{query.tagTypeId},'%')
+        </if>
+        order by t.sort_num
+    </select>
+
+</mapper>
diff --git a/framework/src/main/resources/mapper/lmk/TagTypeMapper.xml b/framework/src/main/resources/mapper/lmk/TagTypeMapper.xml
new file mode 100644
index 0000000..b206fd2
--- /dev/null
+++ b/framework/src/main/resources/mapper/lmk/TagTypeMapper.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.lili.modules.lmk.mapper.TagTypeMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.TagTypeVO">
+        <id column="id" property="id"/>
+        <result column="tag_type_name" property="tagTypeName"/>
+        <result column="type_key" property="typeKey"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="sort_num" property="sortNum"/>
+        <collection property="children" ofType="cn.lili.modules.lmk.domain.vo.TagVO"
+                    select="cn.lili.modules.lmk.mapper.TagTypeMapper.getByParentId" column="id">
+        </collection>
+
+
+    </resultMap>
+    <select id="getByParentId" resultMap="BaseResultMap">
+        select *
+        from lmk_tag_type
+        where delete_flag = false
+          and parent_id = #{id}
+        order by sort_num asc
+    </select>
+    <select id="getTree" resultMap="BaseResultMap">
+        select *
+        from lmk_tag_type
+        where delete_flag = false
+        <if test="tagTypeName != null and tagTypeName!=''">
+            and tag_type_name like concat('%',#{tagTypeName},'%')
+        </if>
+        <if test="tagTypeName == null or tagTypeName==''">
+            and parent_id = 0
+        </if>
+        <if test="typeKey != null">
+            and type_key = #{typeKey}
+        </if>
+        order by sort_num asc
+    </select>
+
+
+</mapper>
diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/TagController.java b/manager-api/src/main/java/cn/lili/controller/lmk/TagController.java
new file mode 100644
index 0000000..c26526a
--- /dev/null
+++ b/manager-api/src/main/java/cn/lili/controller/lmk/TagController.java
@@ -0,0 +1,63 @@
+package cn.lili.controller.lmk;
+
+import cn.lili.base.Result;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.modules.lmk.domain.form.TagForm;
+import cn.lili.modules.lmk.domain.query.TagQuery;
+import cn.lili.modules.lmk.service.TagService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * 瑙嗛鏍囩 鍓嶇鎺у埗鍣�
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Validated
+@RequiredArgsConstructor
+@Api(value = "鏍囩", tags = "鏍囩绠$悊")
+@RestController
+@RequestMapping("/manager/lmk/tag")
+public class TagController {
+
+    private final TagService tagService;
+
+    @PostMapping
+    @ApiOperation(value = "娣诲姞", notes = "娣诲姞")
+    public Result add(@RequestBody @Validated(Add.class) TagForm form) {
+        return tagService.add(form);
+    }
+
+    @PutMapping
+    @ApiOperation(value = "淇敼", notes = "淇敼")
+    public Result update(@RequestBody @Validated(Update.class) TagForm form) {
+        return tagService.update(form);
+    }
+
+    @DeleteMapping("/{id}")
+    @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎")
+    public Result removeById(@PathVariable("id") String id) {
+        return tagService.removeById(id);
+    }
+
+    @DeleteMapping("/batch")
+    @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎")
+    public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) {
+        return tagService.remove(ids);
+    }
+
+    @GetMapping("/page")
+    @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉")
+    public Result page(TagQuery query) {
+        return tagService.page(query);
+    }
+
+}
diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/TagTypeController.java b/manager-api/src/main/java/cn/lili/controller/lmk/TagTypeController.java
new file mode 100644
index 0000000..468ab37
--- /dev/null
+++ b/manager-api/src/main/java/cn/lili/controller/lmk/TagTypeController.java
@@ -0,0 +1,71 @@
+package cn.lili.controller.lmk;
+
+import cn.lili.base.Result;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.modules.lmk.domain.form.TagTypeForm;
+import cn.lili.modules.lmk.domain.query.TagTypeQuery;
+import cn.lili.modules.lmk.enums.general.TagTypeKeyEnum;
+import cn.lili.modules.lmk.service.TagTypeService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * 瑙嗛鏍囩 鍓嶇鎺у埗鍣�
+ *
+ * @author xp
+ * @since 2025-05-13
+ */
+@Validated
+@RequiredArgsConstructor
+@Api(value = "鏍囩鍒嗙被", tags = "鏍囩鍒嗙被绠$悊")
+@RestController
+@RequestMapping("/manager/lmk/tag-type")
+public class TagTypeController {
+
+    private final TagTypeService tagTypeService;
+
+    @PostMapping
+    @ApiOperation(value = "娣诲姞", notes = "娣诲姞")
+    public Result add(@RequestBody @Validated(Add.class) TagTypeForm form) {
+        return tagTypeService.add(form);
+    }
+
+    @PutMapping
+    @ApiOperation(value = "淇敼", notes = "淇敼")
+    public Result update(@RequestBody @Validated(Update.class) TagTypeForm form) {
+        return tagTypeService.update(form);
+    }
+
+    @DeleteMapping("/{id}")
+    @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎")
+    public Result removeById(@PathVariable("id") String id) {
+        return tagTypeService.removeById(id);
+    }
+
+    @DeleteMapping("/batch")
+    @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎")
+    public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) {
+        return tagTypeService.remove(ids);
+    }
+
+
+    @GetMapping("/list")
+    @ApiOperation(value = "鍒楄〃", notes = "鍒楄〃")
+    public Result list(String tagTypeName) {
+        return tagTypeService.getTree(null, tagTypeName);
+    }
+
+
+    @GetMapping("/key/list")
+    @ApiOperation(value = "keyType鍒楄〃", notes = "keyType鍒楄〃")
+    public Result keyList() {
+        return Result.ok().data(TagTypeKeyEnum.getList());
+    }
+}

--
Gitblit v1.8.0