SQL 修改
This commit is contained in:
parent
183106222f
commit
5fd14cf810
|
|
@ -21,15 +21,15 @@
|
||||||
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
||||||
AND po."id" in (${params.orgAll})
|
AND po.ID in (${params.orgAll})
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
||||||
AND po."id" = #{params.orgId}
|
AND po.ID = #{params.orgId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.keyWord != null and params.keyWord != ''">
|
<if test="params.keyWord != null and params.keyWord != ''">
|
||||||
and (
|
and (
|
||||||
t."id_number" = #{params.keyWord} or
|
t."id_number" = #{params.keyWord} or
|
||||||
bp.NAME like concat('%', #{params.keyWord}, '%') or
|
bp."name" like concat('%', #{params.keyWord}, '%') or
|
||||||
sr."name" = #{params.keyWord}
|
sr."name" = #{params.keyWord}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -42,18 +42,18 @@
|
||||||
t."username" AS userName,
|
t."username" AS userName,
|
||||||
t."id_number" AS idNumber,
|
t."id_number" AS idNumber,
|
||||||
t."phone" AS phonenumber,
|
t."phone" AS phonenumber,
|
||||||
CASE
|
CASE
|
||||||
WHEN sr."type" LIKE '%3%' THEN po2."name"
|
WHEN sr."type" LIKE '%3%' THEN po2.NAME
|
||||||
ELSE po.NAME
|
ELSE po.NAME
|
||||||
END AS orgName,
|
END AS orgName,
|
||||||
sr.NAME AS roleName,
|
sr."name" AS roleName,
|
||||||
CASE
|
CASE
|
||||||
WHEN sr."type" LIKE '%3%' THEN bp.NAME
|
WHEN sr."type" LIKE '%3%' THEN bp."name"
|
||||||
WHEN sr."type" LIKE '%4%' THEN bs."sub_NAME"
|
WHEN sr."type" LIKE '%4%' THEN bs."sub_name"
|
||||||
ELSE bp2."name"
|
ELSE bp2."name"
|
||||||
END AS proName,
|
END AS proName,
|
||||||
t."createTime",
|
t."createTime",
|
||||||
t.STATUS,
|
t."status",
|
||||||
t."is_push"
|
t."is_push"
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."sys_user" t
|
"ynrealname"."sys_user" t
|
||||||
|
|
@ -78,15 +78,15 @@
|
||||||
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
and t."phone" like concat('%', #{params.phonenumber}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
||||||
AND po."id" in (${params.orgAll})
|
AND po.ID in (${params.orgAll})
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
||||||
AND po."id" = #{params.orgId}
|
AND po.ID = #{params.orgId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.keyWord != null and params.keyWord != ''">
|
<if test="params.keyWord != null and params.keyWord != ''">
|
||||||
and (
|
and (
|
||||||
t."id_number" = #{params.keyWord} or
|
t."id_number" = #{params.keyWord} or
|
||||||
bp.NAME like concat('%', #{params.keyWord}, '%') or
|
bp."name" like concat('%', #{params.keyWord}, '%') or
|
||||||
sr."name" = #{params.keyWord}
|
sr."name" = #{params.keyWord}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -43,19 +43,19 @@
|
||||||
|
|
||||||
<select id="getCompanyAndSubCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
<select id="getCompanyAndSubCompany" resultType="com.bonus.system.api.domain.SelectBean">
|
||||||
SELECT
|
SELECT
|
||||||
"id",
|
ID,
|
||||||
NAME,
|
NAME,
|
||||||
CASE WHEN "company_id" = "foreign_id" THEN 1 ELSE 2 END as type
|
CASE WHEN "company_id" = "foreign_id" THEN 1 ELSE 2 END as type
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."pm_organization"
|
"ynrealname"."pm_organization"
|
||||||
WHERE
|
WHERE
|
||||||
"is_active" = '1'
|
IS_ACTIVE = '1'
|
||||||
AND "foreign_id" IS NOT NULL
|
AND "foreign_id" IS NOT NULL
|
||||||
<if test="orgId != null and orgId != '' and roleLevel < 3 and roleLevel > 1">
|
<if test="orgId != null and orgId != '' and roleLevel < 3 and roleLevel > 1">
|
||||||
AND INSTR(getParentList(#{orgId}), "id") > 0
|
AND INSTR(ID, getParentList(#{orgId})) > 0
|
||||||
</if>
|
</if>
|
||||||
<if test="orgId != null and orgId != '' and roleLevel >= 3">
|
<if test="orgId != null and orgId != '' and roleLevel >= 3">
|
||||||
AND INSTR(getParentList(#{orgId}), "id") > 0
|
AND INSTR(ID, getParentList(#{orgId})) > 0
|
||||||
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY
|
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue