2013年7月27日星期六

Mybatis parameterType Bean can do a query ?

This post last edited by the yijiulove on 2013-07-23 17:27:27
I am doing a search function , and now the front of the query into a CriteriaForm in ordinary java bean .
Then OrderMapper.xml
add the following paragraph.

<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>


But when the project started to get up , would like to ask , is this approach does not support it ?
------ Solution ------------- -------------------------------
is possible , Myibatis is support for custom Bean , but not parameterType; instead parameterClass
------ For reference only ----------------------------------- ----
ah , multi- use map type parameter , can not be a complex type ...
------ For reference only --------------- ------------------------


That I parameterType = "com.cl.shop.bean.CriteriaForm" changed
parameterClass = "com.cl.shop.bean.CriteriaForm" ?

I try
------ For reference only ------------------------------- --------


can, send out .. Thank you .

没有评论:

发表评论