@@ -298,6 +298,7 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
} | } | ||||
} | } | ||||
@AuthIgnore | |||||
@GetMapping(value = "/music") | @GetMapping(value = "/music") | ||||
@ApiImplicitParams({ | @ApiImplicitParams({ | ||||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
@@ -312,6 +313,20 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
return new ResultData(music); | return new ResultData(music); | ||||
} | } | ||||
@GetMapping(value = "/userMusic") | |||||
@ApiImplicitParams({ | |||||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
@ApiOperation("获取用户音乐") | |||||
public ResultData userMusic(@ModelAttribute MusicInfo record, Integer pageNum, Integer pageSize) { | |||||
logger.debug("[" + getIpAddr() + "] UserMouldVideoController::userMusic"); | |||||
if (record == null) record = new MusicInfo(); | |||||
record.setUserId(getMemberId()); | |||||
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||||
PageInfo<MusicInfo> music = musicInfoService.userMusic(pageNum, pageSize, record); | |||||
return new ResultData(music); | |||||
} | |||||
@ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
@PostMapping("/save") | @PostMapping("/save") | ||||
public ResultData save(@RequestBody MusicInfo record) { | public ResultData save(@RequestBody MusicInfo record) { | ||||
@@ -12,4 +12,6 @@ public interface MusicInfoServiceMapper extends CommonMapper<MusicInfo, String> | |||||
List<MusicInfo> findList(MusicInfo record); | List<MusicInfo> findList(MusicInfo record); | ||||
void deleteById(@Param("id")Long id); | void deleteById(@Param("id")Long id); | ||||
List<MusicInfo> userMusic(MusicInfo record); | |||||
} | } |
@@ -14,4 +14,6 @@ public interface MusicInfoService { | |||||
ResultData saveOrUpdate(MusicInfo record); | ResultData saveOrUpdate(MusicInfo record); | ||||
void deleteById(Long id); | void deleteById(Long id); | ||||
PageInfo<MusicInfo> userMusic(Integer pageNum, Integer pageSize, MusicInfo record); | |||||
} | } |
@@ -75,4 +75,9 @@ public class MusicInfoServiceImpl implements MusicInfoService { | |||||
public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
musicInfoServiceMapper.deleteById(id); | musicInfoServiceMapper.deleteById(id); | ||||
} | } | ||||
@Override | |||||
public PageInfo<MusicInfo> userMusic(Integer pageNum, Integer pageSize, MusicInfo record) { | |||||
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> musicInfoServiceMapper.userMusic(record)); | |||||
} | |||||
} | } |
@@ -4,13 +4,13 @@ | |||||
<select id="findList" resultType="com.iformall.domain.po.sm.MusicInfo"> | <select id="findList" resultType="com.iformall.domain.po.sm.MusicInfo"> | ||||
SELECT id, update_date, size, name, time, is_del, url, create_date, user_id, type | SELECT id, update_date, size, name, time, is_del, url, create_date, user_id, type | ||||
FROM music_info | FROM music_info | ||||
WHERE is_del = 0 | |||||
<if test="type == 1"> | |||||
and type = #{type} and userId = 0 | |||||
</if> | |||||
<if test="type == 2"> | |||||
and type = #{type} userId = #{userId} | |||||
</if> | |||||
WHERE is_del = 0 and type = #{type} and userId = 0 | |||||
</select> | |||||
<select id="userMusic" resultType="com.iformall.domain.po.sm.MusicInfo"> | |||||
SELECT id, update_date, size, name, time, is_del, url, create_date, user_id, type | |||||
FROM music_info | |||||
WHERE is_del = 0 and type = #{type} userId = #{userId} | |||||
</select> | </select> | ||||
<update id="deleteById"> | <update id="deleteById"> | ||||