<select id="selectListByCondition1" resultType="com.spr.web.system.dto.group.GroupDTO" parameterType="hashmap">
select * from(
select row_number() OVER (ORDER BY ${sidx} ${sord}) AS rno ,
id AS id,
sort_no AS sortNo,
group_name AS groupName,
note AS note,
status AS status,
flag AS flag,
user_id AS userId,
company_id AS companyId,
create_by AS createBy,
update_by AS updateBy,
gmt_create AS gmtCreate,
gmt_modified AS gmtModified
from (
select *
from c_group
<where>
<if test="userId!=null">
AND user_id=#{userId}
</if>
<if test="groupName!=null">
AND group_name=#{groupName}
</if>
AND status=0
</where>
union
select *
from c_group
<where>
<if test="groupName!=null">
AND group_name=#{groupName}
</if>
AND status=1
</where>
)t
)n
<if test="startQuery!=null and endQuery!=null">
WHERE n.rno>#{startQuery} AND n.rno<=#{endQuery}
</if>
</select>
查询条件根据自己的需求更改
记得修改对应的查询总数的方法