diff --git a/src/main/java/com/yutou/nas/Controllers/MusicController.java b/src/main/java/com/yutou/nas/Controllers/MusicController.java index 845230b..17e3648 100644 --- a/src/main/java/com/yutou/nas/Controllers/MusicController.java +++ b/src/main/java/com/yutou/nas/Controllers/MusicController.java @@ -2,9 +2,12 @@ package com.yutou.nas.Controllers; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.yutou.nas.mybatis.model.MusicData; -import com.yutou.nas.utils.*; import com.yutou.nas.Services.impl.MusicToolsServiceImpl; +import com.yutou.nas.mybatis.model.MusicData; +import com.yutou.nas.utils.ConfigTools; +import com.yutou.nas.utils.RedisTools; +import com.yutou.nas.utils.StringUtils; +import com.yutou.nas.utils.Tools; import org.springframework.core.io.FileSystemResource; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -15,10 +18,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.io.File; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.Base64; import java.util.List; +import java.util.Objects; import java.util.UUID; import static com.yutou.nas.Datas.AppData.defaultMusicPath; @@ -36,7 +37,7 @@ public class MusicController { json.put("code", 0); json.put("scan", musicTools.isScan()); json.put("size", musicTools.getLength()); - json.put("data", JSONArray.toJSON(musicTools.getMusicList())); + json.put("data", JSONArray.toJSON(musicTools.getMusicList(true))); return json.toJSONString(); } @@ -58,7 +59,7 @@ public class MusicController { json.put("code", 0); json.put("scan", musicTools.isScan()); json.put("size", musicTools.getLength()); - json.put("data", JSONArray.toJSON(musicTools.getPath(path, type))); + json.put("data", JSONArray.toJSON(musicTools.getPath(path, type, true))); return json.toJSONString(); } @@ -71,7 +72,7 @@ public class MusicController { if (StringUtils.isEmpty(album)) { json.put("data", JSONArray.toJSON(musicTools.getAllAlbum())); } else { - json.put("data", JSONArray.toJSON(musicTools.selectAlbum(album))); + json.put("data", JSONArray.toJSON(musicTools.selectAlbum(album, true))); } return json.toJSONString(); } @@ -85,7 +86,7 @@ public class MusicController { if (StringUtils.isEmpty(artist)) { json.put("data", JSONArray.toJSON(musicTools.getAllArtist())); } else { - json.put("data", JSONArray.toJSON(musicTools.selectArtist(artist))); + json.put("data", JSONArray.toJSON(musicTools.selectArtist(artist, true))); } return json.toJSONString(); } @@ -104,9 +105,7 @@ public class MusicController { @ResponseBody public String findFile(@RequestBody JSONObject body) { String path = body.getString("path"); - if (!path.startsWith(defaultMusicPath)) { - path = Tools.base64ToString(path); - } + JSONObject json = new JSONObject(); if (StringUtils.isEmpty(path)) { json.put("code", -1); @@ -114,7 +113,7 @@ public class MusicController { return json.toJSONString(); } json.put("code", 0); - json.put("data", musicTools.getMusicData(path)); + json.put("data", musicTools.getMusicDataOfMd5(path, true)); return json.toJSONString(); } @@ -147,24 +146,9 @@ public class MusicController { @RequestMapping(value = "/nas/music/image.do", produces = MediaType.IMAGE_JPEG_VALUE) @ResponseBody public byte[] getImage(@RequestBody JSONObject body) { - String fileName = body.getString("fileName"); - if (!fileName.startsWith(defaultMusicPath)) { - fileName = Tools.base64ToString(fileName); - } - List list = null; - if ("album".equals(body.getString("type"))) { - list = musicTools.selectAlbum(fileName); - } - File file; - if (list != null && !list.isEmpty()) { - fileName = list.get(0).getFile(); - } - if(!fileName.startsWith("/media/yutou/disk_lvm/public/音乐/") - ||fileName.endsWith("..") - ||fileName.endsWith("../")){ - return null; - } - file = new File(fileName); + String md5 = body.getString("fileName"); + + File file = musicTools.getMusicOfMd5(md5, false); if (file.exists()) { try { return musicTools.readImage(file.getAbsolutePath()); @@ -178,83 +162,87 @@ public class MusicController { @RequestMapping("/nas/music/random.do") @ResponseBody public String random() { - List list = musicTools.getMusicList(); + List list = musicTools.getMusicList(true); MusicData data = list.get(Tools.randomCommon(0, list.size() - 1, 1)[0]); JSONObject json = new JSONObject(); json.put("code", 0); - try { - json.put("data", URLEncoder.encode(getBase64(data.getFile()), "UTF-8")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + json.put("data", data.getMd5()); return json.toJSONString(); } - private String getBase64(String str) { - return new String(Base64.getEncoder().encode(str.getBytes())); - } - @RequestMapping("/nas/music/play.do") public ResponseEntity play(String filePath, String random) { - String _filePath; boolean _random; _random = !StringUtils.isEmpty(random) && "true".equals(random); - _filePath = Tools.base64ToString(filePath); if (_random) { - List list = musicTools.getMusicList(); + List list = musicTools.getMusicList(true); MusicData data = list.get(Tools.randomCommon(0, list.size() - 1, 1)[0]); - _filePath = data.getFile(); + filePath = data.getMd5(); } - if(!_filePath.startsWith("/media/yutou/disk_lvm/public/音乐/") - ||_filePath.endsWith("..") - ||_filePath.endsWith("../")){ - return null; - } - File file = new File(_filePath); + + File file = musicTools.getMusicOfMd5(filePath, false); if (file.exists()) { return Tools.getFile(file); } else { return null; } } + @RequestMapping("/nas/music/share.do") @ResponseBody - public JSONObject share(@RequestBody JSONObject data){ + public JSONObject share(@RequestBody JSONObject data) { System.out.println(data); - String file=data.getString("file"); - String token=data.getString("token"); - JSONObject json=new JSONObject(); - File music=new File(file); - if(music.exists()){ - String key=Tools.getMD5(UUID.randomUUID().toString()+music.getAbsolutePath()); - RedisTools.set(key,file,3600); - JSONObject item=new JSONObject(); - item.put("share",key); - json.put("code",1); - json.put("msg","ok"); - json.put("data",item); - }else{ - json.put("code",-1); - json.put("msg","文件不存在"); - json.put("data","{}"); + String md5 = data.getString("file"); + boolean isDir = data.getBoolean("isDir"); + JSONObject json = new JSONObject(); + File music; + if (isDir) { + music = new File(md5); + } else { + music = musicTools.getMusicOfMd5(md5, false); + } + if (music.exists()) { + String key = Tools.getMD5(UUID.randomUUID() + music.getAbsolutePath()); + RedisTools.set(key, music.getAbsolutePath(), 3600); + JSONObject item = new JSONObject(); + item.put("share", key); + json.put("code", 1); + json.put("msg", "ok"); + json.put("data", item); + } else { + json.put("code", -1); + json.put("msg", "文件不存在"); + json.put("data", "{}"); } return json; } + @RequestMapping("/nas/music/playShare.do") @ResponseBody - public JSONObject playShare(String token) throws UnsupportedEncodingException { - JSONObject json=new JSONObject(); - String redis=RedisTools.get(token); - if(redis!=null&&!"-999".equals(token)){ - String file=redis; - JSONObject item=new JSONObject(); - item.put("file",file); - json.put("code",0); - json.put("data",item); - }else{ - json.put("code",-1); - json.put("msg","分享已过期"); + public JSONObject playShare(String token) { + JSONObject json = new JSONObject(); + String redis = RedisTools.get(token); + if (redis != null && !"-999".equals(token)) { + File file = new File(redis); + JSONArray array = new JSONArray(); + if (file.isFile()) { + array.add(musicTools.getMusicData(file.getAbsolutePath(), true)); + } else { + for (File listFile : Objects.requireNonNull(file.listFiles())) { + MusicData data=musicTools.getMusicData(listFile.getAbsolutePath(), true); + if(data!=null) { + array.add(data); + } + } + } + JSONObject item = new JSONObject(); + item.put("file", array); + json.put("code", 0); + json.put("data", item); + } else { + json.put("code", -1); + json.put("msg", "分享已过期"); } return json; } diff --git a/src/main/java/com/yutou/nas/Controllers/MusicFavoritesController.java b/src/main/java/com/yutou/nas/Controllers/MusicFavoritesController.java index 0112fa8..d610337 100644 --- a/src/main/java/com/yutou/nas/Controllers/MusicFavoritesController.java +++ b/src/main/java/com/yutou/nas/Controllers/MusicFavoritesController.java @@ -146,7 +146,7 @@ public class MusicFavoritesController { MusicDataExample dataExample = new MusicDataExample(); dataExample.createCriteria().andMd5EqualTo(favorites.getMusisMd5()); try { - dataList.add(musicDataDao.selectByExample(dataExample).get(0)); + dataList.add(musicDataDao.selectByExample(dataExample,true).get(0)); } catch (Exception ignored) { } } diff --git a/src/main/java/com/yutou/nas/NasApplication.java b/src/main/java/com/yutou/nas/NasApplication.java index 56761f4..e1f7898 100644 --- a/src/main/java/com/yutou/nas/NasApplication.java +++ b/src/main/java/com/yutou/nas/NasApplication.java @@ -12,7 +12,7 @@ import org.springframework.context.annotation.Import; @Import(BTDownloadManager.class) @SpringBootApplication public class NasApplication { - public static final String version="1.2.4"; + public static final String version="1.2.5"; public static void main(String[] args) { SpringApplication.run(NasApplication.class, args); AppData.defaultMusicPath = (String) ConfigTools.load(ConfigTools.CONFIG, "musicDir"); diff --git a/src/main/java/com/yutou/nas/Services/IMusicToolsService.java b/src/main/java/com/yutou/nas/Services/IMusicToolsService.java index 0071b09..bfea4e4 100644 --- a/src/main/java/com/yutou/nas/Services/IMusicToolsService.java +++ b/src/main/java/com/yutou/nas/Services/IMusicToolsService.java @@ -3,6 +3,7 @@ package com.yutou.nas.Services; import com.yutou.nas.mybatis.model.MusicData; +import java.io.File; import java.util.List; public interface IMusicToolsService { @@ -10,15 +11,16 @@ public interface IMusicToolsService { void scanMusic(); - List getPath(String path, boolean isDir); + List getPath(String path, boolean isDir,boolean delPath); - MusicData getMusicData(String md5); + MusicData getMusicDataOfMd5(String md5,boolean isDelFile); + MusicData getMusicData(String path,boolean isDelFile); - List findOfTitle(String title); + List findOfTitle(String title,boolean isDelFile); - List findOfArtist(String by); + List findOfArtist(String by,boolean isDelFile); - List getMusicList(); + List getMusicList(boolean isDelFile); int getLength(); @@ -27,4 +29,6 @@ public interface IMusicToolsService { String getMusicPath(); byte[] readImage(String path) throws Exception; + + File getMusicOfMd5(String md5,boolean isDelFile); } diff --git a/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java b/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java index 54f3b88..97b49c3 100644 --- a/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java +++ b/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java @@ -1,5 +1,6 @@ package com.yutou.nas.Services.impl; +import com.alibaba.fastjson.JSONObject; import com.yutou.nas.Datas.AppData; import com.yutou.nas.mybatis.dao.MusicDataDao; import com.yutou.nas.mybatis.model.MusicData; @@ -108,7 +109,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService { * @return 音乐列表 */ @Override - public List getPath(String path, boolean isDir) { + public List getPath(String path, boolean isDir,boolean delPath) { List list = new ArrayList<>(); List main = new ArrayList<>(); MusicDataExample example = new MusicDataExample(); @@ -119,7 +120,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService { } if (isDir) { example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%"); - main = musicDataDao.selectByExample(example); + main = musicDataDao.selectByExample(example,delPath); } tmpPath = tmpPath.replace(File.separator, replacement) .replace("+", "\\+") @@ -127,7 +128,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService { .replace("(", "\\(") .replace(")", "\\)") .replace("]", "\\]"); - main.addAll(musicDataDao.selectByRegexp(tmpPath + replacement + "([^" + replacement + "]+)$")); + main.addAll(musicDataDao.selectByRegexp(tmpPath + replacement + "([^" + replacement + "]+)$",delPath)); if (!path.equals(AppData.defaultMusicPath) && !"root".equals(path)) { MusicData t2 = new MusicData(); @@ -147,6 +148,8 @@ public class MusicToolsServiceImpl implements IMusicToolsService { return list; } + + public List getAllAlbum() { return musicDataDao.selectAllAlbum(); } @@ -155,12 +158,12 @@ public class MusicToolsServiceImpl implements IMusicToolsService { return musicDataDao.selectAllArtist(); } - public List selectAlbum(String album) { - return musicDataDao.selectAlbum(album); + public List selectAlbum(String album,boolean isDelFile) { + return musicDataDao.selectAlbum(album,isDelFile); } - public List selectArtist(String artist) { - return musicDataDao.selectArtist(artist); + public List selectArtist(String artist,boolean isDelFile) { + return musicDataDao.selectArtist(artist,isDelFile); } private void getDirList(String path, List list) { @@ -189,7 +192,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService { MusicData data = getMetadata(file); if (data != null) { try { - if (getMusicData(file.getAbsolutePath()) == null) { + if (getMusicData(file.getAbsolutePath(),false) == null) { // System.out.println(data); musicDataDao.insert(data); } @@ -202,10 +205,20 @@ public class MusicToolsServiceImpl implements IMusicToolsService { } @Override - public MusicData getMusicData(String path) { + public MusicData getMusicData(String path,boolean delFile) { MusicDataExample example = new MusicDataExample(); example.createCriteria().andFileEqualTo(path); - List list = musicDataDao.selectByExample(example); + List list = musicDataDao.selectByExample(example,delFile); + if (list != null && list.size() > 0) { + return list.get(0); + } + return null; + } + @Override + public MusicData getMusicDataOfMd5(String md5, boolean isDelFile) { + MusicDataExample example = new MusicDataExample(); + example.createCriteria().andMd5EqualTo(md5); + List list = musicDataDao.selectByExample(example,isDelFile); if (list != null && list.size() > 0) { return list.get(0); } @@ -471,23 +484,23 @@ public class MusicToolsServiceImpl implements IMusicToolsService { } @Override - public List findOfTitle(String title) { - return find(title, FIND_TITLE); + public List findOfTitle(String title,boolean delFile) { + return find(title, FIND_TITLE,delFile); } @Override - public List findOfArtist(String by) { - return find(by, FIND_ARTIST); + public List findOfArtist(String by,boolean delFile) { + return find(by, FIND_ARTIST,delFile); } @Override - public List getMusicList() { - return musicDataDao.selectByExample(new MusicDataExample()); + public List getMusicList(boolean delFile) { + return musicDataDao.selectByExample(new MusicDataExample(),delFile); } @Override public int getLength() { - return musicDataDao.selectByExample(new MusicDataExample()).size(); + return musicDataDao.selectByExample(new MusicDataExample(),true).size(); } @Override @@ -495,7 +508,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService { return isScan; } - private List find(String title, int type) { + private List find(String title, int type,boolean delFile) { List list; MusicDataExample example = new MusicDataExample(); if (type == FIND_TITLE) { @@ -503,7 +516,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService { } else if (type == FIND_ARTIST) { example.createCriteria().andArtistEqualTo(title); } - list = musicDataDao.selectByExample(example); + list = musicDataDao.selectByExample(example,delFile); return list; } @@ -530,6 +543,19 @@ public class MusicToolsServiceImpl implements IMusicToolsService { return bytes; } + @Override + public File getMusicOfMd5(String md5,boolean delFile) { + MusicDataExample example=new MusicDataExample(); + example.createCriteria().andMd5EqualTo(md5); + List list=musicDataDao.selectByExample(example,delFile); + Log.i("Music Size",list.size()); + if(list!=null&&!list.isEmpty()){ + Log.i("Music File", list.get(0).toString()); + return new File(list.get(0).getFile()); + } + return null; + } + private byte[] readImageFile(File file) throws Exception { String path = file.getAbsolutePath().replace(file.getName(), ""); File img = new File(path, "cover.jpg"); diff --git a/src/main/java/com/yutou/nas/mybatis/dao/MusicDataDao.java b/src/main/java/com/yutou/nas/mybatis/dao/MusicDataDao.java index 631c0b6..8256054 100644 --- a/src/main/java/com/yutou/nas/mybatis/dao/MusicDataDao.java +++ b/src/main/java/com/yutou/nas/mybatis/dao/MusicDataDao.java @@ -19,9 +19,9 @@ public interface MusicDataDao { int insertSelective(MusicData record); - List selectByExample(MusicDataExample example); + List selectByExample(@Param("example") MusicDataExample example,@Param("isDelFile") boolean isDelFile); - MusicData selectByPrimaryKey(Integer id); + MusicData selectByPrimaryKey(@Param("id")Integer id,@Param("isDelFile")boolean isDelFile); int updateByExampleSelective(@Param("record") MusicData record, @Param("example") MusicDataExample example); @@ -32,10 +32,11 @@ public interface MusicDataDao { int updateByPrimaryKey(MusicData record); void truncate(); - List selectByRegexp(String regexp); + List selectByRegexp(@Param("regexp")String regexp,@Param("isDelFile")boolean isDelFile); List selectAllAlbum(); List selectAllArtist(); - List selectAlbum(String album); - List selectArtist(String artist); + List selectAlbum(@Param("album")String album,@Param("isDelFile")boolean isDelFile); + List selectArtist(@Param("artist")String artist,@Param("isDelFile")boolean isDelFile); + } \ No newline at end of file diff --git a/src/main/resources/mappers/MusicDataDao.xml b/src/main/resources/mappers/MusicDataDao.xml index 3ad5918..624ffe4 100644 --- a/src/main/resources/mappers/MusicDataDao.xml +++ b/src/main/resources/mappers/MusicDataDao.xml @@ -1,496 +1,542 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - - - - - - - id, artist, album, title, `comment`, `year`, track, disc_no, composer, artist_sort, + + + + id + , artist, album, title, `comment`, `year`, track, disc_no, composer, artist_sort, `file`, lastDir, isDir, bitRate, sampleRate, noOfSamples, channelCount, encodingType, durationAsDouble, lossless, variableBitRate, md5 - - - - - delete from music_data - where id = #{id,jdbcType=INTEGER} - - - delete from music_data - - - - - - insert into music_data (artist, album, title, - `comment`, `year`, track, - disc_no, composer, artist_sort, - `file`, lastDir, isDir, - bitRate, sampleRate, noOfSamples, - channelCount, encodingType, durationAsDouble, - lossless, variableBitRate, md5 - ) - values (#{artist,jdbcType=VARCHAR}, #{album,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, - #{comment,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR}, #{track,jdbcType=VARCHAR}, - #{discNo,jdbcType=VARCHAR}, #{composer,jdbcType=VARCHAR}, #{artistSort,jdbcType=VARCHAR}, - #{file,jdbcType=VARCHAR}, #{lastdir,jdbcType=VARCHAR}, #{isdir,jdbcType=INTEGER}, - #{bitrate,jdbcType=INTEGER}, #{samplerate,jdbcType=INTEGER}, #{noofsamples,jdbcType=BIGINT}, - #{channelcount,jdbcType=INTEGER}, #{encodingtype,jdbcType=VARCHAR}, #{durationasdouble,jdbcType=DOUBLE}, - #{lossless,jdbcType=INTEGER}, #{variablebitrate,jdbcType=INTEGER}, #{md5,jdbcType=VARCHAR} - ) - - - insert into music_data - - - artist, - - - album, - - - title, - - - `comment`, - - - `year`, - - - track, - - - disc_no, - - - composer, - - - artist_sort, - - - `file`, - - - lastDir, - - - isDir, - - - bitRate, - - - sampleRate, - - - noOfSamples, - - - channelCount, - - - encodingType, - - - durationAsDouble, - - - lossless, - - - variableBitRate, - - - md5, - - - - - #{artist,jdbcType=VARCHAR}, - - - #{album,jdbcType=VARCHAR}, - - - #{title,jdbcType=VARCHAR}, - - - #{comment,jdbcType=VARCHAR}, - - - #{year,jdbcType=VARCHAR}, - - - #{track,jdbcType=VARCHAR}, - - - #{discNo,jdbcType=VARCHAR}, - - - #{composer,jdbcType=VARCHAR}, - - - #{artistSort,jdbcType=VARCHAR}, - - - #{file,jdbcType=VARCHAR}, - - - #{lastdir,jdbcType=VARCHAR}, - - - #{isdir,jdbcType=INTEGER}, - - - #{bitrate,jdbcType=INTEGER}, - - - #{samplerate,jdbcType=INTEGER}, - - - #{noofsamples,jdbcType=BIGINT}, - - - #{channelcount,jdbcType=INTEGER}, - - - #{encodingtype,jdbcType=VARCHAR}, - - - #{durationasdouble,jdbcType=DOUBLE}, - - - #{lossless,jdbcType=INTEGER}, - - - #{variablebitrate,jdbcType=INTEGER}, - - - #{md5,jdbcType=VARCHAR}, - - - - - - - - - - - update music_data - - - id = #{record.id,jdbcType=INTEGER}, - - + + + id + , artist, album, title, `comment`, `year`, track, disc_no, composer, artist_sort, + isDir, bitRate, sampleRate, noOfSamples, channelCount, encodingType, + durationAsDouble, lossless, variableBitRate, md5 + + + + + + delete + from music_data + where id = #{id,jdbcType=INTEGER} + + + delete from music_data + + + + + + insert into music_data (artist, album, title, + `comment`, `year`, track, + disc_no, composer, artist_sort, + `file`, lastDir, isDir, + bitRate, sampleRate, noOfSamples, + channelCount, encodingType, durationAsDouble, + lossless, variableBitRate, md5) + values (#{artist,jdbcType=VARCHAR}, #{album,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, + #{comment,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR}, #{track,jdbcType=VARCHAR}, + #{discNo,jdbcType=VARCHAR}, #{composer,jdbcType=VARCHAR}, #{artistSort,jdbcType=VARCHAR}, + #{file,jdbcType=VARCHAR}, #{lastdir,jdbcType=VARCHAR}, #{isdir,jdbcType=INTEGER}, + #{bitrate,jdbcType=INTEGER}, #{samplerate,jdbcType=INTEGER}, #{noofsamples,jdbcType=BIGINT}, + #{channelcount,jdbcType=INTEGER}, #{encodingtype,jdbcType=VARCHAR}, #{durationasdouble,jdbcType=DOUBLE}, + #{lossless,jdbcType=INTEGER}, #{variablebitrate,jdbcType=INTEGER}, #{md5,jdbcType=VARCHAR}) + + + insert into music_data + + + artist, + + + album, + + + title, + + + `comment`, + + + `year`, + + + track, + + + disc_no, + + + composer, + + + artist_sort, + + + `file`, + + + lastDir, + + + isDir, + + + bitRate, + + + sampleRate, + + + noOfSamples, + + + channelCount, + + + encodingType, + + + durationAsDouble, + + + lossless, + + + variableBitRate, + + + md5, + + + + + #{artist,jdbcType=VARCHAR}, + + + #{album,jdbcType=VARCHAR}, + + + #{title,jdbcType=VARCHAR}, + + + #{comment,jdbcType=VARCHAR}, + + + #{year,jdbcType=VARCHAR}, + + + #{track,jdbcType=VARCHAR}, + + + #{discNo,jdbcType=VARCHAR}, + + + #{composer,jdbcType=VARCHAR}, + + + #{artistSort,jdbcType=VARCHAR}, + + + #{file,jdbcType=VARCHAR}, + + + #{lastdir,jdbcType=VARCHAR}, + + + #{isdir,jdbcType=INTEGER}, + + + #{bitrate,jdbcType=INTEGER}, + + + #{samplerate,jdbcType=INTEGER}, + + + #{noofsamples,jdbcType=BIGINT}, + + + #{channelcount,jdbcType=INTEGER}, + + + #{encodingtype,jdbcType=VARCHAR}, + + + #{durationasdouble,jdbcType=DOUBLE}, + + + #{lossless,jdbcType=INTEGER}, + + + #{variablebitrate,jdbcType=INTEGER}, + + + #{md5,jdbcType=VARCHAR}, + + + + + + + + + + + update music_data + + + id = #{record.id,jdbcType=INTEGER}, + + + artist = #{record.artist,jdbcType=VARCHAR}, + + + album = #{record.album,jdbcType=VARCHAR}, + + + title = #{record.title,jdbcType=VARCHAR}, + + + `comment` = #{record.comment,jdbcType=VARCHAR}, + + + `year` = #{record.year,jdbcType=VARCHAR}, + + + track = #{record.track,jdbcType=VARCHAR}, + + + disc_no = #{record.discNo,jdbcType=VARCHAR}, + + + composer = #{record.composer,jdbcType=VARCHAR}, + + + artist_sort = #{record.artistSort,jdbcType=VARCHAR}, + + + `file` = #{record.file,jdbcType=VARCHAR}, + + + lastDir = #{record.lastdir,jdbcType=VARCHAR}, + + + isDir = #{record.isdir,jdbcType=INTEGER}, + + + bitRate = #{record.bitrate,jdbcType=INTEGER}, + + + sampleRate = #{record.samplerate,jdbcType=INTEGER}, + + + noOfSamples = #{record.noofsamples,jdbcType=BIGINT}, + + + channelCount = #{record.channelcount,jdbcType=INTEGER}, + + + encodingType = #{record.encodingtype,jdbcType=VARCHAR}, + + + durationAsDouble = #{record.durationasdouble,jdbcType=DOUBLE}, + + + lossless = #{record.lossless,jdbcType=INTEGER}, + + + variableBitRate = #{record.variablebitrate,jdbcType=INTEGER}, + + + md5 = #{record.md5,jdbcType=VARCHAR}, + + + + + + + + update music_data + set id = #{record.id,jdbcType=INTEGER}, artist = #{record.artist,jdbcType=VARCHAR}, - - album = #{record.album,jdbcType=VARCHAR}, - - title = #{record.title,jdbcType=VARCHAR}, - - `comment` = #{record.comment,jdbcType=VARCHAR}, - - `year` = #{record.year,jdbcType=VARCHAR}, - - track = #{record.track,jdbcType=VARCHAR}, - - disc_no = #{record.discNo,jdbcType=VARCHAR}, - - composer = #{record.composer,jdbcType=VARCHAR}, - - artist_sort = #{record.artistSort,jdbcType=VARCHAR}, - - `file` = #{record.file,jdbcType=VARCHAR}, - - lastDir = #{record.lastdir,jdbcType=VARCHAR}, - - isDir = #{record.isdir,jdbcType=INTEGER}, - - bitRate = #{record.bitrate,jdbcType=INTEGER}, - - sampleRate = #{record.samplerate,jdbcType=INTEGER}, - - noOfSamples = #{record.noofsamples,jdbcType=BIGINT}, - - channelCount = #{record.channelcount,jdbcType=INTEGER}, - - encodingType = #{record.encodingtype,jdbcType=VARCHAR}, - - durationAsDouble = #{record.durationasdouble,jdbcType=DOUBLE}, - - lossless = #{record.lossless,jdbcType=INTEGER}, - - variableBitRate = #{record.variablebitrate,jdbcType=INTEGER}, - - - md5 = #{record.md5,jdbcType=VARCHAR}, - - - - - - - - update music_data - set id = #{record.id,jdbcType=INTEGER}, - artist = #{record.artist,jdbcType=VARCHAR}, - album = #{record.album,jdbcType=VARCHAR}, - title = #{record.title,jdbcType=VARCHAR}, - `comment` = #{record.comment,jdbcType=VARCHAR}, - `year` = #{record.year,jdbcType=VARCHAR}, - track = #{record.track,jdbcType=VARCHAR}, - disc_no = #{record.discNo,jdbcType=VARCHAR}, - composer = #{record.composer,jdbcType=VARCHAR}, - artist_sort = #{record.artistSort,jdbcType=VARCHAR}, - `file` = #{record.file,jdbcType=VARCHAR}, - lastDir = #{record.lastdir,jdbcType=VARCHAR}, - isDir = #{record.isdir,jdbcType=INTEGER}, - bitRate = #{record.bitrate,jdbcType=INTEGER}, - sampleRate = #{record.samplerate,jdbcType=INTEGER}, - noOfSamples = #{record.noofsamples,jdbcType=BIGINT}, - channelCount = #{record.channelcount,jdbcType=INTEGER}, - encodingType = #{record.encodingtype,jdbcType=VARCHAR}, - durationAsDouble = #{record.durationasdouble,jdbcType=DOUBLE}, - lossless = #{record.lossless,jdbcType=INTEGER}, - variableBitRate = #{record.variablebitrate,jdbcType=INTEGER}, - md5 = #{record.md5,jdbcType=VARCHAR} - - - - - - update music_data - - - artist = #{artist,jdbcType=VARCHAR}, - - - album = #{album,jdbcType=VARCHAR}, - - - title = #{title,jdbcType=VARCHAR}, - - - `comment` = #{comment,jdbcType=VARCHAR}, - - - `year` = #{year,jdbcType=VARCHAR}, - - - track = #{track,jdbcType=VARCHAR}, - - - disc_no = #{discNo,jdbcType=VARCHAR}, - - - composer = #{composer,jdbcType=VARCHAR}, - - - artist_sort = #{artistSort,jdbcType=VARCHAR}, - - - `file` = #{file,jdbcType=VARCHAR}, - - - lastDir = #{lastdir,jdbcType=VARCHAR}, - - - isDir = #{isdir,jdbcType=INTEGER}, - - - bitRate = #{bitrate,jdbcType=INTEGER}, - - - sampleRate = #{samplerate,jdbcType=INTEGER}, - - - noOfSamples = #{noofsamples,jdbcType=BIGINT}, - - - channelCount = #{channelcount,jdbcType=INTEGER}, - - - encodingType = #{encodingtype,jdbcType=VARCHAR}, - - - durationAsDouble = #{durationasdouble,jdbcType=DOUBLE}, - - - lossless = #{lossless,jdbcType=INTEGER}, - - - variableBitRate = #{variablebitrate,jdbcType=INTEGER}, - - - md5 = #{md5,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update music_data - set artist = #{artist,jdbcType=VARCHAR}, - album = #{album,jdbcType=VARCHAR}, - title = #{title,jdbcType=VARCHAR}, - `comment` = #{comment,jdbcType=VARCHAR}, - `year` = #{year,jdbcType=VARCHAR}, - track = #{track,jdbcType=VARCHAR}, - disc_no = #{discNo,jdbcType=VARCHAR}, - composer = #{composer,jdbcType=VARCHAR}, - artist_sort = #{artistSort,jdbcType=VARCHAR}, - `file` = #{file,jdbcType=VARCHAR}, - lastDir = #{lastdir,jdbcType=VARCHAR}, - isDir = #{isdir,jdbcType=INTEGER}, - bitRate = #{bitrate,jdbcType=INTEGER}, - sampleRate = #{samplerate,jdbcType=INTEGER}, - noOfSamples = #{noofsamples,jdbcType=BIGINT}, - channelCount = #{channelcount,jdbcType=INTEGER}, - encodingType = #{encodingtype,jdbcType=VARCHAR}, - durationAsDouble = #{durationasdouble,jdbcType=DOUBLE}, - lossless = #{lossless,jdbcType=INTEGER}, - variableBitRate = #{variablebitrate,jdbcType=INTEGER}, - md5 = #{md5,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - - TRUNCATE music_data; - + md5 = #{record.md5,jdbcType=VARCHAR} + + + + + + update music_data + + + artist = #{artist,jdbcType=VARCHAR}, + + + album = #{album,jdbcType=VARCHAR}, + + + title = #{title,jdbcType=VARCHAR}, + + + `comment` = #{comment,jdbcType=VARCHAR}, + + + `year` = #{year,jdbcType=VARCHAR}, + + + track = #{track,jdbcType=VARCHAR}, + + + disc_no = #{discNo,jdbcType=VARCHAR}, + + + composer = #{composer,jdbcType=VARCHAR}, + + + artist_sort = #{artistSort,jdbcType=VARCHAR}, + + + `file` = #{file,jdbcType=VARCHAR}, + + + lastDir = #{lastdir,jdbcType=VARCHAR}, + + + isDir = #{isdir,jdbcType=INTEGER}, + + + bitRate = #{bitrate,jdbcType=INTEGER}, + + + sampleRate = #{samplerate,jdbcType=INTEGER}, + + + noOfSamples = #{noofsamples,jdbcType=BIGINT}, + + + channelCount = #{channelcount,jdbcType=INTEGER}, + + + encodingType = #{encodingtype,jdbcType=VARCHAR}, + + + durationAsDouble = #{durationasdouble,jdbcType=DOUBLE}, + + + lossless = #{lossless,jdbcType=INTEGER}, + + + variableBitRate = #{variablebitrate,jdbcType=INTEGER}, + + + md5 = #{md5,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update music_data + set artist = #{artist,jdbcType=VARCHAR}, + album = #{album,jdbcType=VARCHAR}, + title = #{title,jdbcType=VARCHAR}, + `comment` = #{comment,jdbcType=VARCHAR}, + `year` = #{year,jdbcType=VARCHAR}, + track = #{track,jdbcType=VARCHAR}, + disc_no = #{discNo,jdbcType=VARCHAR}, + composer = #{composer,jdbcType=VARCHAR}, + artist_sort = #{artistSort,jdbcType=VARCHAR}, + `file` = #{file,jdbcType=VARCHAR}, + lastDir = #{lastdir,jdbcType=VARCHAR}, + isDir = #{isdir,jdbcType=INTEGER}, + bitRate = #{bitrate,jdbcType=INTEGER}, + sampleRate = #{samplerate,jdbcType=INTEGER}, + noOfSamples = #{noofsamples,jdbcType=BIGINT}, + channelCount = #{channelcount,jdbcType=INTEGER}, + encodingType = #{encodingtype,jdbcType=VARCHAR}, + durationAsDouble = #{durationasdouble,jdbcType=DOUBLE}, + lossless = #{lossless,jdbcType=INTEGER}, + variableBitRate = #{variablebitrate,jdbcType=INTEGER}, + md5 = #{md5,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + TRUNCATE music_data; + \ No newline at end of file