From 0e63eb88f8b83ec075d1d5cbba9ed84da6c96193 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 14 五月 2025 14:09:57 +0800
Subject: [PATCH] 视频标签代码完善
---
framework/src/main/java/cn/lili/modules/lmk/enums/general/TagCreateTypeEnum.java | 46 +++++++++++++++++++++++
framework/src/main/resources/mapper/lmk/VideoTagMapper.xml | 5 ++
framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoTagForm.java | 5 +-
framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoTag.java | 2
framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoTagQuery.java | 7 +++
config/application.yml | 1
framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoTagVO.java | 7 ++-
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagServiceImpl.java | 5 ++
8 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/config/application.yml b/config/application.yml
index 762445f..80ffe59 100644
--- a/config/application.yml
+++ b/config/application.yml
@@ -174,7 +174,6 @@
configuration:
#缂撳瓨寮�鍚�
cache-enabled: true
- default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler # 閫氱敤鏋氫妇澶勭悊鍣�
#鏃ュ織
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoTag.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoTag.java
index d3f63e7..4c2de3b 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoTag.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoTag.java
@@ -1,9 +1,9 @@
package cn.lili.modules.lmk.domain.entity;
+import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
import lombok.Data;
/**
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoTagForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoTagForm.java
index 9273874..0c98e35 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoTagForm.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoTagForm.java
@@ -4,14 +4,15 @@
import cn.lili.group.Add;
import cn.lili.base.AbsForm;
import cn.lili.modules.lmk.domain.entity.VideoTag;
+import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
+
import org.springframework.lang.NonNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
-import java.util.Date;
/**
* 瑙嗛鏍囩琛ㄥ崟
@@ -27,7 +28,7 @@
@ApiModelProperty("鏍囩鍚嶇О")
private String tagName;
- @NotBlank(message = "鍒涘缓鏂瑰紡涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ @NotNull(message = "鏍囩鏉ユ簮涓嶈兘涓虹┖", groups = {Add.class, Update.class})
@ApiModelProperty("鍒涘缓鏂瑰紡")
private String createType;
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoTagQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoTagQuery.java
index 95f0079..381c924 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoTagQuery.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoTagQuery.java
@@ -18,5 +18,12 @@
@Data
@ApiModel(value = "VideoTag鏌ヨ鍙傛暟", description = "瑙嗛鏍囩鏌ヨ鍙傛暟")
public class VideoTagQuery extends AbsQuery {
+
+ @ApiModelProperty("鏍囩鍚嶇О")
+ private String tagName;
+
+ @ApiModelProperty("鏍囩鏉ユ簮锛歋YSTEM銆乁SER")
+ private String createType;
+
}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoTagVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoTagVO.java
index 52c75b8..25807d9 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoTagVO.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoTagVO.java
@@ -3,6 +3,8 @@
import cn.lili.base.AbsVo;
import cn.lili.modules.lmk.domain.entity.VideoTag;
import java.util.List;
+
+import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
import org.springframework.lang.NonNull;
import org.springframework.beans.BeanUtils;
import io.swagger.annotations.ApiModel;
@@ -28,9 +30,8 @@
@ApiModelProperty("鍒涘缓鏂瑰紡")
private String createType;
- /** */
- @ApiModelProperty("")
- private Date updateTime;
+ @ApiModelProperty("寮曠敤娆℃暟")
+ private Long useNum = 0L;
public static VideoTagVO getVoByEntity(@NonNull VideoTag entity, VideoTagVO vo) {
if(vo == null) {
diff --git a/framework/src/main/java/cn/lili/modules/lmk/enums/general/TagCreateTypeEnum.java b/framework/src/main/java/cn/lili/modules/lmk/enums/general/TagCreateTypeEnum.java
new file mode 100644
index 0000000..d19696d
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/enums/general/TagCreateTypeEnum.java
@@ -0,0 +1,46 @@
+package cn.lili.modules.lmk.enums.general;
+
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 瑙嗛鏍囩鏉ユ簮
+ *
+ * @author锛歺p
+ * @date锛�2025/5/14 10:30
+ */
+@Getter
+public enum TagCreateTypeEnum {
+
+ SYSTEM("SYSTEM", "绯荤粺鍒涘缓"),
+ USER("USER", "鐢ㄦ埛鍒涘缓"),
+ ;
+
+ private final String value;
+
+
+ private final String desc;
+
+ TagCreateTypeEnum(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 (TagCreateTypeEnum e :TagCreateTypeEnum.values()){
+ if (value.equals(e.getValue())) {
+ return e.getDesc();
+ }
+ }
+ return null;
+ }
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagServiceImpl.java
index ec86ed3..9702c31 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagServiceImpl.java
@@ -1,5 +1,6 @@
package cn.lili.modules.lmk.service.impl;
+import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.lili.modules.lmk.domain.entity.VideoTag;
import cn.lili.modules.lmk.mapper.VideoTagMapper;
@@ -89,6 +90,10 @@
public Result page(VideoTagQuery query) {
IPage<VideoTagVO> page = PageUtil.getPage(query, VideoTagVO.class);
baseMapper.getPage(page, query);
+ page.getRecords().stream().forEach(e -> {
+ e.setCreateType(TagCreateTypeEnum.getDescByValue(e.getCreateType()));
+ // TODO 鏌ヨ寮曠敤娆℃暟
+ });
return Result.ok().data(page.getRecords()).total(page.getTotal());
}
diff --git a/framework/src/main/resources/mapper/lmk/VideoTagMapper.xml b/framework/src/main/resources/mapper/lmk/VideoTagMapper.xml
index 01cad27..d63d4f4 100644
--- a/framework/src/main/resources/mapper/lmk/VideoTagMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoTagMapper.xml
@@ -4,8 +4,9 @@
<!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
<resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.VideoTagVO">
+ <id column="id" property="id"/>
<result column="tag_name" property="tagName" />
- <result column="create_type" property="createType" />
+ <result column="create_type" property="createType"/>
<result column="update_time" property="updateTime" />
</resultMap>
@@ -38,6 +39,8 @@
lmk_video_tag LVT
WHERE
LVT.delete_flag = 0
+ <if test="query.tagName != null and query.tagName != ''">AND LVT.tag_name LIKE CONCAT('%', #{query.tagName}, '%')</if>
+ <if test="query.createType != null and query.createType != ''">AND LVT.create_type LIKE CONCAT('%', #{query.createType}, '%')</if>
</select>
</mapper>
--
Gitblit v1.8.0