通过后台添加多表查询 <if test="bkglZdrxm != null and bkglZdrxm != ''"> AND b.bkgl_zdrxm = #{bkglZdrxm} </if> <if test="zdrgjXm != null and zdrgjXm != ''"> AND a.zdrgj_xm = #{zdrgjXm} </if> FROM zdrgk_zdrgj a left join zdryk_bkgl b on a.zdrgj_xm = b.bkgl_zdrxm and b.del_flag = #{DEL_FLAG_NORMAL}如何在jeeplus中的前端js中queryParams : function(params) { var searchParam = $("#searchForm").serializeJSON(); searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1; searchParam.pageSize = params.limit === undefined? -1 : params.limit; if(params.sort && params.order){ searchParam.orderBy = params.sort+ " "+ params.order; } return searchParam; }, 添加匹配条件只能匹配数据为zdrgjXm和bkglZdrxm都有相同值的值
时间: 2024-03-11 13:48:52 浏览: 73
学生补考管理
可以在前端的queryParams函数中添加以下代码:
```javascript
searchParam.zdrgjXm = $("#zdrgjXm").val();
searchParam.bkglZdrxm = $("#bkglZdrxm").val();
if (searchParam.zdrgjXm && searchParam.bkglZdrxm && searchParam.zdrgjXm === searchParam.bkglZdrxm) {
searchParam.matchedValue = searchParam.zdrgjXm;
} else {
searchParam.matchedValue = null;
}
```
这里假设页面中有两个输入框,id分别为zdrgjXm和bkglZdrxm,同时将匹配结果存储在matchedValue中。可以根据实际情况修改代码。
然后在后端的SQL语句中添加以下代码:
```sql
<if test="matchedValue != null">
AND a.zdrgj_xm = #{matchedValue}
AND b.bkgl_zdrxm = #{matchedValue}
</if>
```
这样就可以只查询zdrgjXm和bkglZdrxm都有相同值的数据了。
阅读全文