| | |
| | | configuration: |
| | | #缓存开启 |
| | | cache-enabled: true |
| | | default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler # 通用枚举处理器 |
| | | #日志 |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | global-config: |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 视频标签表单 |
| | |
| | | @ApiModelProperty("标签名称") |
| | | private String tagName; |
| | | |
| | | @NotBlank(message = "创建方式不能为空", groups = {Add.class, Update.class}) |
| | | @NotNull(message = "标签来源不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("创建方式") |
| | | private String createType; |
| | | |
| | |
| | | @Data |
| | | @ApiModel(value = "VideoTag查询参数", description = "视频标签查询参数") |
| | | public class VideoTagQuery extends AbsQuery { |
| | | |
| | | @ApiModelProperty("标签名称") |
| | | private String tagName; |
| | | |
| | | @ApiModelProperty("标签来源:SYSTEM、USER") |
| | | private String createType; |
| | | |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | @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) { |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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()); |
| | | } |
| | | |
| | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <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> |
| | | |
| | |
| | | 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> |