增加分享次数,优化音乐下载
This commit is contained in:
@@ -19,6 +19,14 @@ public interface ShareInfoMapper
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public ShareInfo selectShareInfoById(String id);
|
||||
|
||||
/**
|
||||
* 根据音乐ID查询分享信息
|
||||
*
|
||||
* @param musicId 音乐ID
|
||||
* @return 分享信息
|
||||
*/
|
||||
public ShareInfo selectShareInfoByMusicId(String musicId);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
|
||||
@@ -61,4 +61,12 @@ public interface IShareInfoService
|
||||
public int deleteShareInfoById(String id);
|
||||
|
||||
List<ShareInfo> findShareInfoListPage(ShareInfo shareInfo);
|
||||
|
||||
/**
|
||||
* 增加分享次数
|
||||
*
|
||||
* @param musicId 音乐ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int increaseShareCount(String id);
|
||||
}
|
||||
|
||||
@@ -28,9 +28,32 @@ public class ShareInfoServiceImpl implements IShareInfoService
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public ShareInfo selectShareInfoById(String id)
|
||||
{
|
||||
return shareInfoMapper.selectShareInfoById(id);
|
||||
public List<ShareInfo> findShareInfoListPage(ShareInfo shareInfo) {
|
||||
return shareInfoMapper.selectShareInfoListPage(shareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加分享次数
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int increaseShareCount(String id) {
|
||||
// 查询是否存在该音乐的分享记录
|
||||
ShareInfo shareInfo = shareInfoMapper.selectShareInfoById(id);
|
||||
if (shareInfo != null) {
|
||||
// 存在记录,更新分享次数
|
||||
shareInfo.setShareNum(shareInfo.getShareNum() + 1);
|
||||
shareInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return shareInfoMapper.updateShareInfo(shareInfo);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ShareInfo selectShareInfoById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,8 +118,6 @@ public class ShareInfoServiceImpl implements IShareInfoService
|
||||
return shareInfoMapper.deleteShareInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShareInfo> findShareInfoListPage(ShareInfo shareInfo) {
|
||||
return shareInfoMapper.selectShareInfoListPage(shareInfo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,10 +15,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDel" column="is_del" />
|
||||
<result property="review" column="review" />
|
||||
<result property="shareNum" column="share_num" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectShareInfoVo">
|
||||
select id, user_id, share_decs, music_id, share_addr, share_plat, create_time, update_time, is_del, review from share_info
|
||||
select id, user_id, share_decs, music_id, share_addr, share_plat, create_time, update_time, is_del, review,share_num from share_info
|
||||
</sql>
|
||||
|
||||
<select id="selectShareInfoList" parameterType="ShareInfo" resultMap="ShareInfoResult">
|
||||
@@ -38,6 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectShareInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectShareInfoByMusicId" parameterType="String" resultMap="ShareInfoResult">
|
||||
<include refid="selectShareInfoVo"/>
|
||||
where music_id = #{musicId} limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertShareInfo" parameterType="ShareInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into share_info
|
||||
@@ -77,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDel != null">is_del = #{isDel},</if>
|
||||
<if test="review != null">review = #{review},</if>
|
||||
<if test="shareNum != null">share_num=#{shareNum}</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user