Mybatis parameterType 为查询Bean可以吗?
本帖最后由 yijiulove 于 2013-07-23 17:27:27 编辑 我在做一个查询的功能,现在把前台的查询条件放到一个CriteriaForm 普通java bean中.
然后在OrderMapper.xml
增加下面的一段.
<search id="searchOrdersByCriteria" resultMap="orderResultMap"
parameterType= "com.cl.shop.bean.CriteriaForm">
select * from clshop.cl_order where 1=1
<if test="custName != null and custName != '' ">
and cust_code = #{custCode}
</if>
<if test="status != null and status != '' ">
and status = #{status}
</if>
</search>