SpringMVC+Spring+Mybatis+DWZ(模糊查询)
Mybatis里面:selectfromAUS_USERSwhere1=1andAUS_CARDCODELIKECONCAT(CONCAT('%','#{ausCardc...
Mybatis里面:
select
from AUS_USERS
where 1 = 1
and AUS_CARDCODE LIKE CONCAT(CONCAT('%','#{ausCardcode}','%'))
<if test="ausUsername != null">
and AUS_CARDCODE LIKE CONCAT(CONCAT('%','#{ausUsername}','%') )
</if>
接口:
/** String ausCardcode, String ausUsername
* 根据账号,姓名查询
* @param ausCardcode
* @param ausUsername
* @return
*/
List allUser(Map map);
Controller里面:
@RequestMapping("userInfo")
public String userInfo(HttpServletRequest request,
HttpServletResponse response,Map map) throws IOException {
map.get("ausCardcode");
map.get("ausUsername");
List<AusUsers> ausUser=ausUsersMapper.allUser(map);
request.setAttribute("AusUser", ausUser);
return "system/userInfo";
}
Jsp:
<li>账号:<input type="text" name="ausCardcode" size="10" maxlength="30" /></li>
<li>姓名:<input type="text" name="ausUsername" size="10" maxlength="30" /></li>
</ul>
<input type="submit" name="button" value="查询" class="btn btn-success">
为什么获取不到name="ausCardcode"和 name="ausUsername"这两个参数的值? 展开
select
from AUS_USERS
where 1 = 1
and AUS_CARDCODE LIKE CONCAT(CONCAT('%','#{ausCardcode}','%'))
<if test="ausUsername != null">
and AUS_CARDCODE LIKE CONCAT(CONCAT('%','#{ausUsername}','%') )
</if>
接口:
/** String ausCardcode, String ausUsername
* 根据账号,姓名查询
* @param ausCardcode
* @param ausUsername
* @return
*/
List allUser(Map map);
Controller里面:
@RequestMapping("userInfo")
public String userInfo(HttpServletRequest request,
HttpServletResponse response,Map map) throws IOException {
map.get("ausCardcode");
map.get("ausUsername");
List<AusUsers> ausUser=ausUsersMapper.allUser(map);
request.setAttribute("AusUser", ausUser);
return "system/userInfo";
}
Jsp:
<li>账号:<input type="text" name="ausCardcode" size="10" maxlength="30" /></li>
<li>姓名:<input type="text" name="ausUsername" size="10" maxlength="30" /></li>
</ul>
<input type="submit" name="button" value="查询" class="btn btn-success">
为什么获取不到name="ausCardcode"和 name="ausUsername"这两个参数的值? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询