forked from dyf/fys-Multi-tenant
查询所有客户
This commit is contained in:
@ -39,8 +39,8 @@ public class EncryptUtilsTest {
|
|||||||
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
loginBody.setClientId("e5cd7e4891bf95d1d19206ce24a7b32e");
|
||||||
loginBody.setGrantType("password");
|
loginBody.setGrantType("password");
|
||||||
loginBody.setTenantId("894078");
|
loginBody.setTenantId("894078");
|
||||||
loginBody.setCode("21");
|
loginBody.setCode("9");
|
||||||
loginBody.setUuid("39785885a3ef42d59501502848cd1dcb");
|
loginBody.setUuid("64d5a9107e4949f3ba8f57ede00bd034");
|
||||||
// loginBody.setUsername("admin");
|
// loginBody.setUsername("admin");
|
||||||
// loginBody.setPassword("admin123");
|
// loginBody.setPassword("admin123");
|
||||||
loginBody.setUsername("dyf");
|
loginBody.setUsername("dyf");
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<resultMap id="BaseResultMap" type="com.fuyuanshen.fyscustomer.domain.Customer">
|
<resultMap id="BaseResultMap" type="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
<id column="user_user_id" property="userId"/>
|
<id column="user_user_id" property="userId"/>
|
||||||
<result column="user_dept_id" property="deptId"/>
|
<result column="user_dept_id" property="deptId"/>
|
||||||
<result column="user_username" property="userName"/>
|
<result column="user_user_name" property="userName"/>
|
||||||
<result column="user_nick_name" property="nickName"/>
|
<result column="user_nick_name" property="nickName"/>
|
||||||
<result column="user_email" property="email"/>
|
<result column="user_email" property="email"/>
|
||||||
<result column="user_pid" property="pid"/>
|
<result column="user_pid" property="pid"/>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
.
|
.
|
||||||
user_user_id
|
user_user_id
|
||||||
AS user_user_id,
|
AS user_user_id,
|
||||||
u.username,
|
u.user_name,
|
||||||
u.nick_name AS nickName,
|
u.nick_name AS nickName,
|
||||||
u.email,
|
u.email,
|
||||||
u.phone,
|
u.phone,
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
u1.user_id
|
u1.user_id
|
||||||
as user_user_id, u1.dept_id as user_dept_id, u1.username as user_username,
|
as user_user_id, u1.dept_id as user_dept_id, u1.user_name as user_user_name,
|
||||||
u1.nick_name as user_nick_name, u1.email as user_email, u1.phone as user_phone,
|
u1.nick_name as user_nick_name, u1.email as user_email, u1.phone as user_phone,
|
||||||
u1.gender as user_gender, u1.avatar_name as user_avatar_name, u1.avatar_path as user_avatar_path,
|
u1.gender as user_gender, u1.avatar_name as user_avatar_name, u1.avatar_path as user_avatar_path,
|
||||||
u1.enabled as user_enabled, u1.pwd_reset_time as user_pwd_reset_time, u1.create_by as user_create_by,
|
u1.enabled as user_enabled, u1.pwd_reset_time as user_pwd_reset_time, u1.create_by as user_create_by,
|
||||||
@ -73,7 +73,7 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="criteria.blurry != null and criteria.blurry != ''">
|
<if test="criteria.blurry != null and criteria.blurry != ''">
|
||||||
and (
|
and (
|
||||||
u1.username like concat('%', #{criteria.blurry}, '%')
|
u1.user_name like concat('%', #{criteria.blurry}, '%')
|
||||||
or u1.nick_name like concat('%', #{criteria.blurry}, '%')
|
or u1.nick_name like concat('%', #{criteria.blurry}, '%')
|
||||||
or u1.email like concat('%', #{criteria.blurry}, '%')
|
or u1.email like concat('%', #{criteria.blurry}, '%')
|
||||||
)
|
)
|
||||||
@ -133,8 +133,8 @@
|
|||||||
<if test="userQuery.nickName != null">
|
<if test="userQuery.nickName != null">
|
||||||
AND u.nick_name = #{userQuery.nickName}
|
AND u.nick_name = #{userQuery.nickName}
|
||||||
</if>
|
</if>
|
||||||
<if test="userQuery.username != null">
|
<if test="userQuery.user_name != null">
|
||||||
AND u.username = #{userQuery.username}
|
AND u.user_name = #{userQuery.user_name}
|
||||||
</if>
|
</if>
|
||||||
<if test="userQuery.password != null">
|
<if test="userQuery.password != null">
|
||||||
AND u.password = #{userQuery.password}
|
AND u.password = #{userQuery.password}
|
||||||
@ -164,7 +164,7 @@
|
|||||||
<!-- 分页查询客户 -->
|
<!-- 分页查询客户 -->
|
||||||
<select id="findCustomers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findCustomers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
select
|
select
|
||||||
u.user_id as id, u.nick_name , u.username, u.enabled, u.create_time
|
u.user_id as id, u.nick_name , u.user_name, u.enabled, u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
<where>
|
<where>
|
||||||
<if test="criteria.ids != null and !criteria.ids.isEmpty()">
|
<if test="criteria.ids != null and !criteria.ids.isEmpty()">
|
||||||
@ -216,7 +216,7 @@
|
|||||||
<select id="queryAllCustomers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="queryAllCustomers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
select u.user_id as id,
|
select u.user_id as id,
|
||||||
u.nick_name,
|
u.nick_name,
|
||||||
u.username,
|
u.user_name,
|
||||||
u.enabled,
|
u.enabled,
|
||||||
u.create_time
|
u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
@ -231,13 +231,13 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findByUsername" resultMap="BaseResultMap">
|
<select id="findByuser_name" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
u1.password user_password, u1.is_admin user_is_admin, u1.tenant_id,
|
u1.password user_password, u1.is_admin user_is_admin, u1.tenant_id,
|
||||||
<include refid="Base_Column_List"/>
|
<include refid="Base_Column_List"/>
|
||||||
from sys_user u1
|
from sys_user u1
|
||||||
left join sys_dept d on u1.dept_id = d.dept_id
|
left join sys_dept d on u1.dept_id = d.dept_id
|
||||||
where u1.username = #{username}
|
where u1.user_name = #{user_name}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
@ -252,19 +252,19 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="findByEmail" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findByEmail" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
select user_id as id, username
|
select user_id as id, user_name
|
||||||
from sys_user
|
from sys_user
|
||||||
where email = #{email}
|
where email = #{email}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findByPhone" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findByPhone" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
select user_id as id, username
|
select user_id as id, user_name
|
||||||
from sys_user
|
from sys_user
|
||||||
where phone = #{phone}
|
where phone = #{phone}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findByRoleId" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findByRoleId" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
SELECT u.user_id as id, u.username
|
SELECT u.user_id as id, u.user_name
|
||||||
FROM sys_user u,
|
FROM sys_user u,
|
||||||
sys_users_roles r
|
sys_users_roles r
|
||||||
WHERE u.user_id = r.user_id
|
WHERE u.user_id = r.user_id
|
||||||
@ -284,7 +284,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findByMenuId" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findByMenuId" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
SELECT u.user_id as id, u.username
|
SELECT u.user_id as id, u.user_name
|
||||||
FROM sys_user u,
|
FROM sys_user u,
|
||||||
sys_users_roles ur,
|
sys_users_roles ur,
|
||||||
sys_roles_menus rm
|
sys_roles_menus rm
|
||||||
@ -331,7 +331,7 @@
|
|||||||
<select id="getSubUsers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="getSubUsers" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
SELECT u.user_id AS id,
|
SELECT u.user_id AS id,
|
||||||
u.nick_name,
|
u.nick_name,
|
||||||
u.username,
|
u.user_name,
|
||||||
u.enabled,
|
u.enabled,
|
||||||
u.create_time
|
u.create_time
|
||||||
FROM sys_user u
|
FROM sys_user u
|
||||||
@ -343,14 +343,14 @@
|
|||||||
<select id="findUserTree1" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findUserTree1" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
WITH RECURSIVE UserTree AS (
|
WITH RECURSIVE UserTree AS (
|
||||||
-- 初始查询:查找指定用户自己
|
-- 初始查询:查找指定用户自己
|
||||||
SELECT user_id AS id, username, pid
|
SELECT user_id AS id, user_name, pid
|
||||||
FROM sys_user
|
FROM sys_user
|
||||||
WHERE user_id = #{currentUserId} -- 替换为你要查询的用户ID
|
WHERE user_id = #{currentUserId} -- 替换为你要查询的用户ID
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
-- 递归部分:查找所有子节点
|
-- 递归部分:查找所有子节点
|
||||||
SELECT u.user_id AS id, u.username, u.pid
|
SELECT u.user_id AS id, u.user_name, u.pid
|
||||||
FROM sys_user u
|
FROM sys_user u
|
||||||
INNER JOIN UserTree ut ON u.pid = ut.id)
|
INNER JOIN UserTree ut ON u.pid = ut.id)
|
||||||
SELECT *
|
SELECT *
|
||||||
@ -361,14 +361,14 @@
|
|||||||
<select id="findUserTree" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findUserTree" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
WITH RECURSIVE UserTree AS (
|
WITH RECURSIVE UserTree AS (
|
||||||
-- 初始查询:查找当前用户的直接子节点
|
-- 初始查询:查找当前用户的直接子节点
|
||||||
SELECT user_id AS id, username, pid
|
SELECT user_id AS id, user_name, pid
|
||||||
FROM sys_user
|
FROM sys_user
|
||||||
WHERE pid = #{currentUserId} -- 当前用户的子节点
|
WHERE pid = #{currentUserId} -- 当前用户的子节点
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
-- 递归部分:查找所有后代节点
|
-- 递归部分:查找所有后代节点
|
||||||
SELECT u.user_id AS id, u.username, u.pid
|
SELECT u.user_id AS id, u.user_name, u.pid
|
||||||
FROM sys_user u
|
FROM sys_user u
|
||||||
INNER JOIN UserTree ut ON u.pid = ut.id)
|
INNER JOIN UserTree ut ON u.pid = ut.id)
|
||||||
SELECT *
|
SELECT *
|
||||||
@ -378,7 +378,7 @@
|
|||||||
|
|
||||||
<select id="findCustomers1" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
<select id="findCustomers1" resultType="com.fuyuanshen.fyscustomer.domain.Customer">
|
||||||
select
|
select
|
||||||
u.user_id as id, u.nick_name , u.username, u.enabled, u.create_time,
|
u.user_id as id, u.nick_name , u.user_name, u.enabled, u.create_time,
|
||||||
u.pid -- 确保包含 pid 字段
|
u.pid -- 确保包含 pid 字段
|
||||||
from sys_user u
|
from sys_user u
|
||||||
<where>
|
<where>
|
||||||
|
Reference in New Issue
Block a user