소스 검색

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

zouxuan 1 년 전
부모
커밋
d4cc834c7e

+ 2 - 11
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetController.java

@@ -53,17 +53,8 @@ public class MusicSheetController extends BaseController {
     @ApiOperation(value = "分页查询", httpMethod="POST", consumes="application/json", produces="application/json")
     @PostMapping(value="/list", consumes="application/json", produces="application/json")
     @PreAuthorize("@pcs.hasPermissions('music/sheet/list')")
-    public HttpResponseResult<PageInfo<MusicSheetVo>> list(@RequestBody MusicSheetSearch query) {
-        PageInfo<MusicSheetVo> info = PageUtil.pageInfo(musicSheetService.selectCbsPage(PageUtil.getPage(query), query));
-        List<MusicSheetVo> rows = info.getRows();
-        List<MusicSheetVoResult> musicSheetVoResults = new ArrayList<>();
-        for (MusicSheetVo row : rows) {
-            MusicSheetVoResult musicSheetVoResult = JSON.parseObject(JSON.toJSONString(row), MusicSheetVoResult.class);
-            musicSheetVoResult.setCbsMusicSheetId(row.getCbsMusicSheetId().toString());
-            musicSheetVoResults.add(musicSheetVoResult);
-        }
-        com.yonge.cooleshow.biz.dal.dto.PageUtil.transPageInfo(info, musicSheetVoResults);
-        return succeed(info);
+    public HttpResponseResult<PageInfo<MusicSheetVoResult>> list(@RequestBody MusicSheetSearch query) {
+        return succeed(PageUtil.pageInfo(musicSheetService.selectCbsPage(PageUtil.getPage(query), query)));
     }
 
     @ApiOperation(value = "修改应用扩展信息")

+ 20 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/PageUtil.java

@@ -1,6 +1,8 @@
 package com.yonge.cooleshow.biz.dal.dto;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.yonge.toolset.base.page.PageInfo;
 
 import java.util.List;
@@ -54,15 +56,29 @@ public class PageUtil {
         return resultPage;
     }
 
-    public static <T,E> com.microsvc.toolkit.common.response.paging.PageInfo<T> transPageInfo(PageInfo<E> source, List<T> rows) {
+    public static <T,E> IPage<T> transPageInfo(IPage<E> source, List<T> rows) {
         if (Objects.isNull(source)) {
-            return new com.microsvc.toolkit.common.response.paging.PageInfo<>();
+            return new Page<>();
+        }
+        int total = Integer.parseInt(String.valueOf(source.getTotal()));
+        int limit = Integer.parseInt(String.valueOf(source.getSize()));
+        IPage<T> resultPage = new Page<>();
+        resultPage.setRecords(rows);
+        resultPage.setCurrent(Long.valueOf(source.getCurrent()).intValue());
+        resultPage.setSize(limit);
+        resultPage.setTotal(total);
+        return resultPage;
+    }
+
+    public static <T,E> PageInfo<T> transPageInfo(PageInfo<E> source, List<T> rows) {
+        if (Objects.isNull(source)) {
+            return new PageInfo<>();
         }
         int total = Integer.parseInt(String.valueOf(source.getTotal()));
         int limit = Integer.parseInt(String.valueOf(source.getLimit()));
-        com.microsvc.toolkit.common.response.paging.PageInfo<T> resultPage = new com.microsvc.toolkit.common.response.paging.PageInfo<>();
+        PageInfo<T> resultPage = new PageInfo<>();
         resultPage.setRows(rows);
-        resultPage.setCurrent(Long.valueOf(source.getPageNo()).intValue());
+        resultPage.setPageNo(Long.valueOf(source.getPageNo()).intValue());
         resultPage.setLimit(limit);
         resultPage.setTotal(total);
         return resultPage;

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

@@ -42,7 +42,7 @@ public interface MusicSheetService extends IService<MusicSheet> {
      */
     IPage<MusicSheetVo> selectPage(IPage<MusicSheetVo> page, MusicSheetSearch query);
 
-    IPage<MusicSheetVo> selectCbsPage(IPage<MusicSheetVo> page, MusicSheetSearch query);
+    IPage<MusicSheetVoResult> selectCbsPage(IPage<MusicSheetVo> page, MusicSheetSearch query);
     
     IPage<MusicSheetVo> queryRelatedList(IPage<MusicSheetVo> page, Long albumId, Long musicSheetId);
 

+ 10 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -199,9 +199,17 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     }
 
     @Override
-    public IPage<MusicSheetVo> selectCbsPage(IPage<MusicSheetVo> page, MusicSheetSearch query) {
+    public IPage<MusicSheetVoResult> selectCbsPage(IPage<MusicSheetVo> page, MusicSheetSearch query) {
         List<MusicSheetVo> musicSheets = baseMapper.selectPage(page, query);
-        return page.setRecords(musicDataFormat(musicSheets));
+        IPage<MusicSheetVo> info = page.setRecords(musicDataFormat(musicSheets));
+        List<MusicSheetVo> rows = info.getRecords();
+        List<MusicSheetVoResult> musicSheetVoResults = new ArrayList<>();
+        for (MusicSheetVo row : rows) {
+            MusicSheetVoResult musicSheetVoResult = JSON.parseObject(JSON.toJSONString(row), MusicSheetVoResult.class);
+            musicSheetVoResult.setCbsMusicSheetId(row.getCbsMusicSheetId().toString());
+            musicSheetVoResults.add(musicSheetVoResult);
+        }
+        return com.yonge.cooleshow.biz.dal.dto.PageUtil.transPageInfo(info, musicSheetVoResults);
     }
 
     public List<MusicSheetVo> musicDataFormat(List<MusicSheetVo> musicSheets) {

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

@@ -37,7 +37,7 @@
                 <if test="type == null or type =='MUSIC'">
                     union all
                     (select a.music_subject_ as subject_id_ from music_sheet a
-                    where a.del_flag_ = 0 and a.state_ = 1 a.cbs_music_sheet_id_ IS NOT NULL
+                    where a.del_flag_ = 0 and a.state_ = 1 AND a.cbs_music_sheet_id_ IS NOT NULL
                     GROUP BY a.music_subject_)
                 </if>
                 <if test="type == null or type =='ALBUM'">