我想从 Z SQL 方法结果生成一个 json 并将其放入页面模板 javascript 部分中的 json 中。这是我需要的格式。
[
{
name: 'New',
data: [
{y: 0, user_id: 0, issue_status_id: 1},{y: 0, user_id: 5, issue_status_id: 1},{y: 0, user_id: 11, issue_status_id: 1},{y: 0, user_id: 4, issue_status_id: 1},{y: 0, user_id: 6, issue_status_id: 1},{y: 1, user_id: 14, issue_status_id: 1},{y: 0, user_id: 17, issue_status_id: 1},
]
},
{
name: 'In Progress',
data: [
{y: 0, user_id: 0, issue_status_id: 2},{y: 0, user_id: 5, issue_status_id: 2},{y: 0, user_id: 11, issue_status_id: 2},{y: 0, user_id: 4, issue_status_id: 2},{y: 0, user_id: 6, issue_status_id: 2},{y: 0, user_id: 14, issue_status_id: 2},{y: 1, user_id: 17, issue_status_id: 2},
]
},
]
我按“名称”分组。示例数据
assigned_to_id assigned_name id name totalssignedbystatus
4 K 1 New 0
11 G 1 New 0
18 V 1 New 0
我找不到任何正常的例子......