<!-- 动态查询 一页显示的内容 -->
<select id="selestPageByFactory" parameterType="java.util.Map" resultMap="BaseResultMap">
select * from (
select * from(
select t1.* from(
select rownum rn ,t.FACTORY_ID,t.FULL_NAME,t.FACTORY_NAME,t.CONTACTS ,t.PHONE,t.MOBILE,
t.FAX,t.CNOTE,t.INSPECTOR
from FACTORY_C t where 1=1
<if test="FULL_NAME!=null and FULL_NAME != '' ">
and t.FULL_NAME like concat(concat('%',#{FULL_NAME}),'%')
</if>
<if test="FACTORY_NAME!=null ">
and t.FACTORY_NAME like concat(concat('%',#{FACTORY_NAME}),'%')
</if>
<if test="CONTACTS!=null ">
and t.CONTACTS like concat(concat('%',#{CONTACTS}),'%')
</if>
<if test="PHONE!=null ">
and t.PHONE like concat(concat('%',#{PHONE}),'%')
</if>
<if test="MOBILE!=null ">
and t.MOBILE like concat(concat('%',#{MOBILE}),'%')
</if>
<if test="FAX!=null ">
and t.FAX like concat(concat('%',#{FAX}),'%')
</if>
<if test="CNOTE!=null">
and t.CNOTE like concat(concat('%',#{CNOTE}),'%')
</if>
order by t.factory_id desc
) t1 where t1.rn <![CDATA[>=]]> #{start}
) t2 where t2.rn <![CDATA[<=]]> #{end}
) t3
</select>
<!-- 查询总条数 -->
<select id="selectPageCount" parameterType="java.util.Map" resultType="java.lang.Integer" >
select count(cc.FACTORY_ID) from FACTORY_C cc where 1=1
<if test="FULL_NAME!=null ">
and cc.FULL_NAME like '%'||#{FULL_NAME}||'%'
</if>
<if test="FACTORY_NAME!=null ">
and cc.FACTORY_NAME like '%'||#{FACTORY_NAME}||'%'
</if>
<if test="CONTACTS!=null ">
and cc.CONTACTS like '%'||#{CONTACTS}||'%'
</if>
<if test="PHONE!=null ">
and cc.PHONE like '%'||#{PHONE}||'%'
</if>
<if test="MOBILE!=null ">
and cc.MOBILE like '%'||#{MOBILE}||'%'
</if>
<if test="FAX!=null ">
and cc.FAX like '%'||#{FAX}||'%'
</if>
<if test="CNOTE!=null">
and cc.CNOTE like '%'||#{CNOTE}||'%'
</if>
</select>