我的table如何实现遍历
报错原因
Expected one result (or null) to be returned by selectOne(), but found: 3
我应该 如何修改
mybatis文件,查询 zdid 字段的所有户数
<select id="chaxungd" resultMap="zd">
select zdid from zdgu
</select>
controller层
@RequestMapping(value = "/chaxungd")
public List chaxungd(){
List<ZongDuan> zongDuanList=zhongDuanService.chaxungd();
return zongDuanList;
}
service层
/**
* 查询所有编号
* @param zdid
* @return
*/
public List<ZongDuan> chaxungd();
impl层
/**
* 查询所有编号
*/
@Override
public List<ZongDuan> chaxungd() {
return zhongDuanDao.chaxungd();
}
dao层
/**
* 查询所有编号
* @param
* @return
*/
public List<ZongDuan> chaxungd();
HTML层
<form action="" onsubmit="return false" method="post" id="bgcha">
<br class="layui-form-item" style="" id="jibenxinxi">
<div class="layui-input-block">
<div style="margin-top: -40px;margin-left: 70px">
<button type="submit" class="layui-btn layui-btn-warm layui-btn-radius"
style="width: 80px;height: 30px;margin-top: 100px" onclick="cha()">
<p style="margin-top: -3px;color: black;font-weight: bold">查询</p></button>
</div>
</div>
</div>
<div id="xianshi">
<table>
??????????????????????????????如何把查询的结果显示到这里?????????????????
</table>
</div>
</form>
</body>
<script src="../jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script>
function cha() {
function cha() {
$.ajax({
type:'post',
url:'/zd/cha',
data:$('#bgcha').serialize(),
success:function (data) {
$('.cx_zdid').val(data.zdid)
}
});
}
</script>
通过ajax获取返回数据,然后循环添加进table的属性,获取一下table的id就好了