最常用到的语句是
SELECT * FROM `code_common` order by seq_num limit 2 , 5
这条语句代表的意义是从第三条与开始往后查询5条语句
这是公司用到的分页查询的方式
<!--复用的sql-->
<sql id="cengjiClom">
select
cr.seq_num,cr.record_type,cr.record_date,cr.record_address,cr.record_title,cr.record_content,
cr.record_zjr,cr.record_zjrname,cr.record_thr,cr.record_thrname,cr.record_bthr,cr.record_bthrname,
cr.enclosure_state,cr.non_attendance,cr.attendee,cr.thr_unit,cr.bthr_unit,cr.more_type,cr.theme_edu_fk,
cr.region_code,cr.create_unit,cr.create_user
from buss_cengji_record cr
where cr.del_flag = 0
</sql>
<select id="findListForPage" parameterType="bussCengjiRecordDto" resultMap="bussCengjiRecordDtoResult">
<include refid="cengjiClom"></include>
<if test="recordType != null">and cr.record_type=#{recordType}</if>
<if test="moreType != null">and more_type=#{moreType}</if>
<if test="themeEduFk != null">and theme_edu_fk=#{themeEduFk}</if>
<if test='queryCondition!=null and queryCondition!=""'>
and CONCAT_WS(',',cr.record_thrname,cr.record_address,cr.record_title,cr.record_content) like CONCAT('%',#{queryCondition},'%')
</if>
<if test='startTime!=null'>and cr.record_date >= #{startTime}</if>
<if test='endTime!=null'>and cr.record_date <= #{endTime}</if>
<if test="recordAddress !=null">and cr.record_address=#{recordAddress}</if>
<if test="recordDate !=null">and cr.record_date=#{recordDate}</if>
<if test="recordTitle !=null">and cr.record_title=#{recordTitle}</if>
<if test="recordBthrname !=null and recordBthrname!=''">and cr.record_bthrname like CONCAT(CONCAT('%',#{recordBthrname}),'%')</if>
<if test="recordThrname !=null and recordThrname!=''">and cr.record_thrname like CONCAT(CONCAT('%',#{recordThrname}),'%')</if>
<if test="recordZjrname !=null">and cr.record_zjrname=#{recordZjrname}</if>
<if test="regionCode != null and regionCode !='' ">and cr.region_code = #{regionCode}</if>
<if test="createUnit != null and createUnit !='' ">and cr.create_unit = #{createUnit}</if>
<if test="queryUnitCode != null and queryUnitCode != ''">
and (thr_unit =#{queryUnitCode} or bthr_unit =#{queryUnitCode})
</if>
<if test="cjQuery != null and cjQuery !='' ">and (cr.record_thr in ${cjQuery} or cr.record_bthr in ${cjQuery})</if>
order by cr.record_date DESC limit #{headItem} , #{limit}
</select>