<select id="select_label" resultMap="XykLabelRecords"
parameterClass="java.util.HashMap">
<![CDATA[select * from (select * from xyk_label_records where customer_number=-sharpcustomer_number-sharp and is_stick =1]]>
union all
select * from xyk_label_records where customer_number=-sharpcustomer_number-sharp and is_stick =0
<dynamic prepend=" and ">
<isNotEmpty prepend=" and " property="small">
<![CDATA[create_time > -sharpsmall-sharp]]>
</isNotEmpty>
<isNotEmpty prepend=" and " property="large">
<![CDATA[create_time < -sharplarge-sharp]]>
</isNotEmpty>
</dynamic>
) a order by a.is_stick desc,a.create_time desc
</select>
<select id="select_label_count" resultClass="java.lang.String"
parameterClass="java.util.HashMap">
<![CDATA[select count(*) as count from(select * from (select * from xyk_label_records where customer_number=-sharpcustomer_number-sharp and is_stick =1]]>
union all
select * from xyk_label_records where customer_number=-sharpcustomer_number-sharp and is_stick =0
<dynamic prepend=" and ">
<isNotEmpty prepend=" and " property="small">
<![CDATA[create_time > -sharpsmall-sharp]]>
</isNotEmpty>
<isNotEmpty prepend=" and " property="large">
<![CDATA[create_time < -sharplarge-sharp]]>
</isNotEmpty>
</dynamic>
) a order by a.is_stick desc,a.create_time desc
</select>