From 59e297cc9d51ef9c6df0dac71664bf1b492fc941 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期六, 14 六月 2025 13:23:29 +0800
Subject: [PATCH] insert 完成厨神视频后台页面接口(增删改查/上架/下架)
---
framework/src/main/java/cn/lili/modules/lmk/service/KitchenVideoTypeRefService.java | 70 ++++
framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeVO.java | 34 ++
framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoVO.java | 116 +++++++
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java | 95 +++++
framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoTypeRefForm.java | 42 ++
framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeRefVO.java | 39 ++
framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoForm.java | 59 +++
framework/src/main/resources/mapper/lmk/VideoMapper.xml | 66 ++++
framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoTypeRefQuery.java | 22 +
manager-api/src/main/java/cn/lili/controller/lmk/KitchenVideoController.java | 59 +++
framework/src/main/java/cn/lili/modules/lmk/mapper/KitchenVideoTypeRefMapper.java | 37 ++
framework/src/main/java/cn/lili/modules/lmk/service/impl/KitchenVideoTypeRefServiceImpl.java | 126 +++++++
framework/src/main/java/cn/lili/modules/lmk/domain/entity/KitchenVideoTypeRef.java | 37 ++
framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java | 23 +
framework/src/main/resources/mapper/lmk/KitchenVideoTypeRefMapper.xml | 53 +++
framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java | 7
framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoQuery.java | 39 ++
17 files changed, 912 insertions(+), 12 deletions(-)
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/KitchenVideoTypeRef.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/KitchenVideoTypeRef.java
new file mode 100644
index 0000000..b58f66e
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/KitchenVideoTypeRef.java
@@ -0,0 +1,37 @@
+package cn.lili.modules.lmk.domain.entity;
+
+import cn.lili.mybatis.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛�
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+@Data
+@TableName("lmk_kitchen_video_type_ref")
+public class KitchenVideoTypeRef implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId
+ @ApiModelProperty(value = "鍞竴鏍囪瘑", hidden = true)
+ private String id;
+
+ @TableField("video_id")
+ /** 瑙嗛id */
+ private String videoId;
+
+ @TableField("kitchen_type_id")
+ /** 鍘ㄧ鏍囩id */
+ private String kitchenTypeId;
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoForm.java
new file mode 100644
index 0000000..cb7906c
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoForm.java
@@ -0,0 +1,59 @@
+package cn.lili.modules.lmk.domain.form;
+
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.mybatis.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.Size;
+import java.util.List;
+
+/**
+ * 鍘ㄧ瑙嗛鍙戝竷
+ *
+ * @author wp
+ * @since 2025-06-12
+ */
+@Data
+@ApiModel(value = "鍘ㄧ瑙嗛鍙戝竷", description = "鍘ㄧ瑙嗛鍙戝竷")
+public class KitchenVideoForm extends BaseEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /** 浣滆�卛d */
+ @ApiModelProperty(value = "涓婚敭id")
+ private String id;
+
+ @ApiModelProperty(value = "鍥剧墖灏侀潰")
+ /** 鍥剧墖灏侀潰 */
+ @NotBlank(message = "灏侀潰鍥剧墖涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ private String coverUrl;
+
+ @TableField("video_file_key")
+ /** 瑙嗛鍦板潃 */
+ @NotBlank(message = "瑙嗛鍦板潃涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ private String videoFileKey;
+
+
+ /** 瑙嗛闀垮害(绉�) */
+// @NotNull(message = "瑙嗛闀垮害涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ private Long videoDuration;
+
+ /** 瑙嗛鏍囬 */
+ @NotBlank(message = "鏍囬涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ private String title;
+
+ /** 鏍囩鍒楄〃 */
+ @Size(min = 1,max = 5, message = "鏍囩鍒楄〃涓嶈兘涓虹┖",groups = {Add.class, Update.class})
+ private List<String> checkKitchenType;
+
+
+
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoTypeRefForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoTypeRefForm.java
new file mode 100644
index 0000000..5f33b2c
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/KitchenVideoTypeRefForm.java
@@ -0,0 +1,42 @@
+package cn.lili.modules.lmk.domain.form;
+
+import cn.lili.group.Update;
+import cn.lili.group.Add;
+import cn.lili.base.AbsForm;
+import cn.lili.modules.lmk.domain.entity.KitchenVideoTypeRef;
+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;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄨ〃鍗�
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+@Data
+@ApiModel(value = "KitchenVideoTypeRef琛ㄥ崟", description = "鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄨ〃鍗�")
+public class KitchenVideoTypeRefForm extends AbsForm {
+
+ @NotBlank(message = "瑙嗛id涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ @ApiModelProperty("瑙嗛id")
+ private String videoId;
+
+ @NotBlank(message = "鍘ㄧ鏍囩id涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ @ApiModelProperty("鍘ㄧ鏍囩id")
+ private String kitchenTypeId;
+
+ public static KitchenVideoTypeRef getEntityByForm(@NonNull KitchenVideoTypeRefForm form, KitchenVideoTypeRef entity) {
+ if(entity == null) {
+ entity = new KitchenVideoTypeRef();
+ }
+ BeanUtils.copyProperties(form, entity);
+ return entity;
+ }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoQuery.java
new file mode 100644
index 0000000..f48ba62
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoQuery.java
@@ -0,0 +1,39 @@
+package cn.lili.modules.lmk.domain.query;
+
+import cn.lili.base.AbsQuery;
+import cn.lili.modules.lmk.enums.general.VideoTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 瑙嗛鍐呭鏌ヨ
+ *
+ * @author xp
+ * @since 2025-05-16
+ */
+@Data
+@ApiModel(value = "骞冲彴绔帹绁濾ideo鏌ヨ鍙傛暟", description = "瑙嗛鍐呭鏌ヨ鍙傛暟")
+public class KitchenVideoQuery extends AbsQuery {
+
+ @ApiModelProperty("鏍囬")
+ private String title;
+
+ @ApiModelProperty("瑙嗛鏍囩")
+ private List<String> typeList;
+
+ @ApiModelProperty("浣滆��")
+ private String authorId;
+
+ @ApiModelProperty("鐘舵��")
+ private String status;
+
+ /**
+ * @see VideoTypeEnum
+ */
+ @ApiModelProperty("瑙嗛绫诲瀷锛氳棰戙�佸ぇ鍋ュ悍銆佺鍘紝榛樿涓嶄紶鏌ヨ棰�")
+ private String videoType = VideoTypeEnum.COOK.getValue();
+}
+
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoTypeRefQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoTypeRefQuery.java
new file mode 100644
index 0000000..e8cbb92
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/KitchenVideoTypeRefQuery.java
@@ -0,0 +1,22 @@
+package cn.lili.modules.lmk.domain.query;
+
+import cn.lili.base.AbsQuery;
+import java.util.List;
+import org.springframework.lang.NonNull;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄦ煡璇�
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+@Data
+@ApiModel(value = "KitchenVideoTypeRef鏌ヨ鍙傛暟", description = "鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄦ煡璇㈠弬鏁�")
+public class KitchenVideoTypeRefQuery extends AbsQuery {
+}
+
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeRefVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeRefVO.java
new file mode 100644
index 0000000..b8295a9
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeRefVO.java
@@ -0,0 +1,39 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.KitchenVideoTypeRef;
+import java.util.List;
+import org.springframework.lang.NonNull;
+import org.springframework.beans.BeanUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄥ睍绀�
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+@Data
+@ApiModel(value = "鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄥ搷搴旀暟鎹�", description = "鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄥ搷搴旀暟鎹�")
+public class KitchenVideoTypeRefVO extends AbsVo {
+
+ /** 瑙嗛id */
+ @ApiModelProperty("瑙嗛id")
+ private String videoId;
+
+ /** 鍘ㄧ鏍囩id */
+ @ApiModelProperty("鍘ㄧ鏍囩id")
+ private String kitchenTypeId;
+
+ public static KitchenVideoTypeRefVO getVoByEntity(@NonNull KitchenVideoTypeRef entity, KitchenVideoTypeRefVO vo) {
+ if(vo == null) {
+ vo = new KitchenVideoTypeRefVO();
+ }
+ BeanUtils.copyProperties(entity, vo);
+ return vo;
+ }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeVO.java
new file mode 100644
index 0000000..fbfd923
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoTypeVO.java
@@ -0,0 +1,34 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.KitchenVideoTypeRef;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄥ睍绀�
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+@Data
+@ApiModel(value = "鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄥ搷搴旀暟鎹�", description = "鍘ㄧ瑙嗛鏍囩鍏崇郴琛ㄥ搷搴旀暟鎹�")
+public class KitchenVideoTypeVO extends AbsVo {
+
+ /** 瑙嗛id */
+ @ApiModelProperty("瑙嗛id")
+ private String videoId;
+
+ /** 鍒嗙被id */
+ @ApiModelProperty("鍒嗙被id")
+ private String id;
+
+ /** 鍒嗙被鍚嶇О */
+ @ApiModelProperty("鍒嗙被鍚嶇О")
+ private String typeName;
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoVO.java
new file mode 100644
index 0000000..2c436fc
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/KitchenVideoVO.java
@@ -0,0 +1,116 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.Video;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 瑙嗛鍐呭灞曠ず
+ *
+ * @author xp
+ * @since 2025-05-16
+ */
+@Data
+@ApiModel(value = "瑙嗛鍐呭鍝嶅簲鏁版嵁", description = "瑙嗛鍐呭鍝嶅簲鏁版嵁")
+public class KitchenVideoVO extends AbsVo {
+
+ /** 浣滆�卛d */
+ @ApiModelProperty("浣滆�卛d")
+ private String authorId;
+ private String authorName;
+
+ /** 鍥剧墖灏侀潰 */
+ @ApiModelProperty("鍥剧墖灏侀潰")
+ private String coverUrl;
+
+ /** 灏侀潰鏄剧ず鍦板潃 */
+ @ApiModelProperty("灏侀潰鏄剧ず鍦板潃")
+ private String coverShowUrl;
+
+ /** 瑙嗛鍦板潃 */
+ @ApiModelProperty("瑙嗛鍦板潃")
+ private String videoFileKey;
+ private String videoUrl;
+
+ @ApiModelProperty("瑙嗛鏍囩")
+ private List<KitchenVideoTypeVO> typeList;
+
+ @ApiModelProperty("瑙嗛鍐呭绫诲瀷锛氳棰戙�佸浘鐗�")
+ private String videoContentType;
+
+ @ApiModelProperty("瑙嗛绫诲瀷锛氳棰戙�佸ぇ鍋ュ悍銆佺鍘�")
+ private String videoType;
+
+ @ApiModelProperty(value = "鍥剧墖鍒楄〃锛宩son鏁扮粍", hidden = true)
+ private String videoImgs;
+
+ @ApiModelProperty("鍥剧墖鍒楄〃")
+ private List<String> imgs;
+
+ /** 瑙嗛濉厖妯″紡 */
+ @ApiModelProperty("瑙嗛濉厖妯″紡")
+ private String videoFit;
+
+ @ApiModelProperty("瑙嗛闀垮害锛氱")
+ private Long videoDuration;
+
+ /** 瑙嗛鏍囬 */
+ @ApiModelProperty("瑙嗛鏍囬")
+ private String title;
+
+ /** 鍟嗗搧id */
+ @ApiModelProperty("鍟嗗搧id")
+ private String goodsId;
+
+ /** 鍟嗗搧鏌ョ湅娆℃暟 */
+ @ApiModelProperty("鍟嗗搧鏌ョ湅娆℃暟")
+ private Long goodsViewNum;
+
+ /** 鍟嗗搧涓嬪崟娆℃暟 */
+ @ApiModelProperty("鍟嗗搧涓嬪崟娆℃暟")
+ private Long goodsOrderNum;
+
+ /** 鏄惁鎺ㄨ崘 */
+ @ApiModelProperty("鏄惁鎺ㄨ崘")
+ private Boolean recommend;
+
+ /** 鐘舵�� */
+ @ApiModelProperty("鐘舵��")
+ private String status;
+
+ /** 鎾斁閲� */
+ @ApiModelProperty("鎾斁閲�")
+ private Long playNum;
+
+ /** 鏀惰棌鏁� */
+ @ApiModelProperty("鏀惰棌鏁�")
+ private Long collectNum;
+
+ /** 璇勮鏁� */
+ @ApiModelProperty("璇勮鏁�")
+ private Long commentNum;
+
+ /** 鏉冮噸 */
+ @ApiModelProperty("鏉冮噸")
+ private double weight;
+
+ /** 瀹℃牳閫氳繃鏃堕棿 */
+ @ApiModelProperty("瀹℃牳閫氳繃鏃堕棿")
+ private Date auditPassTime;
+
+ public static KitchenVideoVO getVoByEntity(@NonNull Video entity, KitchenVideoVO vo) {
+ if(vo == null) {
+ vo = new KitchenVideoVO();
+ }
+ BeanUtils.copyProperties(entity, vo);
+ return vo;
+ }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/KitchenVideoTypeRefMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/KitchenVideoTypeRefMapper.java
new file mode 100644
index 0000000..c6157e8
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/KitchenVideoTypeRefMapper.java
@@ -0,0 +1,37 @@
+package cn.lili.modules.lmk.mapper;
+
+import cn.lili.modules.lmk.domain.entity.KitchenVideoTypeRef;
+import cn.lili.modules.lmk.domain.vo.KitchenVideoTypeVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import cn.lili.modules.lmk.domain.vo.KitchenVideoTypeRefVO;
+import cn.lili.modules.lmk.domain.form.KitchenVideoTypeRefForm;
+import cn.lili.modules.lmk.domain.query.KitchenVideoTypeRefQuery;
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛� Mapper 鎺ュ彛
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+@Mapper
+public interface KitchenVideoTypeRefMapper extends BaseMapper<KitchenVideoTypeRef> {
+
+ /**
+ * id鏌ユ壘鍘ㄧ瑙嗛鏍囩鍏崇郴琛�
+ * @param id
+ * @return
+ */
+ KitchenVideoTypeRefVO getById(String id);
+
+ /**
+ * 鍒嗛〉
+ */
+ IPage getPage(IPage page, @Param("query") KitchenVideoTypeRefQuery query);
+
+ List<KitchenVideoTypeVO> getTypeByVideoIds(@Param("videoIds") List<String> videoIds);
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
index 19e10ae..263072f 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
@@ -1,10 +1,7 @@
package cn.lili.modules.lmk.mapper;
import cn.lili.modules.lmk.domain.entity.Video;
-import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
-import cn.lili.modules.lmk.domain.query.HealthVideoQuery;
-import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
-import cn.lili.modules.lmk.domain.query.VideoQuery;
+import cn.lili.modules.lmk.domain.query.*;
import cn.lili.modules.lmk.domain.vo.CollectTypeNumVO;
import cn.lili.modules.lmk.domain.vo.VideoAccountVO;
import cn.lili.modules.lmk.domain.vo.VideoVO;
@@ -121,4 +118,6 @@
* @param query
*/
IPage healthPage(IPage page, @Param("query") HealthVideoQuery query);
+
+ IPage kitchenPage(IPage page, @Param("query") KitchenVideoQuery query);
}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/KitchenVideoTypeRefService.java b/framework/src/main/java/cn/lili/modules/lmk/service/KitchenVideoTypeRefService.java
new file mode 100644
index 0000000..c7b6152
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/KitchenVideoTypeRefService.java
@@ -0,0 +1,70 @@
+package cn.lili.modules.lmk.service;
+
+import cn.lili.modules.lmk.domain.entity.KitchenVideoTypeRef;
+import cn.lili.modules.lmk.domain.vo.KitchenVideoTypeVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.form.KitchenVideoTypeRefForm;
+import cn.lili.modules.lmk.domain.query.KitchenVideoTypeRefQuery;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛� 鏈嶅姟绫�
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+public interface KitchenVideoTypeRefService extends IService<KitchenVideoTypeRef> {
+
+ /**
+ * 娣诲姞
+ * @param form
+ * @return
+ */
+ Result add(KitchenVideoTypeRefForm form);
+
+ /**
+ * 淇敼
+ * @param form
+ * @return
+ */
+ Result update(KitchenVideoTypeRefForm form);
+
+ /**
+ * 鎵归噺鍒犻櫎
+ * @param ids
+ * @return
+ */
+ Result remove(List<String> ids);
+
+ /**
+ * id鍒犻櫎
+ * @param id
+ * @return
+ */
+ Result removeById(String id);
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ * @param query
+ * @return
+ */
+ Result page(KitchenVideoTypeRefQuery query);
+
+ /**
+ * 鏍规嵁id鏌ユ壘
+ * @param id
+ * @return
+ */
+ Result detail(String id);
+
+ /**
+ * 鍒楄〃
+ * @return
+ */
+ Result all();
+
+ List<KitchenVideoTypeVO> getTypeByVideoIds(List<String> videoIds);
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java b/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
index 8e600ac..6492e48 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
@@ -1,14 +1,15 @@
package cn.lili.modules.lmk.service;
+import cn.lili.group.Add;
import cn.lili.modules.lmk.domain.entity.Video;
import cn.lili.modules.lmk.domain.form.*;
-import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
-import cn.lili.modules.lmk.domain.query.HealthVideoQuery;
-import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
+import cn.lili.modules.lmk.domain.query.*;
import cn.lili.modules.lmk.domain.vo.CollectTypeNumVO;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.lili.base.Result;
-import cn.lili.modules.lmk.domain.query.VideoQuery;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestBody;
+
import java.util.List;
/**
@@ -213,4 +214,18 @@
* @return
*/
Result delHealth(String id);
+
+ Result addKitchenVideo( KitchenVideoForm form);
+
+ Result updateKitchenVideo( KitchenVideoForm form);
+ /**
+ * 鍘ㄧ瑙嗛鍒楄〃
+ *
+ * @param query
+ * @return
+ */
+ Result KitchenVideoQuery(KitchenVideoQuery query);
+
+ Result delKitchen(String id);
+
}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/KitchenVideoTypeRefServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/KitchenVideoTypeRefServiceImpl.java
new file mode 100644
index 0000000..6aac262
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/KitchenVideoTypeRefServiceImpl.java
@@ -0,0 +1,126 @@
+package cn.lili.modules.lmk.service.impl;
+
+import cn.lili.modules.lmk.domain.vo.KitchenVideoTypeVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import cn.lili.modules.lmk.domain.entity.KitchenVideoTypeRef;
+import cn.lili.modules.lmk.mapper.KitchenVideoTypeRefMapper;
+import cn.lili.modules.lmk.service.KitchenVideoTypeRefService;
+import cn.lili.base.Result;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.lili.modules.lmk.domain.form.KitchenVideoTypeRefForm;
+import cn.lili.modules.lmk.domain.vo.KitchenVideoTypeRefVO;
+import cn.lili.modules.lmk.domain.query.KitchenVideoTypeRefQuery;
+import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+import cn.lili.utils.PageUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.util.Assert;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 鍘ㄧ瑙嗛鏍囩鍏崇郴琛� 鏈嶅姟瀹炵幇绫�
+ *
+ * @author wp
+ * @since 2025-06-13
+ */
+@Service
+@RequiredArgsConstructor
+public class KitchenVideoTypeRefServiceImpl extends ServiceImpl<KitchenVideoTypeRefMapper, KitchenVideoTypeRef> implements KitchenVideoTypeRefService {
+
+ private final KitchenVideoTypeRefMapper kitchenVideoTypeRefMapper;
+
+ /**
+ * 娣诲姞
+ * @param form
+ * @return
+ */
+ @Override
+ public Result add(KitchenVideoTypeRefForm form) {
+ KitchenVideoTypeRef entity = KitchenVideoTypeRefForm.getEntityByForm(form, null);
+ baseMapper.insert(entity);
+ return Result.ok("娣诲姞鎴愬姛");
+ }
+
+ /**
+ * 淇敼
+ * @param form
+ * @return
+ */
+ @Override
+ public Result update(KitchenVideoTypeRefForm form) {
+ KitchenVideoTypeRef 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(KitchenVideoTypeRefQuery query) {
+ IPage<KitchenVideoTypeRefVO> page = PageUtil.getPage(query, KitchenVideoTypeRefVO.class);
+ baseMapper.getPage(page, query);
+ return Result.ok().data(page.getRecords()).total(page.getTotal());
+ }
+
+ /**
+ * 鏍规嵁id鏌ユ壘
+ * @param id
+ * @return
+ */
+ @Override
+ public Result detail(String id) {
+ KitchenVideoTypeRefVO vo = baseMapper.getById(id);
+ Assert.notNull(vo, "璁板綍涓嶅瓨鍦�");
+ return Result.ok().data(vo);
+ }
+
+ /**
+ * 鍒楄〃
+ * @return
+ */
+ @Override
+ public Result all() {
+ List<KitchenVideoTypeRef> entities = baseMapper.selectList(null);
+ List<KitchenVideoTypeRefVO> vos = entities.stream()
+ .map(entity -> KitchenVideoTypeRefVO.getVoByEntity(entity, null))
+ .collect(Collectors.toList());
+ return Result.ok().data(vos);
+ }
+
+ @Override
+ public List<KitchenVideoTypeVO> getTypeByVideoIds(List<String> videoIds) {
+ return baseMapper.getTypeByVideoIds(videoIds);
+ }
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
index b107ff1..dd10506 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
@@ -3,9 +3,7 @@
import cn.lili.common.security.context.UserContext;
import cn.lili.modules.lmk.domain.entity.*;
import cn.lili.modules.lmk.domain.form.*;
-import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
-import cn.lili.modules.lmk.domain.query.HealthVideoQuery;
-import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
+import cn.lili.modules.lmk.domain.query.*;
import cn.lili.modules.lmk.domain.vo.*;
import cn.lili.modules.lmk.enums.general.*;
import cn.lili.modules.lmk.service.*;
@@ -18,10 +16,10 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.lili.modules.lmk.mapper.VideoMapper;
import cn.lili.base.Result;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import cn.lili.modules.lmk.domain.query.VideoQuery;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
@@ -56,6 +54,7 @@
private final MySubscribeService mySubscribeService;
private final MemberService memberService;
private final VideoAccountService videoAccountService;
+ private final KitchenVideoTypeRefService kitchenVideoTypeRefService;
/**
@@ -482,4 +481,92 @@
baseMapper.deleteById(id);
return Result.ok("鍒犻櫎鎴愬姛");
}
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result addKitchenVideo(KitchenVideoForm form) {
+ Video video = new Video();
+ BeanUtils.copyProperties(form, video);
+ video.setAuthorId(UserContext.getCurrentUserId());
+ video.setVideoType(VideoTypeEnum.COOK.getValue());
+ //璁剧疆濉厖妯″紡 淇濇寔姣斾緥锛屽畬鏁存樉绀�
+ video.setVideoFit("contain");
+ video.setVideoContentType(VideoContentTypeEnum.VIDEO.getValue());
+ video.setStatus(VideoStatusEnum.PUBLISHED.getValue());
+ baseMapper.insert(video);
+ String id = video.getId();
+ List<KitchenVideoTypeRef> collect = form.getCheckKitchenType().stream().map(item -> {
+ KitchenVideoTypeRef kitchenVideoTypeRef = new KitchenVideoTypeRef();
+ //璁剧疆瑙嗛id
+ kitchenVideoTypeRef.setVideoId(id);
+ //璁剧疆鏍囩id
+ kitchenVideoTypeRef.setKitchenTypeId(item);
+ return kitchenVideoTypeRef;
+ }
+ ).collect(Collectors.toList());
+ kitchenVideoTypeRefService.saveBatch(collect);
+ return Result.ok("娣诲姞鎴愬姛");
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result updateKitchenVideo(KitchenVideoForm form) {
+ Video video = baseMapper.selectById(form.getId());
+ Assert.notNull(video, "璁板綍涓嶅瓨鍦�");
+ BeanUtils.copyProperties(form, video);
+ baseMapper.updateById(video);
+ //鍒犻櫎鍘熸潵鐨勭被鍨嬪叧绯�
+ kitchenVideoTypeRefService.remove(Wrappers.<KitchenVideoTypeRef>lambdaQuery()
+ .eq(KitchenVideoTypeRef::getVideoId, form.getId()));
+ String id = video.getId();
+ List<KitchenVideoTypeRef> collect = form.getCheckKitchenType().stream().map(item -> {
+ KitchenVideoTypeRef kitchenVideoTypeRef = new KitchenVideoTypeRef();
+ //璁剧疆瑙嗛id
+ kitchenVideoTypeRef.setVideoId(id);
+ //璁剧疆鏍囩id
+ kitchenVideoTypeRef.setKitchenTypeId(item);
+ return kitchenVideoTypeRef;
+ }
+ ).collect(Collectors.toList());
+ kitchenVideoTypeRefService.saveBatch(collect);
+ return Result.ok("淇敼鎴愬姛");
+ }
+
+ @Override
+ public Result KitchenVideoQuery(KitchenVideoQuery query) {
+ IPage<KitchenVideoVO> page = PageUtil.getPage(query, KitchenVideoVO.class);
+ // 1. 鍏堟煡鍑鸿棰戜俊鎭�
+ baseMapper.kitchenPage(page, query);
+ // 2. 鍗曠嫭鏌ュ嚭鏍囩淇℃伅
+ if (page.getTotal() > 0) {
+ Map<String, List<KitchenVideoTypeVO>> typeMap = kitchenVideoTypeRefService
+ .getTypeByVideoIds(
+ page.getRecords()
+ .stream().map(KitchenVideoVO::getId).collect(Collectors.toList()))
+ .stream().collect(Collectors.groupingBy(KitchenVideoTypeVO::getVideoId));
+ // 3. 鑾峰彇瑙嗛涓存椂璁块棶鍦板潃銆佽缃棰戞爣绛�
+ page.getRecords().forEach(v -> {
+ v.setTypeList(typeMap.get(v.getId()));
+ v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
+ v.setCoverShowUrl(cosUtil.getPreviewUrl(v.getCoverUrl()));
+ });
+ }
+ return Result.ok().data(page.getRecords()).total(page.getTotal());
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result delKitchen(String id) {
+ Video entity = baseMapper.selectById(id);
+ Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
+ String videoType = entity.getVideoType();
+ if (!VideoTypeEnum.COOK.getValue().equals(videoType)) {
+ log.error("鍒犻櫎闈炲ぇ绁炲帹瑙嗛瑙嗛id涓�------->"+id);
+ return Result.error("鍒犻櫎澶辫触");
+ }
+ baseMapper.deleteById(id);
+ kitchenVideoTypeRefService.remove(Wrappers.<KitchenVideoTypeRef>lambdaQuery()
+ .eq(KitchenVideoTypeRef::getVideoId, id));
+ return Result.ok("鍒犻櫎鎴愬姛");
+ }
}
diff --git a/framework/src/main/resources/mapper/lmk/KitchenVideoTypeRefMapper.xml b/framework/src/main/resources/mapper/lmk/KitchenVideoTypeRefMapper.xml
new file mode 100644
index 0000000..42268c3
--- /dev/null
+++ b/framework/src/main/resources/mapper/lmk/KitchenVideoTypeRefMapper.xml
@@ -0,0 +1,53 @@
+<?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.KitchenVideoTypeRefMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.KitchenVideoTypeRefVO">
+ <id column="id" property="id"/>
+ <result column="video_id" property="videoId" />
+ <result column="kitchen_type_id" property="kitchenTypeId" />
+ </resultMap>
+
+
+
+
+
+
+
+ <select id="getById" resultMap="BaseResultMap">
+ SELECT
+ LKVTR.video_id,
+ LKVTR.kitchen_type_id,
+ LKVTR.id
+ FROM
+ lmk_kitchen_video_type_ref LKVTR
+ WHERE
+ LKVTR.id = #{id} AND LKVTR.delete_flag = 0
+ </select>
+
+
+ <select id="getPage" resultMap="BaseResultMap">
+ SELECT
+ LKVTR.video_id,
+ LKVTR.kitchen_type_id,
+ LKVTR.id
+ FROM
+ lmk_kitchen_video_type_ref LKVTR
+ WHERE
+ LKVTR.delete_flag = 0
+ </select>
+
+ <select id="getTypeByVideoIds" resultType="cn.lili.modules.lmk.domain.vo.KitchenVideoTypeVO">
+ SELECT
+ LKVTR.video_id,
+ LKT.id,
+ LKT.type_name
+ FROM
+ lmk_kitchen_video_type_ref LKVTR
+ JOIN lmk_kitchen_type LKT ON LKVTR.kitchen_type_id = LKT.id
+ WHERE
+ LKVTR.video_id IN <foreach collection="videoIds" open="(" item="videoId" close=")" separator=",">#{videoId}</foreach>
+ </select>
+
+</mapper>
diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
index f7a65ba..f212216 100644
--- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -27,6 +27,31 @@
<result column="video_type" property="videoType" />
<result column="video_imgs" property="videoImgs" />
</resultMap>
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="KitchenVideoMap" type="cn.lili.modules.lmk.domain.vo.KitchenVideoVO">
+ <id column="id" property="id"/>
+ <result column="author_id" property="authorId" />
+ <result column="authorName" property="authorName" />
+ <result column="cover_url" property="coverUrl" />
+ <result column="video_file_key" property="videoFileKey" />
+ <result column="video_fit" property="videoFit" />
+ <result column="title" property="title" />
+ <result column="goods_id" property="goodsId" />
+ <result column="goods_view_num" property="goodsViewNum" />
+ <result column="video_duration" property="videoDuration" />
+ <result column="goods_order_num" property="goodsOrderNum" />
+ <result column="recommend" property="recommend" />
+ <result column="status" property="status" />
+ <result column="play_num" property="playNum" />
+ <result column="collect_num" property="collectNum" />
+ <result column="comment_num" property="commentNum" />
+ <result column="weight" property="weight" />
+ <result column="audit_pass_time" property="auditPassTime" />
+ <result column="update_time" property="updateTime" />
+ <result column="video_content_type" property="videoContentType" />
+ <result column="video_type" property="videoType" />
+ <result column="video_imgs" property="videoImgs" />
+ </resultMap>
<!-- 寰俊鎺ㄨ崘瑙嗛 -->
<resultMap id="WxResultMap" type="cn.lili.modules.lmk.domain.vo.WxVideoVO">
@@ -393,4 +418,45 @@
<if test="query.authorId != null and query.authorId != ''">AND LV.author_id = #{query.authorId}</if>
<if test="query.status != null and query.status != ''">AND LV.status = #{query.status}</if>
</select>
+
+ <select id="kitchenPage" resultMap="KitchenVideoMap">
+ SELECT
+ LV.author_id,
+ LV.cover_url,
+ LV.video_fit,
+ LV.video_duration,
+ LV.video_file_key,
+ LV.title,
+ LV.goods_view_num,
+ LV.goods_order_num,
+ LV.recommend,
+ LV.status,
+ LV.play_num,
+ LV.collect_num,
+ LV.comment_num,
+ LV.weight,
+ LV.audit_pass_time,
+ LV.update_time,
+ LV.video_content_type,
+ LV.video_type,
+ LV.video_imgs,
+ LV.id,
+ LM.nick_name as authorName
+ FROM
+ lmk_video LV
+ LEFT JOIN li_member LM ON LV.author_id = LM.id
+ <if test="query.typeList != null and query.typeList.size > 0">
+ INNER JOIN (
+ SELECT DISTINCT video_id
+ FROM lmk_kitchen_video_type_ref
+ WHERE kitchen_type_id IN
+ <foreach collection="query.typeList" open="(" item="tagId" close=")" separator=",">#{tagId}</foreach>
+ ) AS LVT ON LV.id = LVT.video_id
+ </if>
+ WHERE
+ LV.delete_flag = 0 AND LV.video_type = #{query.videoType}
+ <if test="query.title != null and query.title != ''">AND LV.title LIKE CONCAT('%', #{query.title}, '%')</if>
+ <if test="query.authorId != null and query.authorId != ''">AND LV.author_id = #{query.authorId}</if>
+ <if test="query.status != null and query.status != ''">AND LV.status = #{query.status}</if>
+ </select>
</mapper>
diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/KitchenVideoController.java b/manager-api/src/main/java/cn/lili/controller/lmk/KitchenVideoController.java
new file mode 100644
index 0000000..1b2c182
--- /dev/null
+++ b/manager-api/src/main/java/cn/lili/controller/lmk/KitchenVideoController.java
@@ -0,0 +1,59 @@
+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.HealthVideoForm;
+import cn.lili.modules.lmk.domain.form.KitchenTypeForm;
+import cn.lili.modules.lmk.domain.form.KitchenVideoForm;
+import cn.lili.modules.lmk.domain.query.HealthVideoQuery;
+import cn.lili.modules.lmk.domain.query.KitchenTypeQuery;
+import cn.lili.modules.lmk.domain.query.KitchenVideoQuery;
+import cn.lili.modules.lmk.service.KitchenTypeService;
+import cn.lili.modules.lmk.service.VideoService;
+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 wp
+ * @since 2025-06-13
+ */
+@Validated
+@RequiredArgsConstructor
+@Api(value = "鍘ㄧ瑙嗛", tags = "鍘ㄧ瑙嗛绠$悊")
+@RestController
+@RequestMapping("/manager/lmk/kitchen-video")
+public class KitchenVideoController {
+
+ private final VideoService videoService;
+
+ @PostMapping("/addKitchenVideo")
+ @ApiOperation(value = "鍘ㄧ瑙嗛鍙戝竷", notes = "鍘ㄧ瑙嗛鍙戝竷")
+ public Result addKitchenVideo(@RequestBody @Validated(Add.class) KitchenVideoForm form) {
+ return videoService.addKitchenVideo(form);
+ }
+ @PostMapping("/updateKitchenVideo")
+ @ApiOperation(value = "鍘ㄧ瑙嗛淇敼", notes = "鍘ㄧ瑙嗛淇敼")
+ public Result updateKitchenVideo(@RequestBody @Validated(Update.class) KitchenVideoForm form) {
+ return videoService.updateKitchenVideo(form);
+ }
+ @PostMapping("/page")
+ @ApiOperation(value = "鍘ㄧ瑙嗛鍒楄〃", notes = "鍘ㄧ瑙嗛鍒楄〃")
+ public Result page(@RequestBody KitchenVideoQuery query) {
+ return videoService.KitchenVideoQuery(query);
+ }
+
+ @PostMapping("/del/{id}")
+ @ApiOperation(value = "鍒犻櫎澶у帹绁炶棰�", notes = "鍒犻櫎澶у帹绁炶棰�")
+ public Result delKitchen(@PathVariable("id") String id) {
+ return videoService.delKitchen(id);
+ }
+}
--
Gitblit v1.8.0