Pārlūkot izejas kodu

1.专辑问题修改

yuanliang 2 gadi atpakaļ
vecāks
revīzija
57e8ef36e2

+ 56 - 54
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/TenantAlbumController.java

@@ -1,12 +1,15 @@
 package com.yonge.cooleshow.admin.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.yonge.cooleshow.admin.io.request.TenantAlbumVo;
-import com.yonge.cooleshow.api.feign.dto.TenantWrapper;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
-import com.yonge.cooleshow.biz.dal.entity.*;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbum;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumMusic;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumRef;
+import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.TenantAlbumMusicService;
 import com.yonge.cooleshow.biz.dal.service.TenantAlbumRefService;
@@ -21,14 +24,16 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Collection;
+import java.util.Comparator;
 import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -62,70 +67,55 @@ public class TenantAlbumController {
      */
     @PostMapping("/page")
     @ApiOperation(value = "查询分页", notes = "tenantAlbum")
-    //@PreAuthorize("@pcs.hasPermissions('tenantAlbum/page')")
+    @PreAuthorize("@pcs.hasPermissions('tenantAlbum/page')")
     public HttpResponseResult<PageInfo<TenantAlbumWrapper.TenantAlbum>> page(@RequestBody TenantAlbumWrapper.TenantAlbumQuery query) {
-
-
         IPage<TenantAlbumWrapper.TenantAlbum> pages = tenantAlbumService.selectPage(QueryInfo.getPage(query), query);
         return HttpResponseResult.succeed(PageUtil.pageInfo(pages));
     }
 
 
-
     /**
      * 查询详情
-     * @param query 详情ID
+     *
+     * @param id 详情ID
      * @return TenantAlbum
      */
     @PostMapping("/detail")
     @ApiOperation(value = "查询详情", notes = "detail")
-    //@PreAuthorize("@pcs.hasPermissions('tenantAlbum/detail')")
-    public HttpResponseResult<TenantAlbumVo.TenantAlbum> detail(@RequestBody TenantAlbumVo.TenantAlbum query) {
+    @PreAuthorize("@pcs.hasPermissions('tenantAlbum/detail')")
+    public HttpResponseResult<TenantAlbumWrapper.TenantAlbum> detail(@RequestParam("id") Long id) {
+        TenantAlbum tenantAlbum = tenantAlbumService.detail(id);
+        if (tenantAlbum == null) {
+            throw new BizException("专辑信息不存在");
+        }
+
+        TenantAlbumWrapper.TenantAlbum vo = JSON.parseObject(JSON.toJSONString(tenantAlbum),
+                TenantAlbumWrapper.TenantAlbum.class);
 
-        TenantAlbumVo.TenantAlbum vo = new TenantAlbumVo.TenantAlbum();
-        Long id = query.getId();
-        TenantAlbum tenantAlbum= tenantAlbumService.detail(id);
         //查关联表
-        TenantAlbumRef ref = tenantAlbumRefService.getBytenantAlbumId(id);
-        vo.setTenantId(ref.getTenantId());
-        //查询机构专辑表
-        vo.setName(tenantAlbum.getName());
-        vo.setDescribe(tenantAlbum.getDescribe());
-        vo.setCoverImg(tenantAlbum.getCoverImg());
-        vo.setPurchaseCycle(tenantAlbum.getPurchaseCycle());
-        vo.setSalePrice(tenantAlbum.getSalePrice());
+        TenantAlbumRef one = tenantAlbumRefService.lambdaQuery().eq(TenantAlbumRef::getTenantAlbumId, id)
+                .last("limit").one();
+        vo.setTenantId(one.getTenantId());
         //查询曲目表
 
-        List<TenantAlbumVo.MusicSheetData> data = query.getMusicSheetData();
-
-        List<TenantAlbumMusic> tenantAlbumMusics = query.getMusicSheetData().stream().map(next -> {
+        List<TenantAlbumMusic> tenantAlbumMusics = tenantAlbumMusicService.lambdaQuery()
+                .eq(TenantAlbumMusic::getTenantAlbumId, id)
+                .eq(TenantAlbumMusic::getDelFlag, false)
+                .list();
 
-            AtomicInteger sort = new AtomicInteger(0);
-            return next.getMusicSheetIdList().stream().map(tenantAlbumMusic -> {
+        Map<SubjectTypeEnum, List<TenantAlbumMusic>> groupByType =
+                tenantAlbumMusics.stream().collect(Collectors.groupingBy(TenantAlbumMusic::getSubjectType));
 
-                TenantAlbumMusic tenantAlbumMusic1 = new TenantAlbumMusic();
-                //tenantAlbumMusic1.setId(tenantAlbumMusic);
-                tenantAlbumMusic1.setSubjectType(next.getSubjectType());
-                tenantAlbumMusic1.setTenantId(query.getTenantId());
-                tenantAlbumMusic1.setMusicSheetId(tenantAlbumMusic);
-                tenantAlbumMusic1.setDelFlag(true);
-                tenantAlbumMusic1.setTenantAlbumId(tenantAlbum.getId());
-                tenantAlbumMusic1.setSortNumber(sort.getAndIncrement());
-                return tenantAlbumMusic1;
-            }).collect(Collectors.toList());
+        List<TenantAlbumWrapper.MusicSheetData> musicSheetData = vo.getMusicSheetData();
+        groupByType.forEach((key, value) -> {
+            value.sort(Comparator.comparing(TenantAlbumMusic::getSortNumber));
+            TenantAlbumWrapper.MusicSheetData sheetData = new TenantAlbumWrapper.MusicSheetData();
+            sheetData.setSubjectType(key);
+            sheetData.setMusicSheetList(value);
+            musicSheetData.add(sheetData);
 
-        }).flatMap(Collection::stream).collect(Collectors.toList());
+        });
 
-
-        vo.setTenantAlbumMusics(tenantAlbumMusics);
-
-/*        List<TenantAlbumVo.MusicSheetData> dataList = query.getMusicSheetData();
-        TenantAlbumVo.MusicSheetData data = dataList.get(0);
-        List<Long> list = data.getMusicSheetIdList();
-        data.getSubjectType();
-        Long musicId = list.get(0);
-
-        tenantAlbumMusicService.detail(musicId);*/
         return HttpResponseResult.succeed(vo);
     }
 
@@ -133,13 +123,25 @@ public class TenantAlbumController {
     /**
      * 新增专辑
      */
-    @PostMapping("/insert")
+    @PostMapping("/save")
     @ApiOperation(value = "新增专辑", notes = "新增专辑")
-    //@PreAuthorize("@pcs.hasPermissions('tenantAlbum/insert')")
-    public HttpResponseResult<Boolean> insertTenantAlbum( @RequestBody TenantAlbumWrapper.TenantAlbumVo album) {
-
-
-        return HttpResponseResult.succeed(tenantAlbumService.insertTenantAlbum(album));
+    @PreAuthorize("@pcs.hasPermissions('tenantAlbum/save')")
+    public HttpResponseResult<Boolean> save(@Validated @RequestBody TenantAlbumVo.TenantAlbum album) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        TenantInfo tenantInfo = tenantInfoService.lambdaQuery().eq(TenantInfo::getUserId, sysUser.getId())
+                .last("limit 1").one();
+        if (tenantInfo == null) {
+            throw new BizException("非法请求");
+        }
+
+        TenantAlbum tenantAlbum = JSON.parseObject(album.jsonString(), TenantAlbum.class);
+        List<TenantAlbumVo.MusicSheetData> musicSheetData = album.getMusicSheetData();
+
+        List<TenantAlbumWrapper.MusicSheetData> musicSheetDataList = musicSheetData.stream().map(next ->
+                        JSON.parseObject(JSON.toJSONString(next), TenantAlbumWrapper.MusicSheetData.class))
+                .collect(Collectors.toList());
+        tenantAlbumService.insertTenantAlbum(tenantInfo.getId(), tenantAlbum, musicSheetDataList);
+        return HttpResponseResult.succeed();
     }
 
 

+ 15 - 37
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/io/request/TenantAlbumVo.java

@@ -1,7 +1,9 @@
 package com.yonge.cooleshow.admin.io.request;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.TenantAlbumMusic;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import io.swagger.annotations.ApiModel;
@@ -17,6 +19,8 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * 机构专辑
  * 2023-07-28 10:17:46
@@ -28,7 +32,6 @@ import lombok.NoArgsConstructor;
 public class TenantAlbumVo {
 
 
-
     @Data
     @Builder
     @NoArgsConstructor
@@ -36,68 +39,39 @@ public class TenantAlbumVo {
     @ApiModel(" TenantAlbum-机构专辑")
     public static class TenantAlbum {
 
-
         @ApiModelProperty("主键ID")
         private Long id;
 
         @ApiModelProperty("机构ID")
         private Long tenantId;
 
+        @ApiModelProperty("机构名称")
+        private Long tenantName;
 
         @ApiModelProperty("专辑名称")
         private String name;
 
-
         @ApiModelProperty("专辑介绍")
         private String describe;
 
-
         @ApiModelProperty("专辑封面")
         private String coverImg;
 
-
-        @ApiModelProperty("曲目数")
-        private Integer musicNum;
-
-
         @ApiModelProperty("平台价格")
         private BigDecimal originalPrice;
 
-
         @ApiModelProperty("机构价格")
         private BigDecimal salePrice;
 
-
         @ApiModelProperty("购买周期")
         private Integer purchaseCycle;
 
-
-        @ApiModelProperty("曲目声部分类(多个,分隔)")
-        private String subjectTypes;
-
-
-        @ApiModelProperty("启用状态")
-        private Boolean status;
-
-
-        @ApiModelProperty("删除标识")
-        private Boolean delFlag;
-
-
-        @ApiModelProperty("更新时间")
-        private Date updateTime;
-
-
-        @ApiModelProperty("创建时间")
-        private Date createTime;
+        @ApiModelProperty("原价")
+        private BigDecimal costPrice;
 
         @ApiModelProperty("曲目相关信息")
         private List<MusicSheetData> musicSheetData = new ArrayList<>();
 
-
-        private List<TenantAlbumMusic> tenantAlbumMusics = new ArrayList<>();
-
-
         public String jsonString() {
             return JSON.toJSONString(this);
         }
@@ -107,16 +81,20 @@ public class TenantAlbumVo {
         }
     }
 
+    @ApiModel("声部模型")
     @Data
-    public static class MusicSheetData{
+    public static class MusicSheetData {
+
+        @ApiModelProperty("声部类型")
+        @NotNull
         private SubjectTypeEnum subjectType;
 
+        @ApiModelProperty("声部id列表")
         private List<Long> musicSheetIdList = new ArrayList<>();
-
     }
 
     @Data
-    public static class tenantAlbumMusics{
+    public static class tenantAlbumMusics {
         private Long id;
         private Long tenantId;
         private SubjectTypeEnum subjectType;

+ 0 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TenantAlbum.java

@@ -47,7 +47,6 @@ public class TenantAlbum implements Serializable {
     @TableField(value = "cost_price_")
     private BigDecimal costPrice;
 
-
     @ApiModelProperty("平台价格") 
 	@TableField(value = "original_price_")
     private BigDecimal originalPrice;

+ 4 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TenantAlbumService.java

@@ -7,6 +7,8 @@ import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
 import com.yonge.cooleshow.biz.dal.entity.TenantAlbum;
 import com.yonge.cooleshow.biz.dal.wrapper.UserPaymentOrderWrapper;
 
+import java.util.List;
+
 /**
  * 机构专辑
  * 2023-07-21 17:32:49
@@ -56,7 +58,8 @@ public interface TenantAlbumService extends IService<TenantAlbum>  {
      */
     void orderSuccess(UserOrderDetailVo userOrderDetailVo);
 
-    Boolean insertTenantAlbum(TenantAlbumWrapper.TenantAlbumVo album);
+    void insertTenantAlbum(Long tenantId,TenantAlbum tenantAlbum,
+                           List<TenantAlbumWrapper.MusicSheetData> musicSheetDataList);
 
 
     /**

+ 37 - 50
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantAlbumServiceImpl.java

@@ -58,29 +58,32 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
 
     /**
      * 查询详情
+     *
      * @param id 详情ID
      * @return TenantAlbum
      */
     @Override
     public TenantAlbum detail(Long id) {
-        
+
         return baseMapper.selectById(id);
     }
-    
+
     /**
      * 分页查询
-     * @param page IPage<TenantAlbum>
+     *
+     * @param page  IPage<TenantAlbum>
      * @param query TenantAlbumWrapper.TenantAlbumQuery
      * @return IPage<TenantAlbum>
      */
     @Override
-    public IPage<TenantAlbumWrapper.TenantAlbum> selectPage(IPage<TenantAlbumWrapper.TenantAlbum> page, TenantAlbumWrapper.TenantAlbumQuery query) {
-        List<TenantAlbumWrapper.TenantAlbum> albums = baseMapper.selectPage(page, query);
-        return page.setRecords(albums);
+    public IPage<TenantAlbumWrapper.TenantAlbum> selectPage(IPage<TenantAlbumWrapper.TenantAlbum> page,
+                                                            TenantAlbumWrapper.TenantAlbumQuery query) {
+        return page.setRecords(baseMapper.selectPage(page, query));
     }
 
     /**
      * 添加
+     *
      * @param tenantAlbum TenantAlbumWrapper.TenantAlbum
      * @return Boolean
      */
@@ -93,13 +96,14 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
 
     /**
      * 更新
+     *
      * @param tenantAlbum TenantAlbumWrapper.TenantAlbum
      * @return Boolean
      */
     @Override
-    public Boolean update(TenantAlbumWrapper.TenantAlbum tenantAlbum){
+    public Boolean update(TenantAlbumWrapper.TenantAlbum tenantAlbum) {
 
-        return this.updateById(JSON.parseObject(tenantAlbum.jsonString(), TenantAlbum.class));       
+        return this.updateById(JSON.parseObject(tenantAlbum.jsonString(), TenantAlbum.class));
     }
 
     /**
@@ -116,7 +120,8 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
         }
 
         TenantAlbumWrapper.TenantAlbumBuy tenantAlbumBuy = JSON
-                .parseObject(JSON.toJSONString(orderGoodsInfo.getBizContent()), TenantAlbumWrapper.TenantAlbumBuy.class);
+                .parseObject(JSON.toJSONString(orderGoodsInfo.getBizContent()),
+                        TenantAlbumWrapper.TenantAlbumBuy.class);
         if (tenantAlbumBuy == null) {
             log.error("订单创建前检测,订单商品信息为空");
             throw new BizException("订单商品信息为空");
@@ -156,7 +161,8 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
                 }
                 TenantInfo tenantInfo = tenantInfoService.detail(student.getTenantId());
                 if (tenantInfo == null || !tenantIdList.contains(tenantInfo.getId())) {
-                    log.error("订单创建前检测,学生不在当前机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(), student.getTenantId());
+                    log.error("订单创建前检测,学生不在当前机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(),
+                            student.getTenantId());
                     throw new BizException("用户不在当前机构");
                 }
                 price = tenantAlbum.getSalePrice();
@@ -174,7 +180,8 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
                     throw new BizException("用户信息未找到");
                 }
                 if (!tenantIdList.contains(tenantStaff.getTenantId())) {
-                    log.error("订单创建前检测,专辑不在机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(), tenantStaff.getTenantId());
+                    log.error("订单创建前检测,专辑不在机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(),
+                            tenantStaff.getTenantId());
                     throw new BizException("用户不在当前机构");
                 }
                 price = tenantAlbum.getOriginalPrice();
@@ -184,7 +191,6 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
         }
 
 
-
         userOrderDetail.setGoodUrl(userOrderService.getGoodUrlByType(orderGoodsInfo.getGoodType()));
         userOrderDetail.setBizId(tenantAlbum.getId());
         userOrderDetail.setGoodNum(orderGoodsInfo.getGoodNum());
@@ -214,62 +220,43 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
 
     }
 
-    /**
-     * 新增机构专辑
-     * @param album
-     * @return
-     */
-    @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean insertTenantAlbum(TenantAlbumWrapper.TenantAlbumVo album) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        TenantInfo tenantInfo = tenantInfoService.lambdaQuery().eq(TenantInfo::getUserId, sysUser.getId())
-                .last("limit 1").one();
-        if (tenantInfo == null) {
-            throw new BizException("非法请求");
-        }
+    @Override
+    public void insertTenantAlbum(Long tenantId, TenantAlbum tenantAlbum,
+                                  List<TenantAlbumWrapper.MusicSheetData> musicSheetDataList) {
 
+        List<String> subjectTypeNames = musicSheetDataList.stream().map(next -> next.getSubjectType().name())
+                .distinct().collect(Collectors.toList());
+        tenantAlbum.setSubjectTypes(String.join(",", subjectTypeNames));
         //给机构专辑赋值
-        TenantAlbum tenantAlbum = new TenantAlbum();
-        tenantAlbum.setName(album.getName());
-        tenantAlbum.setDescribe(album.getDescribe());
-        tenantAlbum.setCoverImg(album.getCoverImg());
-        tenantAlbum.setPurchaseCycle(album.getPurchaseCycle());
-        tenantAlbum.setSalePrice(album.getSalePrice());
-
-        add(tenantAlbum);
+        tenantAlbum.setStatus(true);
+        tenantAlbum.setDelFlag(false);
+        this.add(tenantAlbum);
+
         //关联表赋值
         TenantAlbumRef ref = new TenantAlbumRef();
         ref.setTenantAlbumId(tenantAlbum.getId());
-        ref.setTenantId(album.getTenantId());
+        ref.setTenantId(tenantId);
         tenantAlbumRefService.add(ref);
-        //曲目表赋值
-        List<TenantAlbumWrapper.TenantAlbumVo.MusicSheetData> data = album.getMusicSheetData();
-
-        List<TenantAlbumMusic> tenantAlbumMusics = album.getMusicSheetData().stream().map(next -> {
 
-            AtomicInteger sort = new AtomicInteger(0);
+        //曲目表赋值
+        List<TenantAlbumMusic> tenantAlbumMusics = musicSheetDataList.stream().map(next -> {
+            AtomicInteger sort = new AtomicInteger(1);
             return next.getMusicSheetIdList().stream().map(tenantAlbumMusic -> {
-
                 TenantAlbumMusic tenantAlbumMusic1 = new TenantAlbumMusic();
                 //tenantAlbumMusic1.setId(tenantAlbumMusic);
+                tenantAlbumMusic1.setTenantId(tenantId);
                 tenantAlbumMusic1.setSubjectType(next.getSubjectType());
-                tenantAlbumMusic1.setTenantId(album.getTenantId());
-                tenantAlbumMusic1.setMusicSheetId(tenantAlbumMusic);
-                tenantAlbumMusic1.setDelFlag(true);
                 tenantAlbumMusic1.setTenantAlbumId(tenantAlbum.getId());
+                tenantAlbumMusic1.setMusicSheetId(tenantAlbumMusic);
                 tenantAlbumMusic1.setSortNumber(sort.getAndIncrement());
+                tenantAlbumMusic1.setDelFlag(false);
                 return tenantAlbumMusic1;
             }).collect(Collectors.toList());
-
         }).flatMap(Collection::stream).collect(Collectors.toList());
 
-        if(!tenantAlbumMusics.isEmpty()){
-            tenantAlbumMusicService.saveBatch(tenantAlbumMusics,100);
+        if (!tenantAlbumMusics.isEmpty()) {
+            tenantAlbumMusicService.saveBatch(tenantAlbumMusics, 100);
         }
-
-        return true;
     }
-
-
 }

+ 11 - 21
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumWrapper.java

@@ -3,6 +3,8 @@ package com.yonge.cooleshow.biz.dal.wrapper;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumMusic;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -35,10 +37,6 @@ public class TenantAlbumWrapper {
     @ApiModel(" TenantAlbumQuery-机构专辑")
     public static class TenantAlbumQuery implements QueryInfo {
 
-
-        @ApiModelProperty("主键ID")
-        private Long id;
-
         @ApiModelProperty("当前页")
         private Integer page;
 
@@ -54,9 +52,6 @@ public class TenantAlbumWrapper {
         @ApiModelProperty("专辑名称")
         private String name;
 
-        @ApiModelProperty("机构名称")
-        private String tenantName;
-
         public String getKeyword() {
             return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
         }
@@ -135,14 +130,6 @@ public class TenantAlbumWrapper {
         public static TenantAlbum from(String json) {
             return JSON.parseObject(json, TenantAlbum.class);
         }
-
-        @Data
-        public static class MusicSheetData {
-            private SubjectTypeEnum subjectType;
-
-            private List<Long> musicSheetIdList = new ArrayList<>();
-        }
-
     }
 
     @Data
@@ -237,13 +224,16 @@ public class TenantAlbumWrapper {
         @ApiModelProperty("购买周期")
         private Integer purchaseCycle;
 
+    }
+
+    @Data
+    public static class MusicSheetData {
 
-        @Data
-        public static class MusicSheetData {
-            private SubjectTypeEnum subjectType;
+        private SubjectTypeEnum subjectType;
 
-            private List<Long> musicSheetIdList = new ArrayList<>();
-        }
-    }
+        private List<Long> musicSheetIdList = new ArrayList<>();
 
+        @ApiModelProperty("声部列表")
+        private List<TenantAlbumMusic> musicSheetList = new ArrayList<>();
+    }
 }

+ 16 - 19
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantAlbumMapper.xml

@@ -1,12 +1,9 @@
 <?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="com.yonge.cooleshow.biz.dal.mapper.TenantAlbumMapper">
-
-	 
-    
     <!-- 表字段 -->
     <sql id="baseColumns">
-         t.id_ AS id
+        t.id_ AS id
         , t.name_ AS `name`
         , t.describe_ AS `describe`
         , t.cover_img_ AS coverImg
@@ -20,22 +17,22 @@
         , t.update_time_ AS updateTime
         , t.create_time_ AS createTime
         , t.cost_price_ AS costPrice
-        </sql> 
-    
+    </sql>
+
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper$TenantAlbum">
-		SELECT         
-        	<include refid="baseColumns" />
+        SELECT
+        <include refid="baseColumns"/>
         , i.name_ AS tenantName
-		FROM tenant_album t
-        LEFT JOIN tenant_album_ref r on  t.id_ = r.tenant_album_id_
+        FROM tenant_album t
+        LEFT JOIN tenant_album_ref r on t.id_ = r.tenant_album_id_
         left join tenant_info i on r.tenant_id_ = i.id_
-        where 1=1
-        <if test="param.name != null and param.name != ''">
-            and t.name_ = #{param.name}
-        </if>
-        <if test="param.tenantId != null ">
-            and i.id_= #{param.tenantId}
-        </if>
-	</select>
-    
+        <where>
+            <if test="param.name != null and param.name != ''">
+                and t.name_ = #{param.name}
+            </if>
+            <if test="param.tenantId != null ">
+                and i.id_= #{param.tenantId}
+            </if>
+        </where>
+    </select>
 </mapper>