springmvc 数据库信息展示

数据信息:
在这里插入图片描述
在这里插入图片描述
mybatis:

<resultMap id="exhibitionAllATT" type="com.cloudmuseum.pojo.ExhibitionAllATT">
    <id column="ex_id" property="exId" jdbcType="INTEGER" />
    <result column="ex_name" property="exName" jdbcType="VARCHAR" />
    <result column="ex_status" property="exStatus" jdbcType="VARCHAR" />
    <result column="c_id1" property="cId1" jdbcType="VARCHAR" />
    <result column="c_id2" property="cId2" jdbcType="VARCHAR" />
    <result column="c_id3" property="cId3" jdbcType="VARCHAR" />
    <result column="sort_order" property="sortOrder" jdbcType="VARCHAR" />
    <result column="typee" property="typee" jdbcType="VARCHAR" />
    <result column="ex_size" property="exSize" jdbcType="VARCHAR" />
    <result column="ex_desc" property="exDesc" jdbcType="VARCHAR" />
    <result column="ex_point" property="exPoint" jdbcType="VARCHAR" />
    <result column="period" property="period" jdbcType="VARCHAR" />
    <result column="author" property="author" jdbcType="VARCHAR" />
    <result column="author_sex" property="authorSex" jdbcType="VARCHAR" />
  </resultMap>

  <select id="getExhibitionAllATT" resultMap="exhibitionAllATT">
    SELECT e.ex_id, e.ex_name, e.ex_status, e.c_id1, e.c_id2, e.c_id3, e.sort_order, e.typee, e.ex_size, ed.ex_desc, ed.ex_point, ed.period, ed.author, ed.author_sex
    FROM exhibition AS e LEFT JOIN ex_desc AS ed
    ON e.`ex_id` = ed.`ex_id`
  </select>

service:

	@Override
    public List<ExhibitionAllATT> getAllExhibition() {
        List<ExhibitionAllATT> exhibitionAllATT = exhibitionMapper.getExhibitionAllATT();
        /*for (ExhibitionAllATT e:
                exhibitionAllATT) {
            System.out.println(e);
        }*/
        return exhibitionAllATT;
    }

Controller:

    @RequestMapping(value="/managementExhibition")
    public String showManagementExhibition(Map<String, Object> map){
        map.put("exlist",exhibitionService.getAllExhibition());
        return "exhibition";
    }

jsp:

<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <!-- 顶层 -->
            <div class="card-header fix-card">
                <div class="row">
                    <div class="col-8">
                        <h4 class="card-title"> 查询展品 </h4>
                    </div>
                </div>
            </div>
            <!-- 搜索+展示 -->
            <div class="card-body">
                <div class="table-responsive">
                    <table id="example1" class="display nowrap">
                        <thead>
                        <tr>
                            <th></th>
                            <th>展品名称</th>
                            <th>展品状态</th>
                            <th>展品次序</th>
                            <th>展品类型1</th>
                            <th>展品类型2</th>
                            <th>展品类型3</th>
                            <th>展品年代</th>
                            <th>展品属性</th>
                            <th>文件尺寸</th>
                            <th>作者</th>
                            <th>作者性别</th>
                            <th>特点</th>
                            <th>详细内容</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${exlist}" var="exlist">
                            <tr>
                                <td>${exlist.exId}</td>
                                <td>${exlist.exName}</td>
                                <td>${exlist.exStatus}</td>
                                <td>${exlist.sortOrder}</td>
                                <td>${exlist.cId1}</td>
                                <td>${exlist.cId2}</td>
                                <td>${exlist.cId3}</td>
                                <td>${exlist.period}</td>
                                <td>${exlist.typee}</td>
                                <td>${exlist.exSize}</td>
                                <td>${exlist.author}</td>
                                <td>${exlist.authorSex}</td>
                                <td>${exlist.exPoint}</td>
                                <td>${exlist.exDesc}</td>
                                <td>
                                    <a class='mr-4 vue'>
                                        <span class='fa fa-eye' aria-hidden='true'></span>
                                    </a>
                                    <a data-bs-toggle='modal' data-bs-target='#modal-edit' class='mr-4'>
                                        <span class='fas fa-pencil-alt'></span>
                                    </a>
                                    <a class='mr-4 delet'>
                                        <span class='fas fa-trash-alt'></span>
                                    </a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

实现逻辑:
使用到spring+springmvc+mybatis
先将二表数据合并成一个POJO后使用Map进行前后端数据传输

当点击打开页面时,进入到controller,获取数据库数据跳转到对应页面并传回数据进行展示。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值