From 2e7f33b451a58c01c53d448fcaa570d55e3b831c Mon Sep 17 00:00:00 2001 From: 10295 <1029559041@qq.com> Date: Wed, 23 May 2018 02:00:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E5=B9=95=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/web/controller/DataController.java | 16 + .../java/web/controller/TableController.java | 1 + web/src/main/resources/region.json | 590 ++++++++++++++++++ web/src/main/webapp/WEB-INF/jsp/form.jsp | 86 +++ web/src/main/webapp/WEB-INF/jsp/head.jsp | 1 + web/src/main/webapp/WEB-INF/jsp/table.jsp | 13 +- web/src/main/webapp/WEB-INF/jsp/test2.jsp | 28 +- 7 files changed, 712 insertions(+), 23 deletions(-) create mode 100644 web/src/main/resources/region.json create mode 100644 web/src/main/webapp/WEB-INF/jsp/form.jsp diff --git a/web/src/main/java/web/controller/DataController.java b/web/src/main/java/web/controller/DataController.java index 925f4ca..136d50d 100644 --- a/web/src/main/java/web/controller/DataController.java +++ b/web/src/main/java/web/controller/DataController.java @@ -1,5 +1,7 @@ package web.controller; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import db.AbstractModel; import db.DBAction; import db.model.bilibili.DataModel; @@ -11,17 +13,31 @@ import org.springframework.web.bind.annotation.RequestMapping; import web.service.DataService; import javax.annotation.Resource; +import java.io.IOException; import java.util.EnumSet; @Controller @RequestMapping("/data") public class DataController extends TableController { + + private static JsonNode jsonNode; + + static { + try { + jsonNode = new ObjectMapper().readTree(DataController.class.getResourceAsStream("/region.json")); + } catch (IOException e) { + e.printStackTrace(); + } + } + ; + @Resource private DataService dataService; @RequestMapping public String find(Model model, DataModel queryCommand){ + model.addAttribute("regionJson",jsonNode.toString()); return super.find(model,queryCommand,0,10); } diff --git a/web/src/main/java/web/controller/TableController.java b/web/src/main/java/web/controller/TableController.java index cbdff00..b309fcd 100644 --- a/web/src/main/java/web/controller/TableController.java +++ b/web/src/main/java/web/controller/TableController.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.util.List; public abstract class TableController extends BaseController { + @RequestMapping("table") public String find(Model model, T queryCommand, @RequestParam Integer firstResult, @RequestParam Integer maxResults){ DBAction action=DBAction.R; diff --git a/web/src/main/resources/region.json b/web/src/main/resources/region.json new file mode 100644 index 0000000..a002f40 --- /dev/null +++ b/web/src/main/resources/region.json @@ -0,0 +1,590 @@ +[ + { + "tid": 13, + "reid": 0, + "name": "番剧", + "uri": "bilibili://pgc/bangumi", + "type": 1, + "children": [ + { + "tid": 33, + "reid": 13, + "name": "连载动画", + "type": 0 + }, + { + "tid": 32, + "reid": 13, + "name": "完结动画", + "type": 0 + }, + { + "tid": 51, + "reid": 13, + "name": "资讯", + "type": 0 + }, + { + "tid": 152, + "reid": 13, + "name": "官方延伸", + "type": 0 + } + ] + }, + { + "tid": 1, + "reid": 0, + "name": "动画", + "uri": "bilibili://region/1", + "type": 0, + "children": [ + { + "tid": 24, + "reid": 1, + "name": "MAD·AMV", + "type": 0 + }, + { + "tid": 25, + "reid": 1, + "name": "MMD·3D", + "type": 0 + }, + { + "tid": 47, + "reid": 1, + "name": "短片·手书·配音", + "type": 0 + }, + { + "tid": 27, + "reid": 1, + "name": "综合", + "type": 0 + } + ] + }, + { + "tid": 167, + "reid": 0, + "name": "国创", + "uri": "bilibili://pgc/domestic", + "type": 1, + "children": [ + { + "tid": 153, + "reid": 167, + "name": "国产动画", + "type": 0 + }, + { + "tid": 168, + "reid": 167, + "name": "国产原创相关", + "type": 0 + }, + { + "tid": 170, + "reid": 167, + "name": "资讯", + "type": 0 + }, + { + "tid": 169, + "reid": 167, + "name": "布袋戏", + "type": 0 + } + ] + }, + { + "tid": 3, + "reid": 0, + "name": "音乐", + "uri": "bilibili://region/3", + "type": 0, + "children": [ + { + "tid": 31, + "reid": 3, + "name": "翻唱", + "type": 0 + }, + { + "tid": 30, + "reid": 3, + "name": "VOCALOID·UTAU", + "type": 0 + }, + { + "tid": 59, + "reid": 3, + "name": "演奏", + "type": 0 + }, + { + "tid": 54, + "reid": 3, + "name": "OP/ED/OST", + "type": 0 + }, + { + "tid": 28, + "reid": 3, + "name": "原创音乐", + "type": 0 + }, + { + "tid": 29, + "reid": 3, + "name": "三次元音乐", + "type": 0 + }, + { + "tid": 130, + "reid": 3, + "name": "音乐选集", + "type": 0 + } + ] + }, + { + "tid": 129, + "reid": 0, + "name": "舞蹈", + "uri": "bilibili://region/129", + "type": 0, + "children": [ + { + "tid": 20, + "reid": 129, + "name": "宅舞", + "type": 0 + }, + { + "tid": 154, + "reid": 129, + "name": "三次元舞蹈", + "type": 0 + }, + { + "tid": 156, + "reid": 129, + "name": "舞蹈教程", + "type": 0 + } + ] + }, + { + "tid": 4, + "reid": 0, + "name": "游戏", + "uri": "bilibili://region/4", + "type": 0, + "children": [ + { + "tid": 17, + "reid": 4, + "name": "单机游戏", + "type": 0 + }, + { + "tid": 171, + "reid": 4, + "name": "电子竞技", + "type": 0 + }, + { + "tid": 172, + "reid": 4, + "name": "手机游戏", + "type": 0 + }, + { + "tid": 65, + "reid": 4, + "name": "网络游戏", + "type": 0 + }, + { + "tid": 173, + "reid": 4, + "name": "桌游棋牌", + "type": 0 + }, + { + "tid": 121, + "reid": 4, + "name": "GMV", + "type": 0 + }, + { + "tid": 136, + "reid": 4, + "name": "音游", + "type": 0 + }, + { + "tid": 19, + "reid": 4, + "name": "Mugen", + "type": 0 + } + ] + }, + { + "tid": 36, + "reid": 0, + "name": "科技", + "uri": "bilibili://region/36", + "type": 0, + "children": [ + { + "tid": 124, + "reid": 36, + "name": "趣味科普人文", + "type": 0 + }, + { + "tid": 122, + "reid": 36, + "name": "野生技术协会", + "type": 0 + }, + { + "tid": 39, + "reid": 36, + "name": "演讲·公开课", + "type": 0 + }, + { + "tid": 96, + "reid": 36, + "name": "星海", + "type": 0 + }, + { + "tid": 95, + "reid": 36, + "name": "数码", + "type": 0 + }, + { + "tid": 98, + "reid": 36, + "name": "机械", + "type": 0 + }, + { + "tid": 176, + "reid": 36, + "name": "汽车", + "type": 0 + } + ] + }, + { + "tid": 160, + "reid": 0, + "name": "生活", + "uri": "bilibili://region/160", + "type": 0, + "children": [ + { + "tid": 138, + "reid": 160, + "name": "搞笑", + "type": 0 + }, + { + "tid": 21, + "reid": 160, + "name": "日常", + "type": 0 + }, + { + "tid": 76, + "reid": 160, + "name": "美食圈", + "type": 0 + }, + { + "tid": 75, + "reid": 160, + "name": "动物圈", + "type": 0 + }, + { + "tid": 161, + "reid": 160, + "name": "手工", + "type": 0 + }, + { + "tid": 162, + "reid": 160, + "name": "绘画", + "type": 0 + }, + { + "tid": 175, + "reid": 160, + "name": "ASMR", + "type": 0 + }, + { + "tid": 163, + "reid": 160, + "name": "运动", + "type": 0 + }, + { + "tid": 174, + "reid": 160, + "name": "其他", + "type": 0 + } + ] + }, + { + "tid": 119, + "reid": 0, + "name": "鬼畜", + "uri": "bilibili://region/119", + "type": 0, + "children": [ + { + "tid": 22, + "reid": 119, + "name": "鬼畜调教", + "type": 0 + }, + { + "tid": 26, + "reid": 119, + "name": "音MAD", + "type": 0 + }, + { + "tid": 126, + "reid": 119, + "name": "人力VOCALOID", + "type": 0 + }, + { + "tid": 127, + "reid": 119, + "name": "教程演示", + "type": 0 + } + ] + }, + { + "tid": 155, + "reid": 0, + "name": "时尚", + "uri": "bilibili://region/155", + "type": 0, + "children": [ + { + "tid": 157, + "reid": 155, + "name": "美妆", + "type": 0 + }, + { + "tid": 158, + "reid": 155, + "name": "服饰", + "type": 0 + }, + { + "tid": 159, + "reid": 155, + "name": "资讯", + "type": 0 + }, + { + "tid": 164, + "reid": 155, + "name": "健身", + "type": 0 + } + ] + }, + { + "tid": 165, + "reid": 0, + "name": "广告", + "uri": "bilibili://advertise/home?tid=165", + "type": 1, + "children": [ + { + "tid": 166, + "reid": 165, + "name": "广告", + "type": 0 + } + ] + }, + { + "tid": 5, + "reid": 0, + "name": "娱乐", + "uri": "bilibili://region/5", + "type": 0, + "children": [ + { + "tid": 71, + "reid": 5, + "name": "综艺", + "type": 0 + }, + { + "tid": 137, + "reid": 5, + "name": "明星", + "type": 0 + }, + { + "tid": 131, + "reid": 5, + "name": "Korea相关", + "type": 0 + } + ] + }, + { + "tid": 181, + "reid": 0, + "name": "影视", + "uri": "bilibili://region/181", + "type": 0, + "children": [ + { + "tid": 182, + "reid": 181, + "name": "影视杂谈", + "type": 0 + }, + { + "tid": 183, + "reid": 181, + "name": "影视剪辑", + "type": 0 + }, + { + "tid": 85, + "reid": 181, + "name": "短片", + "type": 0 + }, + { + "tid": 184, + "reid": 181, + "name": "预告·资讯", + "type": 0 + }, + { + "tid": 86, + "reid": 181, + "name": "特摄", + "type": 0 + } + ] + }, + { + "tid": 177, + "reid": 0, + "name": "纪录片", + "uri": "bilibili://region/177", + "type": 0, + "children": [ + { + "tid": 37, + "reid": 177, + "name": "人文历史", + "type": 0 + }, + { + "tid": 178, + "reid": 177, + "name": "科学探索", + "type": 0 + }, + { + "tid": 179, + "reid": 177, + "name": "热血军事", + "type": 0 + }, + { + "tid": 180, + "reid": 177, + "name": "舌尖上的旅行", + "type": 0 + } + ] + }, + { + "tid": 23, + "reid": 0, + "name": "电影", + "uri": "bilibili://region/23", + "type": 0, + "children": [ + { + "tid": 147, + "reid": 23, + "name": "国产电影", + "type": 0 + }, + { + "tid": 145, + "reid": 23, + "name": "欧美电影", + "type": 0 + }, + { + "tid": 146, + "reid": 23, + "name": "日本电影", + "type": 0 + }, + { + "tid": 83, + "reid": 23, + "name": "其他国家", + "type": 0 + } + ] + }, + { + "tid": 11, + "reid": 0, + "name": "电视剧", + "uri": "bilibili://region/11", + "type": 0, + "children": [ + { + "tid": 185, + "reid": 11, + "name": "内地剧", + "type": 0 + }, + { + "tid": 186, + "reid": 11, + "name": "港台剧", + "type": 0 + }, + { + "tid": 187, + "reid": 11, + "name": "海外剧", + "type": 0 + } + ] + } +] \ No newline at end of file diff --git a/web/src/main/webapp/WEB-INF/jsp/form.jsp b/web/src/main/webapp/WEB-INF/jsp/form.jsp new file mode 100644 index 0000000..60c7645 --- /dev/null +++ b/web/src/main/webapp/WEB-INF/jsp/form.jsp @@ -0,0 +1,86 @@ +<%-- + Created by IntelliJ IDEA. + User: 10295 + Date: 2018/5/23 + Time: 0:31 + To change this template use File | Settings | File Templates. +--%> +<%@ page pageEncoding="utf-8" %> + + + + + + + + + + + + +
+ +
+ + + diff --git a/web/src/main/webapp/WEB-INF/jsp/head.jsp b/web/src/main/webapp/WEB-INF/jsp/head.jsp index f581574..63b9a75 100644 --- a/web/src/main/webapp/WEB-INF/jsp/head.jsp +++ b/web/src/main/webapp/WEB-INF/jsp/head.jsp @@ -15,6 +15,7 @@ + WebCrawler diff --git a/web/src/main/webapp/WEB-INF/jsp/table.jsp b/web/src/main/webapp/WEB-INF/jsp/table.jsp index 31a7385..161dc30 100644 --- a/web/src/main/webapp/WEB-INF/jsp/table.jsp +++ b/web/src/main/webapp/WEB-INF/jsp/table.jsp @@ -5,6 +5,8 @@ <%@ page pageEncoding="utf-8" %> + + + + + + - + @@ -57,7 +63,8 @@

-