日期:2014-05-18 浏览次数:20721 次
<select id="getPersonsByName" resultClass="com.unmi.Person"> select id as id,name as name,passwd as passwd from person <dynamic prepend="WHERE"> <isNotNull prepend="AND" property="name"> (name like #name#) </isNotNull> </dynamic> </select>
------解决方案--------------------
<!-- find user list page --> <select id="find-count-of-users" parameterClass="User" resultClass="int"> select count(*) from t_user <dynamic prepend="where"> <isNotEqual property="type" compareValue="-1" prepend="AND"> user_type = #type# </isNotEqual> <isNotEmpty property="userName" prepend="and"> user_name like '%$userName$%' </isNotEmpty> <isNotEqual property="state" compareValue="3" prepend="AND"> user_state = #state# </isNotEqual> <isNotEqual property="usedSpaceSize" compareValue="-1" prepend="AND"> user_used_space_size >= #usedSpaceSize# </isNotEqual> </dynamic> </select>