@@ -330,4 +330,23 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
return musicInfoService.saveOrUpdate(record); | return musicInfoService.saveOrUpdate(record); | ||||
} | } | ||||
@ApiOperation("根据id删除接口") | |||||
@GetMapping("/delete") | |||||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
public ResultData delete(Long id) { | |||||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::delete"); | |||||
if(id == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"参数为空"); | |||||
} | |||||
MusicInfo musicInfo = musicInfoService.getById(id); | |||||
if(musicInfo == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); | |||||
} | |||||
if(!musicInfo.getUserId().equals(getMemberId())){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到用户数据"); | |||||
} | |||||
musicInfoService.deleteById(id); | |||||
return new ResultData(); | |||||
} | |||||
} | } |
@@ -4,9 +4,12 @@ import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.MallPermission; | import com.iformall.domain.po.MallPermission; | ||||
import com.iformall.domain.po.sm.MusicInfo; | import com.iformall.domain.po.sm.MusicInfo; | ||||
import com.iformall.domain.po.sm.PersonPhoto; | import com.iformall.domain.po.sm.PersonPhoto; | ||||
import org.apache.ibatis.annotations.Param; | |||||
import java.util.List; | import java.util.List; | ||||
public interface MusicInfoServiceMapper extends CommonMapper<MusicInfo, String> { | public interface MusicInfoServiceMapper extends CommonMapper<MusicInfo, String> { | ||||
List<MusicInfo> findList(MusicInfo record); | List<MusicInfo> findList(MusicInfo record); | ||||
void deleteById(@Param("id")Long id); | |||||
} | } |
@@ -12,4 +12,6 @@ public interface MusicInfoService { | |||||
PageInfo<MusicInfo> music(Integer pageNum, Integer pageSize, MusicInfo record); | PageInfo<MusicInfo> music(Integer pageNum, Integer pageSize, MusicInfo record); | ||||
ResultData saveOrUpdate(MusicInfo record); | ResultData saveOrUpdate(MusicInfo record); | ||||
void deleteById(Long id); | |||||
} | } |
@@ -63,4 +63,9 @@ public class MusicInfoServiceImpl implements MusicInfoService { | |||||
} | } | ||||
return new ResultData(record); | return new ResultData(record); | ||||
} | } | ||||
@Override | |||||
public void deleteById(Long id) { | |||||
musicInfoServiceMapper.deleteById(id); | |||||
} | |||||
} | } |
@@ -1,7 +1,6 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | <?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"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
<mapper namespace="com.iformall.mapper.MusicInfoServiceMapper"> | <mapper namespace="com.iformall.mapper.MusicInfoServiceMapper"> | ||||
<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 | ||||
@@ -13,4 +12,9 @@ | |||||
and type = #{type} userId = #{userId} | and type = #{type} userId = #{userId} | ||||
</if> | </if> | ||||
</select> | </select> | ||||
<update id="deleteById"> | |||||
update music_info set is_del = 1,update_date = now() where id = #{id} | |||||
</update> | |||||
</mapper> | </mapper> |