#!/bin/bash

source head.sh

echo '
    <div class="container mt-5">
        <h1 class="mb-4">科目列表</h1>
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th>科目号</th>
                    <th>科目名</th>
                </tr>
            </thead>
            <tbody>
'
# 尝试从缓存读取
sql="select *from jx_subject"
source cache.sh

for stu in ${stuList[@]}; do
  # 获取学号、姓名、科目、年龄
  id=$(echo $stu | awk -F "@" '{print $1}')
  name=$(echo $stu | awk -F "@" '{print $2}')
  echo "
                  <tr>
                      <td>$id</td>
                      <td>$name</td>
                  </tr>
  "
done
echo '
            </tbody>
        </table>
    </div>
    
    <!-- 引入Bootstrap的JavaScript文件，用于一些表格交互效果 -->
    <script src="/static/js/bootstrap.min.js"></script>
</body>
</html>
'
