分页查询客户

This commit is contained in:
2025-07-03 10:08:09 +08:00
parent fe6de8f5bc
commit abe9dc2fe8
13 changed files with 305 additions and 4 deletions

View File

@ -91,6 +91,64 @@
</sql>
<!-- 分页查询客户 -->
<select id="findCustomers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
select
u.user_id as id, u.nick_name , u.username, u.enabled, u.create_time
from sys_user u
<where>
<if test="criteria.ids != null and !criteria.ids.isEmpty()">
and u.pid IN
<foreach item="item" collection="criteria.ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="criteria.pid != null">
and u.pid = #{criteria.pid}
</if>
<if test="criteria.blurry != null and criteria.blurry.trim() != ''">
and u.nick_name like concat('%', TRIM(#{criteria.blurry}), '%')
</if>
<if test="criteria.enabled != null">
and u.enabled = #{criteria.enabled}
</if>
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
and u.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
</if>
</where>
order by u.user_id desc
<if test="criteria.offset != null">
limit #{criteria.offset}, #{criteria.size}
</if>
</select>
<!-- 获取分页总数 -->
<select id="countCustomers" resultType="java.lang.Long">
select count(*)
from sys_user u
<where>
<if test="criteria.ids != null and !criteria.ids.isEmpty()">
and u.pid IN
<foreach item="item" collection="criteria.ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="criteria.pid != null">
and u.pid = #{criteria.pid}
</if>
<if test="criteria.blurry != null and criteria.blurry.trim() != ''">
and u.nick_name like concat('%', TRIM(#{criteria.blurry}), '%')
</if>
<if test="criteria.enabled != null">
and u.enabled = #{criteria.enabled}
</if>
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
and u.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
</if>
</where>
</select>
<!-- 查询所有客户 -->
<select id="queryAllCustomers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
select u.user_id as customerId,
@ -127,5 +185,20 @@
</where>
</select>
<!-- 根据id查询客户 -->
<select id="queryCustomerById" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
select u.*
from sys_user u
<where>
<if test="customerId!= null">
and u.user_id = customerId)
</if>
<if test="pid != null">
and u.pid = pid)
</if>
</where>
</select>
</mapper>