ibatis分页查询(2)

<!-- 分页查询 -->
	<select id="findByPage" parameterClass="page" resultClass="user">
		<![CDATA[
			SELECT id,userName,passWord,emplNo,emplName,phoneNum,email,deptName,dutyName,remark,companyName,state FROM (SELECT a.*,ROWNUM nm
			FROM (SELECT u.id, u.username, u.passWord, u.emplname, u.emplno, u.companyname,u.phoneNum,
                   u.deptname, u.dutyname,u.remark, u.email,l.state
                  FROM PO_USER u LEFT JOIN PO_logout l ON u.id =l.userid
				WHERE (
					('$objCondition$' is null or upper(u.userName) LIKE upper('%$objCondition$%'))
					OR('$objCondition$' is null or upper(u.phoneNum) LIKE upper('%$objCondition$%'))
					OR('$objCondition$' is null or upper(u.email) LIKE upper('%$objCondition$%'))
					OR('$objCondition$' is null or upper(u.companyName) LIKE upper('%$objCondition$%'))
					OR('$objCondition$' is null or upper(u.deptName) LIKE upper('%$objCondition$%'))
					OR('$objCondition$' is null or upper(u.dutyName) LIKE upper('%$objCondition$%')))
					ORDER BY id DESC) a
                    WHERE ($start$=0 OR ROWNUM <= DECODE ($start$, 1, $limit$, $start$ + $limit$ - 1)))
          WHERE ($start$=0 OR nm >= $start$)
		]]>
	</select>
	<select id="findByCount" parameterClass="page" resultClass="int">
		<![CDATA[
		SELECT COUNT(*) FROM PO_USER
		WHERE (
				('$objCondition$' is null or upper(userName) LIKE upper('%$objCondition$%'))
				OR('$objCondition$' is null or upper(phoneNum) LIKE upper('%$objCondition$%'))
				OR('$objCondition$' is null or upper(email) LIKE upper('%$objCondition$%'))
				OR('$objCondition$' is null or upper(companyName) LIKE upper('%$objCondition$%'))
				OR('$objCondition$' is null or upper(deptName) LIKE upper('%$objCondition$%'))
				OR('$objCondition$' is null or upper(dutyName) LIKE upper('%$objCondition$%')))
		]]>
	</select>

 

posted @ 2011-08-02 10:09  上善¤若水  阅读(133)  评论(0编辑  收藏  举报