parent
2a5259a9fe
commit
4368aa06c1
@ -0,0 +1,16 @@
|
||||
package com.luoo.music.dto.response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JournalFilterDTO {
|
||||
@ApiModelProperty(value = "风格筛选条件")
|
||||
private List<String> styleList;
|
||||
@ApiModelProperty(value = "语言筛选条件")
|
||||
private List<String> languageList;
|
||||
@ApiModelProperty(value = "期刊号筛选条件")
|
||||
private List<String> journalNoList;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.luoo.music.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.luoo.music.dao.TagDao;
|
||||
|
||||
@Service
|
||||
public class TagService {
|
||||
@Autowired
|
||||
private TagDao tagDao;
|
||||
public List<String> getLanguageList() {
|
||||
return tagDao.getLanguageList();
|
||||
}
|
||||
|
||||
public List<String> getStyleList() {
|
||||
return tagDao.getStyleList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.luoo.music.service;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class JournalSongServiceTest {
|
||||
|
||||
@Test
|
||||
public void testJournalNoList() {
|
||||
getJournalNoList(100).forEach(System.out::println);
|
||||
}
|
||||
public List<String> getJournalNoList(int journalFilterNumberRange) {
|
||||
int maxJournalNo=1011;
|
||||
List<String> journalNoList=new ArrayList<>();
|
||||
int i=1;
|
||||
int start=1;
|
||||
int end=i*journalFilterNumberRange;
|
||||
while(end<maxJournalNo) {
|
||||
start=1==i?1:(i-1)*journalFilterNumberRange;
|
||||
end=i*journalFilterNumberRange;
|
||||
if(end>maxJournalNo) {
|
||||
end=maxJournalNo;
|
||||
}
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append(end);
|
||||
sb.append("~");
|
||||
sb.append(start);
|
||||
journalNoList.add(sb.toString());
|
||||
i++;
|
||||
}
|
||||
Collections.reverse(journalNoList);
|
||||
return journalNoList;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue