Browse Source

完成风格LoRA(我的收藏)

tsurumure 3 months ago
parent
commit
f8c0d62691

+ 4 - 4
db/crt_drama_project.sql

@@ -10,15 +10,15 @@ CREATE TABLE `crt_drama_project` (
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
     `user_id` BIGINT NOT NULL COMMENT '用户ID',
     `user_id` BIGINT NOT NULL COMMENT '用户ID',
     `project_name` VARCHAR(50) NOT NULL COMMENT '项目名称',
     `project_name` VARCHAR(50) NOT NULL COMMENT '项目名称',
-    `crt_drama_lora_style_id` BIGINT COMMENT '风格LoRA ID',
-    `crt_drama_lora_character_ids` VARCHAR(10) COMMENT '人物LoRA ID (多个值使用逗号分隔)',
+    `drama_lora_style_id` BIGINT COMMENT '风格LoRA ID',
+    `drama_lora_character_ids` VARCHAR(10) COMMENT '人物LoRA ID (多个值使用逗号分隔)',
     `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     INDEX `idx_user_id` (`user_id`),
     INDEX `idx_user_id` (`user_id`),
-    INDEX `idx_crt_drama_lora_style_id` (`crt_drama_lora_style_id`)
+    INDEX `idx_drama_lora_style_id` (`drama_lora_style_id`)
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-项目表';
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-项目表';
 
 
-INSERT INTO crt_drama_project(user_id, project_name, crt_drama_lora_style_id, crt_drama_lora_character_ids) VALUES
+INSERT INTO crt_drama_project(user_id, project_name, drama_lora_style_id, drama_lora_character_ids) VALUES
     (1, '测试项目', null, null),
     (1, '测试项目', null, null),
     (1, '我的仙狐娘娘', 1, '1,2'),
     (1, '我的仙狐娘娘', 1, '1,2'),
     (1, '数量测试项目3', null, null),
     (1, '数量测试项目3', null, null),

+ 12 - 12
db/crt_drama_project_settings.sql

@@ -4,27 +4,27 @@ Source Database: backendsys
 Date: 2025/06/03 10:09:22
 Date: 2025/06/03 10:09:22
 */
 */
 
 
-DROP TABLE IF EXISTS `crt_drama_project_settings`;
-CREATE TABLE `crt_drama_project_settings` (
+DROP TABLE IF EXISTS `drama_project_settings`;
+CREATE TABLE `drama_project_settings` (
     PRIMARY KEY (`id`),
     PRIMARY KEY (`id`),
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
-    `crt_drama_project_id` BIGINT NOT NULL COMMENT '项目ID',
-    `crt_drama_project_setting_type` INT NOT NULL COMMENT '项目配置类型 (1: 生图配置, 2: 生视频配置)',
+    `drama_project_id` BIGINT NOT NULL COMMENT '项目ID',
+    `drama_project_setting_type` INT NOT NULL COMMENT '项目配置类型 (1: 生图配置, 2: 生视频配置)',
     `aspect_ratio` VARCHAR(10) COMMENT '画面比例 (枚举)(16:9 - 1280*720, 9:16 - 720*1280, 1:1 - 1024*1024)',
     `aspect_ratio` VARCHAR(10) COMMENT '画面比例 (枚举)(16:9 - 1280*720, 9:16 - 720*1280, 1:1 - 1024*1024)',
-    `crt_model_id` BIGINT COMMENT '基础模型ID (固定值接口)(1: F.1-dev.safetensors)',
-    `crt_lora_style_id` BIGINT COMMENT '风格LoRA ID',
-    `crt_lora_style_strength` FLOAT COMMENT '风格强度 (默认值:1,范围:0~2.0,保留小数点后一位)',
-    INDEX `idx_crt_model_id` (`crt_model_id`),
-    INDEX `idx_crt_lora_style_id` (`crt_lora_style_id`),
-    INDEX `idx_crt_drama_project_id` (`crt_drama_project_id`)
+    `model_id` BIGINT COMMENT '基础模型ID (固定值接口)(1: F.1-dev.safetensors)',
+    `lora_style_id` BIGINT COMMENT '风格LoRA ID',
+    `lora_style_strength` FLOAT COMMENT '风格强度 (默认值:1,范围:0~2.0,保留小数点后一位)',
+    INDEX `idx_model_id` (`model_id`),
+    INDEX `idx_lora_style_id` (`lora_style_id`),
+    INDEX `idx_drama_project_id` (`drama_project_id`)
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-项目配置表';
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-项目配置表';
 
 
 /*
 /*
- 当配置类型为生图配置时,aspect_ratio、crt_drama_base_model_id、crt_drama_lora_style_id、crt_drama_lora_style_strength 为必填项
+ 当配置类型为生图配置时,aspect_ratio、drama_base_model_id、drama_lora_style_id、drama_lora_style_strength 为必填项
  当配置类型为生视频配置时,aspect_ratio 为必填项
  当配置类型为生视频配置时,aspect_ratio 为必填项
  */
  */
 
 
-INSERT INTO crt_drama_project_settings(crt_drama_project_id, crt_drama_project_setting_type, aspect_ratio, crt_model_id, crt_lora_style_id, crt_lora_style_strength) VALUES
+INSERT INTO drama_project_settings(drama_project_id, drama_project_setting_type, aspect_ratio, model_id, lora_style_id, lora_style_strength) VALUES
     (1, 1, '16:9', 1, 1, 1),
     (1, 1, '16:9', 1, 1, 1),
     (1, 2, '16:9', null, null, null)
     (1, 2, '16:9', null, null, null)
 ;
 ;

+ 4 - 4
db/crt_drama_project_storyboard.sql

@@ -10,7 +10,7 @@ CREATE TABLE `crt_drama_project_storyboard` (
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
     `user_id` BIGINT NOT NULL COMMENT '用户ID',
     `user_id` BIGINT NOT NULL COMMENT '用户ID',
 
 
-    `crt_drama_project_id` BIGINT COMMENT '项目ID',
+    `drama_project_id` BIGINT COMMENT '项目ID',
     `episode_num` INT NOT NULL COMMENT '集数 (不超过999集)',
     `episode_num` INT NOT NULL COMMENT '集数 (不超过999集)',
     `sort` INT NOT NULL COMMENT '排序',
     `sort` INT NOT NULL COMMENT '排序',
 
 
@@ -18,7 +18,7 @@ CREATE TABLE `crt_drama_project_storyboard` (
     `story_framing` VARCHAR(500) COMMENT '景别',
     `story_framing` VARCHAR(500) COMMENT '景别',
     `story_scene` VARCHAR(500) COMMENT '场景',
     `story_scene` VARCHAR(500) COMMENT '场景',
     `story_weather_time` VARCHAR(500) COMMENT '天气/时间',
     `story_weather_time` VARCHAR(500) COMMENT '天气/时间',
-    `crt_lora_figure_ids` VARCHAR(255) COMMENT '人物LoRA ID (创建时,跟随项目的人物LoRAID)(多个人物ID以逗号分隔)',
+    `lora_figure_ids` VARCHAR(255) COMMENT '人物LoRA ID (创建时,跟随项目的人物LoRAID)(多个人物ID以逗号分隔)',
 
 
     `param_image_count` INT DEFAULT '1' COMMENT '每次生成图片数量 (默认值:1,整数范围:1~4)',
     `param_image_count` INT DEFAULT '1' COMMENT '每次生成图片数量 (默认值:1,整数范围:1~4)',
     `param_prompt_weight` FLOAT DEFAULT '3.5' COMMENT '提示词引导系数 (默认值:3.5,小数点后一位,范围:1~30)',
     `param_prompt_weight` FLOAT DEFAULT '3.5' COMMENT '提示词引导系数 (默认值:3.5,小数点后一位,范围:1~30)',
@@ -40,8 +40,8 @@ CREATE TABLE `crt_drama_project_storyboard` (
     INDEX `idx_user_id` (`user_id`)
     INDEX `idx_user_id` (`user_id`)
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-分镜表';
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-分镜表';
 
 
-INSERT INTO crt_drama_project_storyboard(user_id, crt_drama_project_id, episode_num, sort, story_prompt, story_framing, story_scene, story_weather_time,
-                                         crt_lora_figure_ids, text_to_image_prompt) VALUES
+INSERT INTO crt_drama_project_storyboard(user_id, drama_project_id, episode_num, sort, story_prompt, story_framing, story_scene, story_weather_time,
+                                         lora_figure_ids, text_to_image_prompt) VALUES
     (1, 1, 1, 2, null, null, null, null, '1,2', null),
     (1, 1, 1, 2, null, null, null, null, '1,2', null),
     (1, 1, 1, 1, '全景俯拍,跟镜柳王妃慢慢走向王府大门', '全景', '王府门口外景', '下雪的夜晚', '1,2', '漆黑的夜晚,大雪,光线昏暗,远景,高角度,从上面拍摄,宽阔的街道从左下延伸到右上,街道两旁的建筑是中国古代风格,街道尽头画面右上角的建筑比其他建筑高,仅有一个女人背对镜头走在街道上,穿着红色连帽斗篷,一袭纯红色的绸缎轻纱质感长裙,裙摆到脚踝,双足赤裸,红色连帽斗篷,女人的位置处在画面左上,画面右侧的屋檐上站着一只头部朝向女人小乌鸦,以中国古风动漫风格呈现')
     (1, 1, 1, 1, '全景俯拍,跟镜柳王妃慢慢走向王府大门', '全景', '王府门口外景', '下雪的夜晚', '1,2', '漆黑的夜晚,大雪,光线昏暗,远景,高角度,从上面拍摄,宽阔的街道从左下延伸到右上,街道两旁的建筑是中国古代风格,街道尽头画面右上角的建筑比其他建筑高,仅有一个女人背对镜头走在街道上,穿着红色连帽斗篷,一袭纯红色的绸缎轻纱质感长裙,裙摆到脚踝,双足赤裸,红色连帽斗篷,女人的位置处在画面左上,画面右侧的屋檐上站着一只头部朝向女人小乌鸦,以中国古风动漫风格呈现')
 ;
 ;

+ 2 - 2
db/crt_drama_task.sql

@@ -9,7 +9,7 @@ CREATE TABLE `crt_drama_task` (
     PRIMARY KEY (`id`),
     PRIMARY KEY (`id`),
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
     `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
     `user_id` BIGINT NOT NULL COMMENT '用户ID',
     `user_id` BIGINT NOT NULL COMMENT '用户ID',
-    `crt_drama_project_id` BIGINT NOT NULL COMMENT '项目ID',
+    `drama_project_id` BIGINT NOT NULL COMMENT '项目ID',
     `task_id` VARCHAR(255) NOT NULL COMMENT '任务ID',
     `task_id` VARCHAR(255) NOT NULL COMMENT '任务ID',
     `task_type` TINYINT NOT NULL COMMENT '任务类型 (1:图像, 2:视频)',
     `task_type` TINYINT NOT NULL COMMENT '任务类型 (1:图像, 2:视频)',
     `task_status` TINYINT DEFAULT '-1' COMMENT '任务状态 (-1:未开始, 1:进行中, 2:成功, 3:失败)',
     `task_status` TINYINT DEFAULT '-1' COMMENT '任务状态 (-1:未开始, 1:进行中, 2:成功, 3:失败)',
@@ -18,7 +18,7 @@ CREATE TABLE `crt_drama_task` (
     `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     INDEX `idx_user_id` (`user_id`),
     INDEX `idx_user_id` (`user_id`),
-    INDEX `idx_crt_drama_project_id` (`crt_drama_project_id`),
+    INDEX `idx_drama_project_id` (`drama_project_id`),
     INDEX `idx_task_id` (`task_id`)
     INDEX `idx_task_id` (`task_id`)
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-生图任务表';
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-生图任务表';
 
 

+ 18 - 0
db/crt_lora_style_collect.sql

@@ -0,0 +1,18 @@
+/**
+Source Server Version: 8.0.31
+Source Database: backendsys
+Date: 2025/06/03 10:09:22
+*/
+
+DROP TABLE IF EXISTS `crt_lora_style_collect`;
+CREATE TABLE `crt_lora_style_collect` (
+    `user_id` BIGINT NOT NULL COMMENT '用户ID',
+    `lora_style_id` BIGINT NOT NULL COMMENT '风格ID',
+    INDEX `idx_user_id` (`user_id`),
+    INDEX `idx_lora_style_id` (`lora_style_id`)
+) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='短剧创作-风格LoRA-用户收藏表';
+
+INSERT INTO crt_lora_style_collect(user_id, lora_style_id) VALUES
+    (1, 1),
+    (1, 2)
+;

+ 10 - 0
src/main/java/com/backendsys/modules/crt/controller/CrtLoraStyleController.java

@@ -1,5 +1,6 @@
 package com.backendsys.modules.crt.controller;
 package com.backendsys.modules.crt.controller;
 
 
+import com.backendsys.modules.common.config.security.utils.SecurityUtil;
 import com.backendsys.modules.common.utils.Result;
 import com.backendsys.modules.common.utils.Result;
 import com.backendsys.modules.crt.entity.CrtLoraStyle;
 import com.backendsys.modules.crt.entity.CrtLoraStyle;
 import com.backendsys.modules.crt.service.CrtLoraStyleService;
 import com.backendsys.modules.crt.service.CrtLoraStyleService;
@@ -25,10 +26,19 @@ public class CrtLoraStyleController {
         return Result.success().put("data", crtLoraStyleService.selectCrtLoraStyleList(crtLoraStyle));
         return Result.success().put("data", crtLoraStyleService.selectCrtLoraStyleList(crtLoraStyle));
     }
     }
 
 
+    @Operation(summary = "获取短剧创作-风格LoRA列表-我收藏的")
+    @GetMapping("/api/crt/drama/getLoraStyleListByCollect")
+    public Result getLoraStyleListByCollect(@Validated CrtLoraStyle crtLoraStyle) {
+        crtLoraStyle.setUser_id(SecurityUtil.getUserId());
+        return Result.success().put("data", crtLoraStyleService.selectCrtLoraStyleListByCollect(crtLoraStyle));
+    }
+
     @Operation(summary = "获取短剧创作-风格分类列表")
     @Operation(summary = "获取短剧创作-风格分类列表")
     @GetMapping("/api/crt/drama/getLoraStyleCategoryList")
     @GetMapping("/api/crt/drama/getLoraStyleCategoryList")
     public Result getLoraStyleCategoryList() {
     public Result getLoraStyleCategoryList() {
         return Result.success().put("data", crtLoraStyleService.selectCrtLoraStyleCategoryList());
         return Result.success().put("data", crtLoraStyleService.selectCrtLoraStyleCategoryList());
     }
     }
 
 
+
+
 }
 }

+ 9 - 0
src/main/java/com/backendsys/modules/crt/dao/CrtLoraStyleCollectDao.java

@@ -0,0 +1,9 @@
+package com.backendsys.modules.crt.dao;
+
+import com.backendsys.modules.crt.entity.CrtLoraStyleCollect;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CrtLoraStyleCollectDao extends BaseMapper<CrtLoraStyleCollect> {
+}

+ 2 - 2
src/main/java/com/backendsys/modules/crt/entity/CrtDramaProject.java

@@ -28,8 +28,8 @@ public class CrtDramaProject {
     @TableField(exist = false)
     @TableField(exist = false)
     private List<Integer> storyboard_episode_nums;  // 集数 (子查询)
     private List<Integer> storyboard_episode_nums;  // 集数 (子查询)
 
 
-    private Long crt_drama_lora_style_id;
-    private String crt_drama_lora_character_ids;
+    private Long drama_lora_style_id;
+    private String drama_lora_character_ids;
     private String create_time;
     private String create_time;
     private String update_time;
     private String update_time;
 
 

+ 5 - 5
src/main/java/com/backendsys/modules/crt/entity/CrtDramaProjectSettings.java

@@ -13,11 +13,11 @@ public class CrtDramaProjectSettings {
 
 
     @TableId(type = IdType.AUTO)
     @TableId(type = IdType.AUTO)
     private Long id;
     private Long id;
-    private Long crt_drama_project_id;
-    private Integer crt_drama_project_setting_type;
+    private Long drama_project_id;
+    private Integer drama_project_setting_type;
     private String aspect_ratio;
     private String aspect_ratio;
-    private Long crt_model_id;
-    private Long crt_lora_style_id;
-    private Float crt_lora_style_strength;
+    private Long model_id;
+    private Long lora_style_id;
+    private Float lora_style_strength;
 
 
 }
 }

+ 2 - 2
src/main/java/com/backendsys/modules/crt/entity/CrtDramaProjectStoryboard.java

@@ -18,7 +18,7 @@ public class CrtDramaProjectStoryboard {
     private Long id;
     private Long id;
 
 
     private Long user_id;
     private Long user_id;
-    private Long crt_drama_project_id;              // 项目ID
+    private Long drama_project_id;              // 项目ID
     private Integer episode_num;                    // 集数 (不超过999集)
     private Integer episode_num;                    // 集数 (不超过999集)
     private Integer sort;                           // 排序
     private Integer sort;                           // 排序
 
 
@@ -26,7 +26,7 @@ public class CrtDramaProjectStoryboard {
     private String story_framing;                   // 景别
     private String story_framing;                   // 景别
     private String story_scene;                     // 场景
     private String story_scene;                     // 场景
     private String story_weather_time;              // 天气/时间
     private String story_weather_time;              // 天气/时间
-    private String crt_lora_figure_ids;             // 人物LoRA ID (创建时,跟随项目的人物LoRAID)(多个人物ID以逗号分隔)
+    private String lora_figure_ids;             // 人物LoRA ID (创建时,跟随项目的人物LoRAID)(多个人物ID以逗号分隔)
 
 
     private Integer param_image_count;              // 每次生成图片数量 (默认值:1,整数范围:1~4)
     private Integer param_image_count;              // 每次生成图片数量 (默认值:1,整数范围:1~4)
     private Float param_prompt_weight;              // 提示词引导系数 (默认值:3.5,小数点后一位,范围:1~30)
     private Float param_prompt_weight;              // 提示词引导系数 (默认值:3.5,小数点后一位,范围:1~30)

+ 1 - 1
src/main/java/com/backendsys/modules/crt/entity/CrtDramaTask.java

@@ -12,7 +12,7 @@ public class CrtDramaTask {
     @TableId(type = IdType.AUTO)
     @TableId(type = IdType.AUTO)
     private Long id;
     private Long id;
     private Long user_id;                       // 用户ID
     private Long user_id;                       // 用户ID
-    private Long crt_drama_project_id;          // 项目ID
+    private Long drama_project_id;          // 项目ID
     private String task_id;                     // 任务ID
     private String task_id;                     // 任务ID
     private Integer task_type;                  // 任务类型 (1:图像, 2:视频)
     private Integer task_type;                  // 任务类型 (1:图像, 2:视频)
     private Integer task_status;                // 任务状态 (-1:未开始, 1:进行中, 2:成功, 3:失败)
     private Integer task_status;                // 任务状态 (-1:未开始, 1:进行中, 2:成功, 3:失败)

+ 3 - 0
src/main/java/com/backendsys/modules/crt/entity/CrtLoraStyle.java

@@ -1,6 +1,7 @@
 package com.backendsys.modules.crt.entity;
 package com.backendsys.modules.crt.entity;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.Data;
@@ -11,6 +12,8 @@ public class CrtLoraStyle {
 
 
     @TableId(type = IdType.AUTO)
     @TableId(type = IdType.AUTO)
     private Long id;
     private Long id;
+    @TableField(exist = false)
+    private Long user_id;
     private Long category_id;
     private Long category_id;
     private String name;                   // 风格名称
     private String name;                   // 风格名称
     private String lora_style_name;        // 风格LoRA名称
     private String lora_style_name;        // 风格LoRA名称

+ 13 - 0
src/main/java/com/backendsys/modules/crt/entity/CrtLoraStyleCollect.java

@@ -0,0 +1,13 @@
+package com.backendsys.modules.crt.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("crt_lora_style_collect")
+public class CrtLoraStyleCollect {
+    private Long user_id;
+    private Long lora_style_id;
+}

+ 4 - 0
src/main/java/com/backendsys/modules/crt/service/CrtLoraStyleService.java

@@ -10,6 +10,10 @@ public interface CrtLoraStyleService {
 
 
     // 获取短剧创作-风格LoRA列表
     // 获取短剧创作-风格LoRA列表
     PageEntity selectCrtLoraStyleList(CrtLoraStyle crtLoraStyle);
     PageEntity selectCrtLoraStyleList(CrtLoraStyle crtLoraStyle);
+
+    // 获取短剧创作-风格LoRA列表-用户收藏的
+    PageEntity selectCrtLoraStyleListByCollect(CrtLoraStyle crtLoraStyle);
+
     // 获取短剧创作-风格分类列表
     // 获取短剧创作-风格分类列表
     List<CrtLoraStyleCategory> selectCrtLoraStyleCategoryList();
     List<CrtLoraStyleCategory> selectCrtLoraStyleCategoryList();
 
 

+ 40 - 1
src/main/java/com/backendsys/modules/crt/service/impl/CrtLoraStyleServiceImpl.java

@@ -1,9 +1,11 @@
 package com.backendsys.modules.crt.service.impl;
 package com.backendsys.modules.crt.service.impl;
 
 
 import com.backendsys.modules.crt.dao.CrtLoraStyleCategoryDao;
 import com.backendsys.modules.crt.dao.CrtLoraStyleCategoryDao;
+import com.backendsys.modules.crt.dao.CrtLoraStyleCollectDao;
 import com.backendsys.modules.crt.dao.CrtLoraStyleDao;
 import com.backendsys.modules.crt.dao.CrtLoraStyleDao;
 import com.backendsys.modules.crt.entity.CrtLoraStyle;
 import com.backendsys.modules.crt.entity.CrtLoraStyle;
 import com.backendsys.modules.crt.entity.CrtLoraStyleCategory;
 import com.backendsys.modules.crt.entity.CrtLoraStyleCategory;
+import com.backendsys.modules.crt.entity.CrtLoraStyleCollect;
 import com.backendsys.modules.crt.service.CrtLoraStyleService;
 import com.backendsys.modules.crt.service.CrtLoraStyleService;
 import com.backendsys.utils.response.PageEntity;
 import com.backendsys.utils.response.PageEntity;
 import com.backendsys.utils.response.PageInfoResult;
 import com.backendsys.utils.response.PageInfoResult;
@@ -12,15 +14,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 
 @Service
 @Service
 public class CrtLoraStyleServiceImpl implements CrtLoraStyleService {
 public class CrtLoraStyleServiceImpl implements CrtLoraStyleService {
 
 
     @Autowired
     @Autowired
     private CrtLoraStyleDao crtLoraStyleDao;
     private CrtLoraStyleDao crtLoraStyleDao;
-
+    @Autowired
+    private CrtLoraStyleCollectDao crtLoraStyleCollectDao;
     @Autowired
     @Autowired
     private CrtLoraStyleCategoryDao crtLoraStyleCategoryDao;
     private CrtLoraStyleCategoryDao crtLoraStyleCategoryDao;
 
 
@@ -34,6 +39,40 @@ public class CrtLoraStyleServiceImpl implements CrtLoraStyleService {
         return new PageInfoResult(list).toEntity();
         return new PageInfoResult(list).toEntity();
     }
     }
 
 
+    /**
+     * 获取短剧创作-风格LoRA列表-用户收藏的
+     */
+    @Override
+    public PageEntity selectCrtLoraStyleListByCollect(CrtLoraStyle crtLoraStyle) {
+
+        // 查询当前用户,已经收藏的风格ID集合
+        LambdaQueryWrapper<CrtLoraStyleCollect> wrapperCollect = new LambdaQueryWrapper<>();
+        wrapperCollect.eq(CrtLoraStyleCollect::getUser_id, crtLoraStyle.getUser_id());
+        List<CrtLoraStyleCollect> crtLoraStyleCollectList = crtLoraStyleCollectDao.selectList(wrapperCollect);
+
+        PageUtils.startPage();  // 分页
+
+        // 根据ID集合,查询风格LoRA列表
+        List<CrtLoraStyle> list = new ArrayList<>();
+        if (!crtLoraStyleCollectList.isEmpty()) {
+
+            LambdaQueryWrapper<CrtLoraStyle> wrapper = new LambdaQueryWrapper<>();
+            List<Long> lora_style_ids = crtLoraStyleCollectList.stream()
+                .map(CrtLoraStyleCollect::getLora_style_id)
+                .collect(Collectors.toList());
+            wrapper.in(CrtLoraStyle::getId, lora_style_ids);
+            if (!crtLoraStyle.getName().isEmpty()) wrapper.like(CrtLoraStyle::getName, crtLoraStyle.getName());
+            if (crtLoraStyle.getCategory_id() != null) wrapper.eq(CrtLoraStyle::getCategory_id, crtLoraStyle.getCategory_id());
+
+            list = crtLoraStyleDao.selectList(wrapper);
+            list = list.stream().map(item -> {
+                item.setUser_id(crtLoraStyle.getUser_id());
+                return item;
+            }).collect(Collectors.toList());
+        }
+        return new PageInfoResult(list).toEntity();
+    }
+
     /**
     /**
      * 获取短剧创作-风格分类列表
      * 获取短剧创作-风格分类列表
      */
      */

+ 4 - 4
src/main/resources/mapper/crt/drama/CrtDramaProjectDao.xml

@@ -6,8 +6,8 @@
         p.id,
         p.id,
         p.user_id,
         p.user_id,
         p.project_name,
         p.project_name,
-        COALESCE(p.crt_drama_lora_style_id, '') crt_drama_lora_style_id,
-        COALESCE(p.crt_drama_lora_character_ids, '') crt_drama_lora_character_ids,
+        COALESCE(p.drama_lora_style_id, '') drama_lora_style_id,
+        COALESCE(p.drama_lora_character_ids, '') drama_lora_character_ids,
         p.create_time,
         p.create_time,
         p.update_time
         p.update_time
     </sql>
     </sql>
@@ -18,8 +18,8 @@
         <result property="project_name" column="project_name" />
         <result property="project_name" column="project_name" />
         <result property="storyboard_episode_nums" column="storyboard_episode_nums" javaType="java.util.List"
         <result property="storyboard_episode_nums" column="storyboard_episode_nums" javaType="java.util.List"
                 jdbcType="VARCHAR" typeHandler="com.backendsys.config.Mybatis.handler.StringToListTypeHandler" />
                 jdbcType="VARCHAR" typeHandler="com.backendsys.config.Mybatis.handler.StringToListTypeHandler" />
-        <result property="crt_drama_lora_style_id" column="crt_drama_lora_style_id" javaType="java.lang.Long" />
-        <result property="crt_drama_lora_character_ids" column="crt_drama_lora_character_ids" />
+        <result property="drama_lora_style_id" column="drama_lora_style_id" javaType="java.lang.Long" />
+        <result property="drama_lora_character_ids" column="drama_lora_character_ids" />
         <result property="create_time" column="create_time" />
         <result property="create_time" column="create_time" />
         <result property="update_time" column="update_time" />
         <result property="update_time" column="update_time" />
     </resultMap>
     </resultMap>