2

我的目标,得到这样的 JSON:

[{text: "Dolor", weight: 9.4},{text: "Sit", weight: 8},{text: "Amet", weight: 6.2}]

我有三个表标签,歌曲和 Songs_Tags:

mysql> SHOW TABLES FROM jmusic;
+-------------------+
| Tables_in_jmusic  |
+-------------------+
| ActivityUsers     |
| Songs             |
| Songs_Tags        |
| Tags              |
| Users             |
| persistent_logins |
+-------------------+

mysql> SHOW COLUMNS FROM Users;
+-------------------+--------------+------+-----+---------+----------------+
| Field             | Type         | Null | Key | Default | Extra          |
+-------------------+--------------+------+-----+---------+----------------+
| idUser            | int(11)      | NO   | PRI | NULL    | auto_increment |
| Name              | varchar(255) | YES  | UNI | NULL    |                |
| Email             | varchar(255) | YES  |     | NULL    |                |
| Password          | varchar(255) | YES  |     | NULL    |                |
| ConfirmationToken | varchar(255) | YES  |     | NULL    |                |
| IsActivatedUser   | tinyint(1)   | NO   |     | 0       |                |
| Role              | int(11)      | NO   |     | 1       |                |
+-------------------+--------------+------+-----+---------+----------------+

mysql> SHOW COLUMNS FROM Tags;
+--------+-------------+------+-----+---------+----------------+
| Field  | Type        | Null | Key | Default | Extra          |
+--------+-------------+------+-----+---------+----------------+
| idTag  | int(11)     | NO   | PRI | NULL    | auto_increment |
| Name   | varchar(45) | NO   | UNI | NULL    |                |
| Usages | int(11)     | YES  |     | 0       |                |
+--------+-------------+------+-----+---------+----------------+

mysql> SHOW COLUMNS FROM Songs_Tags;
+--------------+---------+------+-----+---------+-------+
| Field        | Type    | Null | Key | Default | Extra |
+--------------+---------+------+-----+---------+-------+
| Songs_idSong | int(11) | NO   | PRI | NULL    |       |
| Tags_idTag   | int(11) | NO   | PRI | NULL    |       |
+--------------+---------+------+-----+---------+-------+

如何?

现在我需要做一些事情来获取表单标签的结构:值。我不知道 SQL,也不知道该怎么做。

是的,我的应用程序分为几层:实体 -> DAO -> 服务。

4

0 回答 0