Merge remote-tracking branch 'origin/main'

main
wangqing 10 months ago
commit 651d28fa55

@ -6,6 +6,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@ -2,10 +2,10 @@ package com.luoo.music.controller;
import api.PageResult;
import api.Result;
import com.luoo.music.request.cms.ColumnAddModel;
import com.luoo.music.request.cms.ColumnQueryModel;
import com.luoo.music.response.cms.ColumnVO;
import com.luoo.music.service.CMSColumnService;
import com.luoo.music.request.cms.JournalAddModel;
import com.luoo.music.request.cms.JournalQueryModel;
import com.luoo.music.response.cms.JournalVO;
import com.luoo.music.service.CMSJournalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -19,39 +19,39 @@ import org.springframework.web.multipart.MultipartFile;
@RestController
@CrossOrigin
@Api(tags = "雀跃期刊后台CMS APIs")
@RequestMapping("/cms/column")
public class CMSColumnController {
@RequestMapping("/cms/journal")
public class CMSJournalController {
@Autowired
private CMSColumnService columnService;
private CMSJournalService journalService;
@ApiOperation(value = "查询期刊列表", notes = "查询期刊列表")
@RequestMapping(value="/search/{page}/{size}", method= RequestMethod.POST)
public Result<PageResult> search(@ApiParam(value = "查询条件", required = true) @RequestBody ColumnQueryModel queryModel,
public Result<PageResult<JournalVO>> search(@ApiParam(value = "查询条件对象", required = true) @RequestBody JournalQueryModel queryModel,
@ApiParam(value = "页码", required = true) @PathVariable int page,
@ApiParam(value = "每页条数", required = true) @PathVariable int size){
return columnService.search(queryModel, page, size);
return journalService.search(queryModel, page, size);
}
@ApiOperation(value = "新增期刊", notes = "新增期刊")
@RequestMapping(value = "/add", method = RequestMethod.POST)
public Result add(@ApiParam(value = "期刊信息", required = true) @RequestBody ColumnAddModel addModel,
public Result add(@ApiParam(value = "期刊信息", required = true) @RequestBody JournalAddModel addModel,
@ApiParam(value = "封面文件", required = true) @RequestParam("imageFile") MultipartFile imageFile){
return columnService.add(addModel, imageFile);
return journalService.add(addModel, imageFile);
}
@ApiOperation(value = "查询期刊详情", notes = "查询期刊详情")
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result<ColumnVO> findOne(@ApiParam(value = "期刊ID", required = true) @PathVariable String id){
return columnService.findOne(id);
public Result<JournalVO> findOne(@ApiParam(value = "期刊ID", required = true) @PathVariable String id){
return journalService.findOne(id);
}
@ApiOperation(value = "更新期刊", notes = "更新期刊")
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public Result update(@ApiParam(value = "期刊ID", required = true) @PathVariable String id,
@ApiParam(value = "期刊信息", required = true) @RequestBody ColumnAddModel updateModel,
@ApiParam(value = "期刊信息", required = true) @RequestBody JournalAddModel updateModel,
@ApiParam(value = "封面文件", required = true) @RequestParam("imageFile") MultipartFile imageFile){
return columnService.update(id, updateModel, imageFile);
return journalService.update(id, updateModel, imageFile);
}
@ApiOperation(value = "发布期刊", notes = "发布期刊")
@ -59,19 +59,19 @@ public class CMSColumnController {
public Result publish(@PathVariable String id,
@ApiParam(value = "是否定时发布0:否1:是", required = true) @RequestParam("state") String scheduled,
@ApiParam(value = "定时发布时间") @RequestParam("state") String pubTime){
return columnService.publish(id, scheduled, pubTime);
return journalService.publish(id, scheduled, pubTime);
}
@ApiOperation(value = "更新期刊启停状态", notes = "更新期刊启停状态")
@RequestMapping(value="/update/state/{id}",method= RequestMethod.PUT)
public Result updateColumnState(@ApiParam(value = "期刊ID", required = true) @PathVariable String id,
@ApiParam(value = "期刊启停状态0:停用1:启用", required = true) @RequestParam("state") String state){
return columnService.updateColumnState(id, state);
return journalService.updateJournalState(id, state);
}
@ApiOperation(value = "删除单条期刊", notes = "删除单条期刊")
@RequestMapping(value="/{id}", method= RequestMethod.DELETE)
public Result delete(@ApiParam(value = "期刊ID", required = true) @PathVariable String id){
return columnService.deleteById(id);
return journalService.deleteById(id);
}
}

@ -1,8 +1,10 @@
package com.luoo.music.controller;
import api.PageResult;
import api.Result;
import com.luoo.music.request.cms.SongAddModel;
import com.luoo.music.request.cms.SongQueryModel;
import com.luoo.music.response.cms.SongVO;
import com.luoo.music.service.CMSSongService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +27,7 @@ public class CMSSongController {
@ApiOperation(value = "查询曲目列表", notes = "查询曲目列表")
@RequestMapping(value="/search/{page}/{size}",method= RequestMethod.POST)
public Result search(@ApiParam(value = "查询条件") @RequestBody SongQueryModel queryModel,
public Result<PageResult<SongVO>> search(@ApiParam(value = "查询条件") @RequestBody SongQueryModel queryModel,
@ApiParam(value = "页码", required = true) @PathVariable int page,
@ApiParam(value = "每页条数", required = true)@PathVariable int size){
return songService.search(queryModel, page, size);
@ -41,7 +43,7 @@ public class CMSSongController {
@ApiOperation(value = "查询歌曲详情", notes = "查询歌曲详情")
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findOne(@ApiParam(value = "歌曲ID", required = true) @PathVariable String id){
public Result<SongVO> findOne(@ApiParam(value = "歌曲ID", required = true) @PathVariable String id){
return songService.findOne(id);
}

@ -1,35 +0,0 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.CMSSong;
import com.luoo.music.pojo.Song;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Set;
/**
* @author locust
*/
public interface CMSSongDao extends JpaRepository<CMSSong,String>, JpaSpecificationExecutor<CMSSong> {
// public List<Song> findSongsByVolid(String volid);
@Modifying
@Query("UPDATE CMSSong s SET s.state = :state WHERE s.id = :id")
int updateSongState(@Param("id") String id, @Param("state") String state);
@Modifying
@Query("UPDATE CMSSong s SET s.lyric = :lyric WHERE s.id = :id")
int updateSongLyric(@Param("id") String id, @Param("lyric") String lyric);
List<CMSSong> findByIdIn(Set<String> ids);
/*@Modifying
@Query("UPDATE Song s SET s.name = :#{#song.name}, s.artist = :#{#song.artist}, s.album = :#{#song.album}, s.picture = :#{#song.picture}, s.url = :#{#song.url}, s.size = :#{#song.size}, s.duration = :#{#song.duration}, s.updatetime = :#{#song.updatetime} WHERE s.id = :#{#song.id}")
int updateSong(@Param("song") Song song);*/
}

@ -1,54 +0,0 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.Column;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* @author locust
*/
public interface ColumnDao extends JpaRepository<Column,String>,JpaSpecificationExecutor<Column>{
List<Column> findByIdIn(Set<String> ids);
@Modifying
@Query("UPDATE Column c SET c.state = '1', c.pubTime = :pubTime WHERE c.id = :id")
int updatePubById(@Param("id") String id,
@Param("pubTime") LocalDateTime pubTime);
@Modifying
@Query("UPDATE Column c SET c.scheduled = :scheduled, c.pubTime = :pubTime WHERE c.id = :id")
int updateScheduledPubById(@Param("id") String id,
@Param("scheduled") String scheduled,
@Param("pubTime") LocalDateTime pubTime);
@Modifying
@Query("UPDATE Column c SET c.state = :state WHERE c.id = :id")
int updateColumnState(@Param("id") String id, @Param("state") String state);
/*@Modifying
@Query("UPDATE Column c SET c.number = :#{#column.number}, c.name = :#{#column.name}, c.userid = :#{#column.userid}, c.summary = :#{#column.summary}, c.coverphoto = :#{#column.coverphoto} WHERE c.id = :#{#column.id}")
int updateColumn(@Param("column") Column column);
@Modifying
@Query("UPDATE Column c SET " +
"c.number = CASE WHEN :#{#column.number != null} THEN :#{#column.number} ELSE c.number END, " +
"c.name = CASE WHEN :#{#column.name != null} THEN :#{#column.name} ELSE c.name END, " +
"c.summary = CASE WHEN :#{#column.summary != null} THEN :#{#column.summary} ELSE c.summary END, " +
"c.state = CASE WHEN :#{#column.state != null} THEN :#{#column.state} ELSE c.state END, " +
"c.scheduled = CASE WHEN :#{#column.scheduled != null} THEN :#{#column.scheduled} ELSE c.scheduled END, " +
"c.userId = CASE WHEN :#{#column.userId != null} THEN :#{#column.userId} ELSE c.userId END, " +
"c.coverPhoto = CASE WHEN :#{#column.coverPhoto != null} THEN :#{#column.coverPhoto} ELSE c.coverPhoto END, " +
"c.pubTime = CASE WHEN :#{#column.pubTime != null} THEN :#{#column.pubTime} ELSE c.pubTime END " +
"WHERE c.id = :#{#column.id}")
int dynamicUpdateColumn(@Param("column") Column column);*/
}

@ -1,31 +0,0 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.ColumnSong;
import com.luoo.music.pojo.ColumnSongCount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* @author locust
*/
public interface ColumnSongDao extends JpaRepository<ColumnSong,String>, JpaSpecificationExecutor<ColumnSong> {
@Query("SELECT cs.columnId, COUNT(cs) AS songCount FROM ColumnSong cs WHERE cs.columnId IN :columnIds GROUP BY cs.columnId")
List<ColumnSongCount> findSongCountByColumnIds(@Param("columnIds") List<String> columnIds);
@Query("SELECT cs.columnId FROM ColumnSong cs WHERE cs.songId = :id")
List<String> findColumnsBySongId(@Param("id") String id);
@Query("SELECT cs FROM ColumnSong cs WHERE cs.songId IN :ids ORDER BY cs.id ")
List<ColumnSong> findBySongId(@Param("ids") List<String> ids);
@Query("SELECT cs FROM ColumnSong cs WHERE cs.columnId = :id ORDER BY cs.id ")
List<ColumnSong> findByColumnId(@Param("id") String id);
@Query("DELETE FROM ColumnSong cs WHERE cs.columnId = :id")
int deleteByColumnId(@Param("id") String id);
}

@ -1,27 +0,0 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.ColumnTag;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* @author locust
*/
public interface ColumnTagDao extends JpaRepository<ColumnTag,String>, JpaSpecificationExecutor<ColumnTag> {
@Query("SELECT ct FROM ColumnTag ct WHERE ct.columnId IN :columnIds ORDER BY ct.id")
List<ColumnTag> findByColumnIds(@Param("columnIds") List<String> columnIds);
@Query("SELECT ct.columnId FROM ColumnTag ct WHERE ct.tagId IN :tags")
List<String> findColumnIdsByTags(@Param("tags") List<String> tags);
@Query("SELECT ct.tagId FROM ColumnTag ct WHERE ct.columnId = :id")
List<String> findTagsByColumnId(@Param("id") String id);
@Query("DELETE FROM ColumnTag ct WHERE ct.columnId = :id")
int deleteByColumnId(@Param("id") String id);
}

@ -0,0 +1,36 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.Journal;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* @author locust
*/
public interface JournalDao extends JpaRepository<Journal,String>,JpaSpecificationExecutor<Journal>{
List<Journal> findByIdIn(Set<String> ids);
@Modifying
@Query("UPDATE Journal j SET j.state = '1', j.pubTime = :pubTime WHERE j.id = :id")
int updatePubById(@Param("id") String id,
@Param("pubTime") LocalDateTime pubTime);
@Modifying
@Query("UPDATE Journal j SET j.scheduled = :scheduled, j.pubTime = :pubTime WHERE j.id = :id")
int updateScheduledPubById(@Param("id") String id,
@Param("scheduled") String scheduled,
@Param("pubTime") LocalDateTime pubTime);
@Modifying
@Query("UPDATE Journal j SET j.state = :state WHERE j.id = :id")
int updateJournalState(@Param("id") String id, @Param("state") String state);
}

@ -0,0 +1,37 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.JournalSong;
import com.luoo.music.pojo.JournalSongCount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* @author locust
*/
public interface JournalSongDao extends JpaRepository<JournalSong,String>, JpaSpecificationExecutor<JournalSong> {
@Query("SELECT js.journalId, COUNT(js) AS songCount FROM JournalSong js WHERE js.journalId IN :journalIds GROUP BY js.journalId")
List<JournalSongCount> findSongCountByJournalIds(@Param("journalIds") List<String> journalIds);
@Query("SELECT js.journalId FROM JournalSong js WHERE js.songId = :songId")
List<String> findJournalBySongId(@Param("songId") String songId);
@Query("SELECT js FROM JournalSong js WHERE js.songId IN :songIds ORDER BY js.id")
List<JournalSong> findBySongId(@Param("songIds") List<String> songIds);
@Query("SELECT js FROM JournalSong js WHERE js.journalId = :journalId ORDER BY js.id")
List<JournalSong> findByJournalId(@Param("journalId") String journalId);
@Modifying
@Query("DELETE FROM JournalSong js WHERE js.journalId = :journalId")
int deleteByJournalId(@Param("journalId") String journalId);
@Modifying
@Query("DELETE FROM JournalSong js WHERE js.songId = :songId")
int deleteBySongId(@Param("songId") String songId);
}

@ -0,0 +1,29 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.JournalTag;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* @author locust
*/
public interface JournalTagDao extends JpaRepository<JournalTag,String>, JpaSpecificationExecutor<JournalTag> {
@Query("SELECT jt FROM JournalTag jt WHERE jt.journalId IN :journalIds ORDER BY jt.id")
List<JournalTag> findByJournalIds(@Param("journalIds") List<String> journalIds);
@Query("SELECT jt.journalId FROM JournalTag jt WHERE jt.tagId IN :tagIds")
List<String> findJournalIdsByTags(@Param("tagIds") List<String> tagIds);
@Query("SELECT jt.tagId FROM JournalTag jt WHERE jt.journalId = :journalId")
List<String> findTagsByJournalId(@Param("journalId") String journalId);
@Modifying
@Query("DELETE FROM JournalTag jt WHERE jt.journalId = :journalId")
int deleteByJournalId(@Param("journalId") String journalId);
}

@ -0,0 +1,27 @@
package com.luoo.music.dao;
import com.luoo.music.pojo.SongInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Set;
/**
* @author locust
*/
public interface SongInfoDao extends JpaRepository<SongInfo,String>, JpaSpecificationExecutor<SongInfo> {
@Modifying
@Query("UPDATE SongInfo s SET s.state = :state WHERE s.id = :id")
int updateSongState(@Param("id") String id, @Param("state") String state);
@Modifying
@Query("UPDATE SongInfo s SET s.lyric = :lyric WHERE s.id = :id")
int updateSongLyric(@Param("id") String id, @Param("lyric") String lyric);
List<SongInfo> findByIdIn(Set<String> ids);
}

@ -3,6 +3,7 @@ package com.luoo.music.dao;
import com.luoo.music.pojo.SongTag;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
@ -19,6 +20,7 @@ public interface SongTagDao extends JpaRepository<SongTag,String>, JpaSpecificat
@Query("SELECT st FROM SongTag st WHERE st.songId IN :ids ORDER BY st.id ")
List<SongTag> findBySongId(@Param("ids") List<String> ids);
@Modifying
@Query("DELETE FROM SongTag st WHERE st.songId = :id")
int deleteBySongId(@Param("id") String id);
}

@ -13,16 +13,4 @@ import java.util.Set;
public interface TagDao extends JpaRepository<Tag, String>, JpaSpecificationExecutor<Tag>{
List<Tag> findByIdIn(Set<String> ids);
/*@Query(value = "SELECT " +
" t1.id AS id, " +
"CASE " +
" WHEN t1.LEVEL = 1 THEN " +
" t1.name_ch ELSE CONCAT(( SELECT t2.name_ch FROM tb_tag_info t2 WHERE t2.id = t1.parent_id ), '-', t1.name_ch ) " +
" END AS name_cn " +
"FROM " +
" tb_tag_info t1 " +
"WHERE " +
" t1.id IN :ids", nativeQuery = true)
List<TagCustom> findTagCustomByIds(@Param("ids") List<String> ids);*/
}

@ -20,11 +20,11 @@ import java.time.LocalDateTime;
*/
@Data
@Entity
@Table(name="tb_column")
@Table(name="tb_journal")
@DynamicInsert
@DynamicUpdate
@EntityListeners(AuditingEntityListener.class)
public class Column implements Serializable{
public class Journal implements Serializable{
@Id
private String id;

@ -12,12 +12,12 @@ import javax.persistence.Table;
*/
@Data
@Entity
@Table(name="tb_column_song")
public class ColumnSong {
@Table(name="tb_journal_song")
public class JournalSong {
@Id
private String id;
private String columnId;
private String journalId;
private String songId;
}

@ -4,9 +4,9 @@ package com.luoo.music.pojo;
*
* @author locust
*/
public interface ColumnSongCount {
public interface JournalSongCount {
String getColumnId();
String getJournalId();
Long getSongCount();
}

@ -12,12 +12,12 @@ import javax.persistence.Table;
*/
@Data
@Entity
@Table(name="tb_column_tag")
public class ColumnTag {
@Table(name="tb_journal_tag")
public class JournalTag {
@Id
private String id;
private String columnId;
private String journalId;
private String tagId;
}

@ -23,9 +23,9 @@ import java.time.LocalDateTime;
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "tb_song_cms")
@Table(name = "tb_song_info")
@EntityListeners(AuditingEntityListener.class)
public class CMSSong implements Serializable {
public class SongInfo implements Serializable {
@Id
private String id;

@ -7,7 +7,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
/**
*
*
* @author locust
*/
@Data

@ -11,7 +11,7 @@ import java.util.List;
*/
@Data
@ApiModel(value = "增加或修改期刊对象")
public class ColumnAddModel {
public class JournalAddModel {
@ApiModelProperty(value = "期刊编号")
private String number;

@ -11,7 +11,7 @@ import java.util.List;
*/
@Data
@ApiModel(value = "期刊请求对象")
public class ColumnQueryModel {
public class JournalQueryModel {
@ApiModelProperty(value = "列表Tab新建0已发布1 回收站2")
private String tab = "0";
@ -30,6 +30,4 @@ public class ColumnQueryModel {
@ApiModelProperty(value = "标签ID")
private List<String> tags;
private List<String> columns;
}

@ -1,61 +0,0 @@
package com.luoo.music.response.cms;
import com.luoo.music.response.cms.SongVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author locust
*/
@Data
@ApiModel(description = "期刊信息")
public class ColumnVO {
@ApiModelProperty(value = "主键ID", example = "123")
private String id;
@ApiModelProperty(value = "期刊编号", example = "123")
private String number;
@ApiModelProperty(value = "期刊标题", example = "123")
private String name;
@ApiModelProperty(value = "期刊封面", example = "123")
private String coverPhoto;
@ApiModelProperty(value = "期刊标签", example = "123")
private List<String> tag;
@ApiModelProperty(value = "歌曲数", example = "123")
private long songCount;
@ApiModelProperty(value = "评论数", example = "123")
private long commentCount;
@ApiModelProperty(value = "播放数", example = "123")
private long playCount;
@ApiModelProperty(value = "发布作者", example = "123")
private String userId;//
@ApiModelProperty(value = "创建时间", example = "123")
private String createTime;
@ApiModelProperty(value = "发布时间", example = "123")
private String pubTime;
@ApiModelProperty(value = "期刊启停状态0:停用1:启用", example = "123")
private String state;
@ApiModelProperty(value = "期刊发布状态0:待发布1:已发布", example = "123")
private String status;
@ApiModelProperty(value = "期刊歌曲信息", example = "123")
private List<SongVO> songs;
@ApiModelProperty(value = "期刊简介信息", example = "123")
private String summary;
}

@ -0,0 +1,61 @@
package com.luoo.music.response.cms;
import com.luoo.music.response.cms.SongVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author locust
*/
@Data
@ApiModel(description = "期刊信息")
public class JournalVO {
@ApiModelProperty(value = "主键ID")
private String id;
@ApiModelProperty(value = "期刊编号")
private String number;
@ApiModelProperty(value = "期刊标题")
private String name;
@ApiModelProperty(value = "期刊封面")
private String coverPhoto;
@ApiModelProperty(value = "期刊标签")
private List<String> tag;
@ApiModelProperty(value = "歌曲数")
private long songCount;
@ApiModelProperty(value = "评论数")
private long commentCount;
@ApiModelProperty(value = "播放数")
private long playCount;
@ApiModelProperty(value = "发布作者")
private String userId;//
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "发布时间")
private String pubTime;
@ApiModelProperty(value = "期刊启停状态0:停用1:启用")
private String state;
@ApiModelProperty(value = "期刊发布状态0:待发布1:已发布")
private String status;
@ApiModelProperty(value = "期刊歌曲信息")
private List<SongVO> songs;
@ApiModelProperty(value = "期刊简介信息")
private String summary;
}

@ -13,45 +13,45 @@ import java.util.List;
@ApiModel(description = "歌曲信息")
public class SongVO {
@ApiModelProperty(value = "主键ID", example = "123")
@ApiModelProperty(value = "主键ID")
private String id;
@ApiModelProperty(value = "歌曲名称", example = "123")
@ApiModelProperty(value = "歌曲名称")
private String name;
@ApiModelProperty(value = "歌手或乐队", example = "123")
@ApiModelProperty(value = "歌手或乐队")
private String artist;
@ApiModelProperty(value = "专辑", example = "123")
@ApiModelProperty(value = "专辑")
private String album;
@ApiModelProperty(value = "歌曲风格", example = "123")
@ApiModelProperty(value = "歌曲风格")
private List<String> tags;
@ApiModelProperty(value = "封面路径", example = "123")
@ApiModelProperty(value = "封面路径")
private String picture;
@ApiModelProperty(value = "文件大小", example = "123")
@ApiModelProperty(value = "文件大小")
private String size;
@ApiModelProperty(value = "歌曲时长", example = "123")
@ApiModelProperty(value = "歌曲时长")
private String duration;
@ApiModelProperty(value = "关联期刊", example = "123")
private List<String> column;
@ApiModelProperty(value = "关联期刊")
private List<String> journal;
@ApiModelProperty(value = "修改时间", example = "123")
@ApiModelProperty(value = "修改时间")
private String updateTime;
@ApiModelProperty(value = "歌曲启停状态0:停用1:启用", example = "123")
@ApiModelProperty(value = "歌曲启停状态0:停用1:启用")
private String state;
@ApiModelProperty(value = "上传人员", example = "123")
@ApiModelProperty(value = "上传人员")
private String userId;
@ApiModelProperty(value = "文件路径", example = "123")
@ApiModelProperty(value = "文件路径")
private String url;
@ApiModelProperty(value = "歌词", example = "123")
@ApiModelProperty(value = "歌词")
private String lyric;
}

@ -4,9 +4,9 @@ import api.PageResult;
import api.Result;
import com.luoo.music.dao.*;
import com.luoo.music.pojo.*;
import com.luoo.music.request.cms.ColumnAddModel;
import com.luoo.music.request.cms.ColumnQueryModel;
import com.luoo.music.response.cms.ColumnVO;
import com.luoo.music.request.cms.JournalAddModel;
import com.luoo.music.request.cms.JournalQueryModel;
import com.luoo.music.response.cms.JournalVO;
import com.luoo.music.response.cms.SongVO;
import com.luoo.music.util.CommonUtil;
import com.luoo.music.util.UploadUtil;
@ -34,20 +34,20 @@ import java.util.stream.Collectors;
* @author locust
*/
@Service
public class CMSColumnService {
public class CMSJournalService {
@Autowired
private ColumnTagDao columnTagDao;
private IdWorker idWorker;
@Autowired
private ColumnDao columnDao;
private JournalTagDao journalTagDao;
@Autowired
private IdWorker idWorker;
private JournalDao journalDao;
@Autowired
private ColumnSongDao columnSongDao;
private JournalSongDao journalSongDao;
@Autowired
private TagDao tagDao;
@Autowired
private CMSSongDao songDao;
private SongInfoDao songDao;
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@ -59,30 +59,29 @@ public class CMSColumnService {
* @param size
* @return
*/
public Result<PageResult> search(ColumnQueryModel param, int page, int size) {
List<ColumnVO> result = new ArrayList<>();
public Result<PageResult<JournalVO>> search(JournalQueryModel param, int page, int size) {
List<JournalVO> result = new ArrayList<>();
Sort sort = new Sort(Sort.Direction.DESC, "createTime");
PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
Page<Column> columnPage;
Page<Journal> journalPage;
if (!Objects.isNull(param)) {
List<String> columnIdsByTags = null;
List<String> journalIdsByTags = null;
if (!CollectionUtils.isEmpty(param.getTags())) {
columnIdsByTags = columnTagDao.findColumnIdsByTags(param.getTags());
journalIdsByTags = journalTagDao.findJournalIdsByTags(param.getTags());
}
param.setColumns(columnIdsByTags);
Specification<Column> columnSpecification = buildSearchSpecification(param);
columnPage = columnDao.findAll(columnSpecification, pageRequest);
Specification<Journal> journalSpecification = buildSearchSpecification(param, journalIdsByTags);
journalPage = journalDao.findAll(journalSpecification, pageRequest);
} else {
columnPage = columnDao.findAll(pageRequest);
journalPage = journalDao.findAll(pageRequest);
}
long totalElements = columnPage.getTotalElements();
List<Column> content = columnPage.getContent();
long totalElements = journalPage.getTotalElements();
List<Journal> content = journalPage.getContent();
if (!CollectionUtils.isEmpty(content)) {
List<String> ids = content.stream().map(Column::getId).collect(Collectors.toList());
List<String> ids = content.stream().map(Journal::getId).collect(Collectors.toList());
Map<String, Long> songCountMap = songCountInfo(ids);
Map<String, List<String>> columnTagMap = tagInfo(ids);
for (Column item : content) {
ColumnVO response = new ColumnVO();
Map<String, List<String>> journalTagMap = tagInfo(ids);
for (Journal item : content) {
JournalVO response = new JournalVO();
response.setId(item.getId());
response.setNumber(item.getNumber());
response.setName(item.getName());
@ -96,7 +95,7 @@ public class CMSColumnService {
// TODO 编号文字转换
response.setUserId(item.getUserId());
response.setSongCount(songCountMap.get(item.getId()));
response.setTag(columnTagMap.get(item.getId()));
response.setTag(journalTagMap.get(item.getId()));
if (!"1".equals(param.getTab())) {
response.setPlayCount(0);
response.setCommentCount(0);
@ -116,8 +115,8 @@ public class CMSColumnService {
* @param param
* @return
*/
private Specification<Column> buildSearchSpecification(ColumnQueryModel param) {
return (Root<Column> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> {
private Specification<Journal> buildSearchSpecification(JournalQueryModel param, List<String> ids) {
return (Root<Journal> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> {
List<Predicate> predicateList = new ArrayList<Predicate>();
if("1".equals(param.getTab())) {
Predicate state = builder.equal(root.get("state"), "1");
@ -136,8 +135,8 @@ public class CMSColumnService {
if (StringUtils.isNotBlank(param.getStart()) && StringUtils.isNotBlank(param.getEnd())) {
predicateList.add(builder.between(root.get("createTime"), param.getStart(), param.getEnd()));
}
if (!CollectionUtils.isEmpty(param.getColumns())) {
predicateList.add(root.get("id").in(param.getColumns()));
if (!CollectionUtils.isEmpty(ids)) {
predicateList.add(root.get("id").in(ids));
}
if(StringUtils.isNotBlank(param.getKeyword())) {
String likeExpression = "%" + param.getKeyword() + "%";
@ -157,8 +156,8 @@ public class CMSColumnService {
private Map<String, Long> songCountInfo(List<String> ids) {
Map<String, Long> songCountMap = new HashMap<>();
if (!CollectionUtils.isEmpty(ids)) {
List<ColumnSongCount> columnSongCountList = columnSongDao.findSongCountByColumnIds(ids);
songCountMap = columnSongCountList.stream().collect(Collectors.toMap(ColumnSongCount::getColumnId, ColumnSongCount::getSongCount));
List<JournalSongCount> journalSongCountList = journalSongDao.findSongCountByJournalIds(ids);
songCountMap = journalSongCountList.stream().collect(Collectors.toMap(JournalSongCount::getJournalId, JournalSongCount::getSongCount));
}
return songCountMap;
}
@ -169,16 +168,16 @@ public class CMSColumnService {
* @return
*/
private Map<String, List<String>> tagInfo(List<String> ids) {
Map<String, List<String>> columnTagMap = new HashMap<>();
List<ColumnTag> columnTagList = columnTagDao.findByColumnIds(ids);
Set<String> tagIdSet = columnTagList.stream().map(ColumnTag::getTagId).collect(Collectors.toSet());
Map<String, List<String>> journalTagMap = new HashMap<>();
List<JournalTag> journalTagList = journalTagDao.findByJournalIds(ids);
Set<String> tagIdSet = journalTagList.stream().map(JournalTag::getTagId).collect(Collectors.toSet());
List<Tag> tagList = tagDao.findByIdIn(tagIdSet);
Map<String, Tag> idTagMap = tagList.stream().collect(Collectors.toMap(Tag::getId, obj -> obj));
List<String> list;
for (ColumnTag item : columnTagList) {
String columnId = item.getColumnId();
if (columnTagMap.containsKey(columnId)) {
list = columnTagMap.get(columnId);
for (JournalTag item : journalTagList) {
String journalId = item.getJournalId();
if (journalTagMap.containsKey(journalId)) {
list = journalTagMap.get(journalId);
} else {
list = new ArrayList<>();
}
@ -186,9 +185,9 @@ public class CMSColumnService {
if (StringUtils.isNotBlank(tag.getParentId())) {
list.add(tag.getNameCh());
}
columnTagMap.put(columnId, list);
journalTagMap.put(journalId, list);
}
return columnTagMap;
return journalTagMap;
}
/**
@ -197,27 +196,27 @@ public class CMSColumnService {
* @param image
* @return
*/
public Result add(ColumnAddModel param, MultipartFile image) {
public Result add(JournalAddModel param, MultipartFile image) {
String imagePath = UploadUtil.upload(image, UploadUtil.IMAGE_DIR);
Column column = buildColumn(null, param);
Journal journal = buildJournal(null, param);
String id = String.valueOf(idWorker.nextId());
column.setId(id);
column.setCoverPhoto(imagePath);
columnDao.save(column);
batchSaveColumnRelatesInfo(id, param);
journal.setId(id);
journal.setCoverPhoto(imagePath);
journalDao.save(journal);
batchSaveJournalRelatesInfo(id, param);
return Result.success();
}
private Column buildColumn(String id, ColumnAddModel param) {
Column column = new Column();
private Journal buildJournal(String id, JournalAddModel param) {
Journal journal = new Journal();
if (!StringUtils.isBlank(id)) {
column.setId(id);
journal.setId(id);
}
column.setNumber(param.getNumber());
column.setName(param.getName());
column.setUserId(param.getUserId());
column.setSummary(param.getSummary());
return column;
journal.setNumber(param.getNumber());
journal.setName(param.getName());
journal.setUserId(param.getUserId());
journal.setSummary(param.getSummary());
return journal;
}
/**
@ -225,27 +224,27 @@ public class CMSColumnService {
* @param id
* @param param
*/
private void batchSaveColumnRelatesInfo(String id, ColumnAddModel param) {
private void batchSaveJournalRelatesInfo(String id, JournalAddModel param) {
if (!CollectionUtils.isEmpty(param.getTags())) {
List<ColumnTag> columnTagList = new ArrayList<>();
List<JournalTag> journalTagList = new ArrayList<>();
for (String item : param.getTags()) {
ColumnTag columnTag = new ColumnTag();
columnTag.setId(String.valueOf(idWorker.nextId()));
columnTag.setColumnId(id);
columnTag.setTagId(item);
columnTagList.add(columnTag);
JournalTag journalTag = new JournalTag();
journalTag.setId(String.valueOf(idWorker.nextId()));
journalTag.setJournalId(id);
journalTag.setTagId(item);
journalTagList.add(journalTag);
}
columnTagDao.saveAll(columnTagList);
journalTagDao.saveAll(journalTagList);
}
if (!CollectionUtils.isEmpty(param.getSongs())) {
List<ColumnSong> columnSongList = new ArrayList<>();
List<JournalSong> journalSongList = new ArrayList<>();
for (String item : param.getSongs()) {
ColumnSong columnSong = new ColumnSong();
columnSong.setId(String.valueOf(idWorker.nextId()));
columnSong.setColumnId(id);
columnSong.setSongId(item);
JournalSong journalSong = new JournalSong();
journalSong.setId(String.valueOf(idWorker.nextId()));
journalSong.setJournalId(id);
journalSong.setSongId(item);
}
columnSongDao.saveAll(columnSongList);
journalSongDao.saveAll(journalSongList);
}
}
@ -254,17 +253,17 @@ public class CMSColumnService {
* @param id
* @return
*/
public Result<ColumnVO> findOne(String id) {
Column column = columnDao.findById(id).get();
ColumnVO response = new ColumnVO();
response.setId(column.getId());
response.setNumber(column.getNumber());
response.setName(column.getName());
response.setTag(columnTagDao.findTagsByColumnId(id));
response.setUserId(column.getUserId());
response.setCoverPhoto(column.getCoverPhoto());
response.setSongs(songInfo(column.getId()));
response.setSummary(column.getSummary());
public Result<JournalVO> findOne(String id) {
Journal journal = journalDao.findById(id).get();
JournalVO response = new JournalVO();
response.setId(journal.getId());
response.setNumber(journal.getNumber());
response.setName(journal.getName());
response.setTag(journalTagDao.findTagsByJournalId(id));
response.setUserId(journal.getUserId());
response.setCoverPhoto(journal.getCoverPhoto());
response.setSongs(songInfo(journal.getId()));
response.setSummary(journal.getSummary());
return Result.success(response);
}
@ -275,14 +274,14 @@ public class CMSColumnService {
*/
private List<SongVO> songInfo(String id) {
List<SongVO> list = new ArrayList<>();
List<ColumnSong> columnSongList = columnSongDao.findByColumnId(id);
if (!CollectionUtils.isEmpty(columnSongList)) {
Set<String> songIdSet = columnSongList.stream().map(ColumnSong::getSongId).collect(Collectors.toSet());
List<CMSSong> songList = songDao.findByIdIn(songIdSet);
Map<String, CMSSong> idTagMap = songList.stream().collect(Collectors.toMap(CMSSong::getId, obj -> obj));
for (ColumnSong item : columnSongList) {
List<JournalSong> journalSongList = journalSongDao.findByJournalId(id);
if (!CollectionUtils.isEmpty(journalSongList)) {
Set<String> songIdSet = journalSongList.stream().map(JournalSong::getSongId).collect(Collectors.toSet());
List<SongInfo> songList = songDao.findByIdIn(songIdSet);
Map<String, SongInfo> idTagMap = songList.stream().collect(Collectors.toMap(SongInfo::getId, obj -> obj));
for (JournalSong item : journalSongList) {
if (idTagMap.containsKey(item.getSongId())) {
CMSSong song = idTagMap.get(item.getSongId());
SongInfo song = idTagMap.get(item.getSongId());
SongVO songVO = new SongVO();
songVO.setId(song.getId());
songVO.setPicture(song.getPicture());
@ -305,17 +304,17 @@ public class CMSColumnService {
* @param image
* @return
*/
public Result update(String id, ColumnAddModel param, MultipartFile image) {
Column column = buildColumn(id, param);
Column oldColumn = columnDao.findById(id).get();
boolean bool = UploadUtil.fileHasChanged(oldColumn.getCoverPhoto(), image);
public Result update(String id, JournalAddModel param, MultipartFile image) {
Journal journal = buildJournal(id, param);
Journal oldJournal = journalDao.findById(id).get();
boolean bool = UploadUtil.fileHasChanged(oldJournal.getCoverPhoto(), image);
if (bool) {
String imagePath = UploadUtil.upload(image, UploadUtil.IMAGE_DIR);
column.setCoverPhoto(imagePath);
journal.setCoverPhoto(imagePath);
}
columnDao.save(column);
batchDeleteColumnRelatesInfo(id);
batchSaveColumnRelatesInfo(id, param);
journalDao.save(journal);
batchDeleteJournalRelatesInfo(id);
batchSaveJournalRelatesInfo(id, param);
return Result.success();
}
@ -323,9 +322,9 @@ public class CMSColumnService {
*
* @param id
*/
private void batchDeleteColumnRelatesInfo(String id) {
columnTagDao.deleteByColumnId(id);
columnSongDao.deleteByColumnId(id);
private void batchDeleteJournalRelatesInfo(String id) {
journalTagDao.deleteByJournalId(id);
journalSongDao.deleteByJournalId(id);
}
@ -341,10 +340,10 @@ public class CMSColumnService {
if ("1".equals(scheduled)) {
if (StringUtils.isNotBlank(pubTimeStr)){
pubTime = LocalDateTime.parse(pubTimeStr, formatter);
columnDao.updateScheduledPubById(id, scheduled, pubTime);
journalDao.updateScheduledPubById(id, scheduled, pubTime);
}
}
columnDao.updatePubById(id, pubTime);
journalDao.updatePubById(id, pubTime);
return Result.success();
}
@ -354,8 +353,8 @@ public class CMSColumnService {
* @param state
* @return
*/
public Result updateColumnState(String id, String state) {
columnDao.updateColumnState(id, state);
public Result updateJournalState(String id, String state) {
journalDao.updateJournalState(id, state);
return Result.success("更新成功");
}
@ -365,9 +364,8 @@ public class CMSColumnService {
* @return
*/
public Result deleteById(String id) {
columnDao.deleteById(id);
batchDeleteColumnRelatesInfo(id);
journalDao.deleteById(id);
batchDeleteJournalRelatesInfo(id);
return Result.success();
}
}

@ -43,15 +43,15 @@ import java.util.stream.Collectors;
public class CMSSongService {
@Autowired
private CMSSongDao songDao;
private SongInfoDao songDao;
@Autowired
private IdWorker idWorker;
@Autowired
private SongTagDao songTagDao;
@Autowired
private ColumnSongDao columnSongDao;
private JournalSongDao journalSongDao;
@Autowired
private ColumnDao columnDao;
private JournalDao journalDao;
@Autowired
private TagDao tagDao;
@ -64,25 +64,25 @@ public class CMSSongService {
* @param size
* @return
*/
public Result search(SongQueryModel param, int page, int size) {
public Result<PageResult<SongVO>> search(SongQueryModel param, int page, int size) {
List<SongVO> result = new ArrayList<>();
// Sort sort = new Sort(Sort.Direction.DESC, "create_time");
// PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
PageRequest pageRequest = PageRequest.of(page - 1, size);
Page<CMSSong> songPage;
Page<SongInfo> songPage;
if (!Objects.isNull(param)) {
Specification<CMSSong> columnSpecification = buildSearchSpecification(param);
songPage = songDao.findAll(columnSpecification, pageRequest);
Specification<SongInfo> songSpecification = buildSearchSpecification(param);
songPage = songDao.findAll(songSpecification, pageRequest);
} else {
songPage = songDao.findAll(pageRequest);
}
long totalElements = songPage.getTotalElements();
List<CMSSong> content = songPage.getContent();
List<SongInfo> content = songPage.getContent();
if (!CollectionUtils.isEmpty(content)) {
List<String> ids = content.stream().map(CMSSong::getId).collect(Collectors.toList());
Map<String, List<String>> songColumnMap = buildSongColumnInfo(ids);
List<String> ids = content.stream().map(SongInfo::getId).collect(Collectors.toList());
Map<String, List<String>> songJournalMap = buildSongJournalInfo(ids);
Map<String, List<String>> songTagMap = buildSongTagInfo(ids);
for (CMSSong item : content) {
for (SongInfo item : content) {
SongVO response = new SongVO();
String id = item.getId();
response.setId(id);
@ -93,7 +93,7 @@ public class CMSSongService {
response.setPicture(item.getPicture());
response.setSize(CommonUtil.formatSongSize(item.getSize()));
response.setDuration(CommonUtil.formatSongDuration(item.getDuration()));
response.setColumn(songColumnMap.get(id));
response.setJournal(songJournalMap.get(id));
response.setUpdateTime(df.format(item.getUpdateTime()));
response.setState(item.getState());
response.setUserId(item.getUserId());
@ -109,8 +109,8 @@ public class CMSSongService {
* @param param
* @return
*/
private Specification<CMSSong> buildSearchSpecification(SongQueryModel param) {
return (Root<CMSSong> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> {
private Specification<SongInfo> buildSearchSpecification(SongQueryModel param) {
return (Root<SongInfo> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> {
List<Predicate> predicateList = new ArrayList<Predicate>();
if(StringUtils.isNotBlank(param.getUserId())) {
predicateList.add(builder.equal(root.get("user_id"), param.getUserId()));
@ -131,25 +131,25 @@ public class CMSSongService {
};
}
private Map<String, List<String>> buildSongColumnInfo(List<String> ids) {
private Map<String, List<String>> buildSongJournalInfo(List<String> ids) {
Map<String, List<String>> result = new HashMap<>();
List<ColumnSong> bySongId = columnSongDao.findBySongId(ids);
List<JournalSong> bySongId = journalSongDao.findBySongId(ids);
if (!CollectionUtils.isEmpty(bySongId)) {
Set<String> idSet = bySongId.stream().map(ColumnSong::getColumnId).collect(Collectors.toSet());
List<Column> columnList = columnDao.findByIdIn(idSet);
Map<String, Column> idColumnMap = columnList.stream().collect(Collectors.toMap(Column::getId, obj -> obj));
for (ColumnSong item : bySongId) {
Set<String> idSet = bySongId.stream().map(JournalSong::getJournalId).collect(Collectors.toSet());
List<Journal> journalList = journalDao.findByIdIn(idSet);
Map<String, Journal> idJournalMap = journalList.stream().collect(Collectors.toMap(Journal::getId, obj -> obj));
for (JournalSong item : bySongId) {
String songId = item.getSongId();
String columnId = item.getColumnId();
String journalId = item.getJournalId();
List<String> list;
if (result.keySet().contains(songId)) {
list = result.get(songId);
} else {
list = new ArrayList<>();
}
if (idColumnMap.keySet().contains(columnId)) {
Column column = idColumnMap.get(columnId);
list.add(column.getNumber() + " " + column.getName());
if (idJournalMap.keySet().contains(journalId)) {
Journal journal = idJournalMap.get(journalId);
list.add(journal.getNumber() + " " + journal.getName());
}
result.put(songId, list);
}
@ -193,7 +193,7 @@ public class CMSSongService {
public Result add(SongAddModel param, MultipartFile imageFile, MultipartFile songFile) {
String imagePath= UploadUtil.upload(imageFile, UploadUtil.IMAGE_DIR);
String songPath = UploadUtil.upload(songFile, UploadUtil.SONG_DIR);
CMSSong song = new CMSSong();
SongInfo song = new SongInfo();
String id = String.valueOf(idWorker.nextId());
song.setId(id);
song.setName(param.getName());
@ -256,8 +256,8 @@ public class CMSSongService {
* @param id
* @return
*/
public Result findOne(String id) {
CMSSong song = songDao.findById(id).get();
public Result<SongVO> findOne(String id) {
SongInfo song = songDao.findById(id).get();
SongVO response = new SongVO();
response.setId(song.getId());
response.setName(song.getName());
@ -278,8 +278,8 @@ public class CMSSongService {
* @return
*/
public Result update(String id, SongAddModel param, MultipartFile imageFile, MultipartFile songFile) {
CMSSong oldSong = songDao.findById(id).get();
CMSSong song = new CMSSong();
SongInfo oldSong = songDao.findById(id).get();
SongInfo song = new SongInfo();
song.setId(id);
song.setName(param.getName());
song.setArtist(param.getAlbum());
@ -312,6 +312,9 @@ public class CMSSongService {
*/
public Result updateSongState(String id, String state) {
songDao.updateSongState(id, state);
if ("0".equals(state)) {
journalSongDao.deleteBySongId(id);
}
return Result.success("更新成功");
}
@ -333,7 +336,7 @@ public class CMSSongService {
*/
public Result batchUpload(List<MultipartFile> files) {
for (MultipartFile file : files) {
CMSSong song = new CMSSong();
SongInfo song = new SongInfo();
String id = String.valueOf(idWorker.nextId());
song.setId(id);
String songPath = UploadUtil.upload(file, UploadUtil.SONG_DIR);
@ -351,8 +354,8 @@ public class CMSSongService {
* @return
*/
public Result deleteById(String id) {
List<String> columnsBySongId = columnSongDao.findColumnsBySongId(id);
if (CollectionUtils.isEmpty(columnsBySongId)) {
List<String> journalsBySongId = journalSongDao.findJournalBySongId(id);
if (CollectionUtils.isEmpty(journalsBySongId)) {
return Result.success("该歌曲被期刊使用,删除失败");
} else {
songDao.deleteById(id);

Loading…
Cancel
Save