Selaa lähdekoodia

酷乐秀曲目来源改为内容平台

zouxuan 1 vuosi sitten
vanhempi
commit
b9519931c1

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SubjectServiceImpl.java

@@ -347,7 +347,12 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
             // 设置声部下的乐器信息
             List<Integer> subjectIds = dataList.stream().map(SubjectWrapper.Subject::getId).distinct().collect(Collectors.toList());
             Map<Integer, List<InstrumentWrapper.Instrument>> groupBySubjectId = instrumentService.getGroupBySubjectId(subjectIds, query.getEnableFlag());
+            Map<Long, Subject> map = this.findBySubjectByIdList(dataList.stream().map(SubjectWrapper.Subject::getParentSubjectId).collect(Collectors.toList())).stream()
+                    .collect(Collectors.toMap(Subject::getId, t -> t));
             dataList.forEach(e -> {
+                if(e.getParentSubjectId() != null && e.getParentSubjectId() > 0) {
+                    e.setParentSubjectName(map.get(e.getParentSubjectId()).getName());
+                }
                 List<InstrumentWrapper.Instrument> instruments = groupBySubjectId.get(e.getId());
                 if (org.apache.commons.collections.CollectionUtils.isNotEmpty(instruments)) {
                     e.setInstruments(instruments);

+ 4 - 8
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/SubjectWrapper.java

@@ -71,8 +71,10 @@ public class SubjectWrapper {
         @ApiModelProperty("编码")
         private String code;
 
-        @ApiModelProperty("父级声部ID")
-        private Long parentId;
+        @ApiModelProperty(value = "父级编号",required = false)
+        private Long parentSubjectId;
+
+        private String parentSubjectName;
 
         @ApiModelProperty("封面")
         private String img;
@@ -92,12 +94,6 @@ public class SubjectWrapper {
         @ApiModelProperty("音频")
         private String media;
 
-        @ApiModelProperty("更新人")
-        private Long operator;
-
-        @ApiModelProperty("更新人")
-        private String operatorName;
-
         @ApiModelProperty("更新时间")
         private Date updateTime;
 

+ 3 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -241,6 +241,7 @@
         FROM subject t
         LEFT JOIN instrument i on t.id_ = i.subject_id_
         <where>
+            t.parent_subject_id_ != 0
             <if test="param.delFlag != null">
                 AND t.del_flag_ = #{param.delFlag}
             </if>
@@ -271,7 +272,7 @@
         t.id_ as id
         , t.name_ as name
         , t.code_ as code
-        , t.parent_subject_id_ as parentId
+        , t.parent_subject_id_ as parentSubjectId
         , t.img_ as img
         , t.del_flag_ as delFlag
         , t.update_time_ as updateTime
@@ -281,7 +282,6 @@
         ,t.enable_flag_ as enableFlag
         ,t.logo_ as logo
         ,t.media_ as media
-        ,t.operator_ as operator
         ,t.cbs_subject_id_ as cbsSubjectId
     </sql>
     <select id="findPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.SubjectWrapper$Subject">
@@ -290,6 +290,7 @@
         FROM subject t
         LEFT JOIN instrument i on t.id_ = i.subject_id_
         <where>
+            t.parent_subject_id_ != 0
             <if test="param.delFlag != null">
                 AND t.del_flag_ = #{param.delFlag}
             </if>