Selaa lähdekoodia

整合我的数字人,及增加搜索

wuyouzhi 4 viikkoa sitten
vanhempi
commit
18e3e2aa78

+ 9 - 3
xyzc-start/src/main/java/com/xyzc/start/controller/NumPersonController.java

@@ -106,12 +106,18 @@ public class NumPersonController {
      */
     @PostMapping("/queryTrainingModel")
     @ResponseBody
-    public Result<List<NpCommitTrain>> queryTrainingModel(@RequestBody NpRequestParams npRequestParams) throws Exception {
-        List<NpCommitTrain> npTemplateList = npQueryService.queryTrainingModel(npRequestParams.getPage(), npRequestParams.getSize());
+    public Result<Page<NpCommitTrain>> queryTrainingModel(@RequestBody NpRequestParams npRequestParams) {
+        Page<NpCommitTrain> npTemplateList = npQueryService.queryTrainingModel(npRequestParams.getType(), npRequestParams.getName(), npRequestParams.getPage(), npRequestParams.getSize());
         return Result.ok(npTemplateList);
     }
 
 
+//    @PostMapping("/queryCompanySound")
+//    @ResponseBody
+//    public Result<Page<NpSound>> queryCompanySound(@RequestBody NpRequestParams npRequestParams) throws Exception {
+//        Page<NpSound> companySoundList = npQueryService.queryCompanySound(npRequestParams.getType(), npRequestParams.getPage(), npRequestParams.getSize());
+//        return Result.ok(companySoundList);
+//    }
     /**
      *上传素材
      * @param file form-data/file	文件
@@ -207,7 +213,7 @@ public class NumPersonController {
     @PostMapping("/queryCompanySound")
     @ResponseBody
     public Result<Page<NpSound>> queryCompanySound(@RequestBody NpRequestParams npRequestParams) throws Exception {
-        Page<NpSound> companySoundList = npQueryService.queryCompanySound(npRequestParams.getType(), npRequestParams.getPage(), npRequestParams.getSize());
+        Page<NpSound> companySoundList = npQueryService.queryCompanySound(npRequestParams.getType(), npRequestParams.getName(), npRequestParams.getPage(), npRequestParams.getSize());
         return Result.ok(companySoundList);
     }
 

+ 9 - 4
xyzc-start/src/main/java/com/xyzc/start/domain/NpCommitTrain.java

@@ -138,10 +138,15 @@ public class NpCommitTrain extends BaseEntity {
      */
     private String baseUserId;
 
-//    /**
-//     * 原因
-//     */
-//    private String reason;
+    /*
+    默认适配的tts发言人
+     */
+    private String speakerId;
+
+    /**
+     * 删除标记
+     */
+    private String delFlag;
 
 
 }

+ 5 - 0
xyzc-start/src/main/java/com/xyzc/start/domain/NpSound.java

@@ -136,5 +136,10 @@ public class NpSound extends BaseEntity {
      */
     private Integer phonemeFlag;
 
+    /**
+     * 删除标记
+     */
+    private String delFlag;
+
 
 }

+ 10 - 0
xyzc-start/src/main/java/com/xyzc/start/mapper/NpCommitTrainMapper.java

@@ -2,9 +2,19 @@ package com.xyzc.start.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xyzc.start.domain.NpCommitTrain;
+import com.xyzc.start.domain.NpSound;
 import org.springframework.stereotype.Repository;
 
 @Repository
 public interface NpCommitTrainMapper extends BaseMapper<NpCommitTrain> {
+
+
+    /**
+     * 查询公司声音
+     * @return
+     */
+    Page<NpCommitTrain> queryCommitTrain(Long baseUserId, Integer type, String name, Page<NpCommitTrain> page);
+
 }

+ 1 - 1
xyzc-start/src/main/java/com/xyzc/start/mapper/NumPersonMapper.java

@@ -15,7 +15,7 @@ public interface NumPersonMapper extends BaseMapper<NpSound> {
          * 查询公司声音
          * @return
          */
-        Page<NpSound> queryCompanySound(Long baseUserId, Integer type, Page<NpSound> page);
+        Page<NpSound> queryCompanySound(Long baseUserId, Integer type, String name, Page<NpSound> page);
 
         /**
          * 查询公共模特

+ 2 - 0
xyzc-start/src/main/java/com/xyzc/start/request/NpRequestParams.java

@@ -11,6 +11,8 @@ import java.util.List;
 @Validated
 public class NpRequestParams {
 
+    String name;
+
     String rootId;
 
     Integer type;

+ 2 - 2
xyzc-start/src/main/java/com/xyzc/start/service/INpQueryService.java

@@ -14,7 +14,7 @@ public interface INpQueryService {
      */
     public NpCommitTrain queryTrainVideoById(String trainId);
 
-    Page<NpSound> queryCompanySound(Integer type, Integer page, Integer size);
+    Page<NpSound> queryCompanySound(Integer type, String name, Integer page, Integer size);
 
     Page<NpFormwork> getCommonTemplate(Integer type, Integer page, Integer size);
 
@@ -25,7 +25,7 @@ public interface INpQueryService {
      * @return
      */
     List<NpTemplate> queryCommonTemplate(Integer page, Integer size);
-    List<NpCommitTrain> queryTrainingModel(Integer page, Integer size);
+    Page<NpCommitTrain> queryTrainingModel(Integer type, String name, Integer page, Integer size);
 
     NpTemplateDraft getTemplateDraft(String templateId);
 

+ 32 - 18
xyzc-start/src/main/java/com/xyzc/start/service/impl/NpQueryServiceImpl.java

@@ -249,26 +249,28 @@ public class NpQueryServiceImpl implements INpQueryService {
 
 
     @Override
-    public Page<NpSound> queryCompanySound(Integer type, Integer pageNum, Integer size){
+    public Page<NpSound> queryCompanySound(Integer type, String name, Integer pageNum, Integer size){
         if (type == null) {
 
         }
-//        if (page == null || page == 0) {
-//            page = 1;
-//        }
-//        if (size == null || size < 0) {
-//            size = 10;
-//        }
-//        int start = page*size - size;
-//        int end = page*size;
+        if (pageNum == null || pageNum == 0) {
+            pageNum = 1;
+        }
+        if (size == null || size < 0) {
+            size = 10;
+        }
         Page<NpSound> npSoundList = null;
         Page<NpSound> page = new Page<>(pageNum, size);
+        if (!Strings.isBlank(name)) {
+            npSoundList = numPersonMapper.queryCompanySound(SecurityUser.getUserId(), type, name, page);
+            return npSoundList;
+        }
         if (1 == type) {
-            npSoundList = numPersonMapper.queryCompanySound(null, type, page);
+            npSoundList = numPersonMapper.queryCompanySound(null, type, null, page);
         }
         if (2 == type) {
             Long baseUserId = SecurityUser.getUserId();
-            npSoundList = numPersonMapper.queryCompanySound(baseUserId, type, page);
+            npSoundList = numPersonMapper.queryCompanySound(baseUserId, type,null, page);
         }
         return npSoundList;
     }
@@ -336,17 +338,29 @@ public class NpQueryServiceImpl implements INpQueryService {
     }
 
     @Override
-    public List<NpCommitTrain> queryTrainingModel(Integer page, Integer size) {
-        if (page == null || page == 0) {
-            page = 1;
+    public Page<NpCommitTrain> queryTrainingModel(Integer type, String name, Integer pageNum, Integer size) {
+        if (pageNum == null || pageNum == 0) {
+            pageNum = 1;
         }
         if (size == null || size < 0) {
             size = 10;
         }
-        int start = page*size - size;
-        List<NpCommitTrain> npCommitTrains = npCommitTrainMapper.selectList(new QueryWrapper<NpCommitTrain>().eq("base_user_id", SecurityUser.getUserId()).eq("status", "2")
-                .last("limit " + start + "," + size).select("model_id, video_url,title, cover_url, scene_id, robot_json"));
-        return npCommitTrains;
+
+    Page<NpCommitTrain> page = new Page<>(pageNum, size);
+
+    Page<NpCommitTrain> npCommitTrainPage = null;
+    // 根据查询名称
+    if (!Strings.isBlank(name)) {
+        npCommitTrainPage = npCommitTrainMapper.queryCommitTrain(SecurityUser.getUserId(), type, name, page);
+        return npCommitTrainPage;
+    }
+
+    if (type == 1) {
+        npCommitTrainPage = npCommitTrainMapper.queryCommitTrain(null, type, null, page);
+    } else {
+        npCommitTrainPage = npCommitTrainMapper.queryCommitTrain(SecurityUser.getUserId(), type, null, page);
+    }
+    return npCommitTrainPage;
     }
 
 

+ 16 - 0
xyzc-start/src/main/resources/mapper/WebStart/NpCommitTrainMapper.xml

@@ -4,4 +4,20 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xyzc.start.mapper.NpCommitTrainMapper">
 
+    <select id="queryCommitTrain" resultType="com.xyzc.start.domain.NpCommitTrain">
+        SELECT
+            "model_id, video_url,title, cover_url, scene_id, robot_json"
+        FROM xy_np_commit_train
+        <where>
+            <if test="baseUserId != null and baseUserId != ''">
+                AND base_user_id = #{baseUserId}
+            </if>
+            <if test="name != null and name != ''">
+                AND title like concat('%',#{name},'%')
+            </if>
+            <if test="type != null and type != ''">
+                AND type = #{type}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 5 - 2
xyzc-start/src/main/resources/mapper/WebStart/NumPersonMapper.xml

@@ -23,10 +23,13 @@
         FROM xy_np_sound
         <where>
             <if test="baseUserId != null and baseUserId != ''">
-                base_user_id = #{baseUserId} AND
+                AND base_user_id = #{baseUserId}
+            </if>
+            <if test="name != null and name != ''">
+                AND tts_name like concat('%',#{name},'%')
             </if>
             <if test="type != null and type != ''">
-                sound_type = #{type}
+                AND sound_type = #{type}
             </if>
         </where>
     </select>