xiangpei
2025-05-14 0e63eb88f8b83ec075d1d5cbba9ed84da6c96193
视频标签代码完善
7个文件已修改
1个文件已添加
78 ■■■■ 已修改文件
config/application.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/entity/VideoTag.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/form/VideoTagForm.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoTagQuery.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoTagVO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/enums/general/TagCreateTypeEnum.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/resources/mapper/lmk/VideoTagMapper.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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:
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;
/**
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;
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("标签来源:SYSTEM、USER")
    private String createType;
}
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) {
framework/src/main/java/cn/lili/modules/lmk/enums/general/TagCreateTypeEnum.java
New file
@@ -0,0 +1,46 @@
package cn.lili.modules.lmk.enums.general;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
/**
 * 视频标签来源
 *
 * @author:xp
 * @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;
    }
}
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());
    }
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>