1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-10-07 20:55:04 +08:00
parent 88bb8a4b29
commit 140c8bd61e
5 changed files with 23 additions and 20 deletions

View File

@@ -27,6 +27,7 @@ SELECT * FROM album WHERE (full_description = '' or full_description is null) an
*/
async function fetchAll({ args = {}, isUpdate = false }) {
if (args.order) console.log("存在 DISTINCT自动升序排序无需指定ORDER BY");
console.log("start fetching albums ...");
if (isUpdate) {
@@ -38,7 +39,6 @@ async function fetchAll({ args = {}, isUpdate = false }) {
].join(' AND ');
var sql = `
SELECT DISTINCT album_id FROM song_album_relation WHERE ${whereClause} AND album_id NOT IN ( SELECT album_id FROM album )
${args.order ? `ORDER BY album_id ${args.order}` : ''}
${args.limit ? `LIMIT ${args.limit}` : ''}
`;
console.log(sql);

View File

@@ -23,6 +23,7 @@ async function getFromDatabase({ artistId }) {
// 从数据库中查出还缺少的歌手,并进行爬取
async function fetchAll({ args = {} }) {
if (args.order) console.log("存在 DISTINCT自动升序排序无需指定ORDER BY");
console.log("start fetching artists ...");
let whereClause = [
args.min ? `artist_id > ${args.min}` : '1=1',
@@ -30,7 +31,6 @@ async function fetchAll({ args = {} }) {
].join(' AND ');
var sql = `
SELECT DISTINCT artist_id FROM song_artist_relation WHERE ${whereClause} AND artist_id NOT IN ( SELECT artist_id FROM artist )
${args.order ? `ORDER BY artist_id ${args.order}` : ''}
${args.limit ? `LIMIT ${args.limit}` : ''}
`;
console.log(sql);

View File

@@ -8,6 +8,7 @@ const dbUtils = global.dbUtils;
// 从数据库中查出还缺少的歌词,并进行爬取
async function fetchAll({ args = {} }) {
if (args.order) console.log("存在 DISTINCT自动升序排序无需指定ORDER BY");
console.log("start fetching lyrics ...");
let whereClause = [
args.min ? `song_id > ${args.min}` : '1=1',
@@ -15,7 +16,6 @@ async function fetchAll({ args = {} }) {
].join(' AND ');
var sql = `
SELECT DISTINCT song_id FROM song WHERE ${whereClause} AND song_id NOT IN ( SELECT song_id FROM lyric )
${args.order ? `ORDER BY song_id ${args.order}` : ''}
${args.limit ? `LIMIT ${args.limit}` : ''}
`;
console.log(sql);