课堂作业功能2

接着上次的程序补充:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1" id="tab">
    <tr>
        <td>站点</td>
        <td>线路一</td>
        <td>线路二</td>
        <td>线路三</td>
    </tr>
<tr th:each="station:${station}">
    <td><p th:text="${station.station}"></p></td>
    <td><p th:text="${station.line1}"></p></td>
    <td><p th:text="${station.line2}"></p></td>
    <td><p th:text="${station.line3}"></p></td>
</tr>
</table>
</body>
</html>
    <select id="select4" parameterType="map" resultType="station">
        select * from station
        <where>
            <if test="station !=null">
                and station=#{station}
            </if>
            <if test="line1 !=null">
                and line1=#{line1}
            </if>
            <if test="line2 !=null">
                and line2=#{line2}
            </if>
            <if test="line3 !=null">
                and line3=#{line3}
            </if>
        </where>
    </select>
    public String squerry(Model model){
//        String userId = request.getParameter("line");
        HashMap<String,String> map= new HashMap<>();
        List<Line> station = queryService.select4(map);
        System.out.println(station);
        model.addAttribute("station",station);

        return "./one/station";

 

posted @ 2022-03-27 20:49  无衣123  阅读(15)  评论(0)    收藏  举报