This commit is contained in:
linfso 2024-06-05 18:02:29 +08:00
parent e60312c83e
commit c3dfa328fe
2 changed files with 18 additions and 37 deletions

View File

@ -262,25 +262,14 @@
</if>
<if test="params.isPrivQuery != null and params.isPrivQuery == 'T'">
and (
scan_site_code in (
SELECT
site_code
FROM (
SELECT
t1.site_code,
t1.parent_site_code,
IF( FIND_IN_SET( parent_site_code, @pids ) > 0, @pids := concat( @pids, ',', site_code ), 0 ) AS child_path
FROM
( SELECT site_code, parent_site_code FROM emis_site t WHERE del_flag = '0' ORDER BY site_code, parent_site_code ) t1,
( SELECT @pids := #{params.privSiteCode} ) t2
) t3
WHERE child_path > 0
UNION
SELECT #{params.privSiteCode} FROM DUAL
)
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and scan_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
</if>

View File

@ -402,7 +402,7 @@
<if test="registerDate != null "> and register_date = #{registerDate}</if>
<if test="registerManCode != null and registerManCode != ''"> and register_man_code like concat('%', #{registerManCode}, '%')</if>
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and take_piece_employee_code like concat('%', #{takePieceEmployeeCode}, '%')</if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and send_site_code like concat('%', #{sendSiteCode}, '%')</if>
<if test="sendSiteCode != null and sendSiteCode != ''"> and send_site_code=#{sendSiteCode}</if>
<if test="sendDate != null "> and send_date = #{sendDate}</if>
<if test="dispatchManCode != null and dispatchManCode != ''"> and dispatch_man_code like concat('%', #{dispatchManCode}, '%')</if>
<if test="dispatchDate != null and dispatchDate != ''"> and dispatch_date like concat('%', #{dispatchDate}, '%')</if>
@ -471,24 +471,16 @@
</if>
<if test="params.privSiteCode != null">
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
send_site_code in (
SELECT
site_code
FROM (
SELECT
t1.site_code,
t1.parent_site_code,
IF( FIND_IN_SET( parent_site_code, @pids ) > 0, @pids := concat( @pids, ',', site_code ), 0 ) AS child_path
FROM
( SELECT site_code, parent_site_code FROM emis_site t WHERE del_flag = '0' ORDER BY site_code, parent_site_code ) t1,
( SELECT @pids := #{params.privSiteCode} ) t2
) t3
WHERE child_path > 0
UNION
SELECT #{params.privSiteCode} FROM DUAL
)
send_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or salesmen=#{params.privEmpCode}
or payee=#{params.privEmpName}