gongbx
6 months ago
14 changed files with 90 additions and 89 deletions
@ -1,71 +1,53 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.wms.database.eas.dao.mapper.AllocationBillMapper"> |
|||
<select id="allocationPage" resultType="org.nl.wms.database.eas.dto.AllocationBillQuery"> |
|||
WITH ranked_data AS ( |
|||
SELECT |
|||
t.*, |
|||
ROW_NUMBER() OVER (PARTITION BY djbh ORDER BY jhdrrq DESC) AS rn |
|||
FROM |
|||
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t |
|||
), |
|||
grouped_data AS ( |
|||
SELECT * |
|||
<select id="getAllocationCount" resultType="java.lang.Long"> |
|||
WITH ranked_data AS ( SELECT t.*, ROW_NUMBER ( ) OVER ( PARTITION BY djbh ORDER BY CJSJ DESC ) AS rn FROM |
|||
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t ), |
|||
grouped_data AS ( SELECT * FROM ranked_data WHERE rn = 1 ) SELECT |
|||
COUNT( 1 ) |
|||
FROM |
|||
ranked_data |
|||
WHERE |
|||
rn = 1 |
|||
) |
|||
SELECT * |
|||
FROM ( |
|||
SELECT |
|||
temp.*, |
|||
ROWNUM AS row_num |
|||
FROM ( |
|||
SELECT * |
|||
FROM grouped_data |
|||
WHERE |
|||
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data |
|||
<if test="fuzzy != null and fuzzy != ''"> |
|||
WHERE (wlmc LIKE '%' || #{fuzzy} || '%' |
|||
OR djbh LIKE '%' || #{fuzzy} || '%' |
|||
OR wlbm LIKE '%' || #{fuzzy} || '%' |
|||
OR wlmc LIKE '%' || #{fuzzy} || '%' |
|||
OR dckcmc LIKE '%' || #{fuzzy} || '%' |
|||
OR dcckmc LIKE '%' || #{fuzzy} || '%' |
|||
OR drkcmc LIKE '%' || #{fuzzy} || '%' |
|||
) |
|||
</if> |
|||
ORDER BY CJSJ DESC ) temp ) |
|||
</select> |
|||
<select id="allocationPage" resultType="org.nl.wms.database.eas.dto.AllocationBillQuery"> |
|||
WITH ranked_data AS ( SELECT t.*, ROW_NUMBER ( ) OVER ( PARTITION BY djbh ORDER BY CJSJ DESC ) AS rn FROM |
|||
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t ), |
|||
grouped_data AS ( SELECT * FROM ranked_data WHERE rn = 1 ) SELECT * FROM |
|||
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data |
|||
<if test="fuzzy != null and fuzzy != ''"> |
|||
(djbh LIKE '%' || #{fuzzy} || '%' OR |
|||
wlbm LIKE '%' || #{fuzzy} || '%' OR |
|||
wlmc LIKE '%' || #{fuzzy} || '%' OR |
|||
ggxh LIKE '%' || #{fuzzy} || '%' OR |
|||
dckcmc LIKE '%' || #{fuzzy} || '%' OR |
|||
dcckmc LIKE '%' || #{fuzzy} || '%' OR |
|||
drkcmc LIKE '%' || #{fuzzy} || '%' OR) |
|||
WHERE (wlmc LIKE '%' || #{fuzzy} || '%' |
|||
OR djbh LIKE '%' || #{fuzzy} || '%' |
|||
OR wlbm LIKE '%' || #{fuzzy} || '%' |
|||
OR wlmc LIKE '%' || #{fuzzy} || '%' |
|||
OR dckcmc LIKE '%' || #{fuzzy} || '%' |
|||
OR dcckmc LIKE '%' || #{fuzzy} || '%' |
|||
OR drkcmc LIKE '%' || #{fuzzy} || '%' |
|||
) |
|||
</if> |
|||
ORDER BY jhdrrq DESC |
|||
) temp |
|||
WHERE |
|||
<![CDATA[ ROWNUM <= #{size} * #{page} ]]> |
|||
) |
|||
WHERE <![CDATA[ row_num > #{size} * (#{page} - 1) ]]> |
|||
ORDER BY CJSJ DESC ) temp WHERE <![CDATA[ ROWNUM <= #{size} * #{page} ]]>) WHERE |
|||
<![CDATA[ row_num > #{size} * (#{page} - 1) ]]> |
|||
</select> |
|||
|
|||
|
|||
<select id="allocationDetailPage" resultType="org.nl.wms.database.eas.dto.AllocationBillQuery"> |
|||
SELECT * |
|||
FROM EAS_NOBLE.allocation |
|||
WHERE DJBH = #{djbh} |
|||
<!-- <if test="fuzzy != null and fuzzy != ''">--> |
|||
<!-- AND (--> |
|||
<!-- djbh LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR wlmc LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR ggxh LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR fzsl LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR jldw LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR sl LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR kclx LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR kczt LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR dcck LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR dccw LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR drck LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR drcw LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR trackno LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR ywrq LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- OR bz LIKE CONCAT('%', #{fuzzy}, '%')--> |
|||
<!-- )--> |
|||
<!-- </if>--> |
|||
ORDER BY djbh ASC |
|||
SELECT * FROM ( |
|||
SELECT V.*, ROW_NUMBER() OVER (ORDER BY V.CJSJ DESC) AS RNUM |
|||
FROM EAS_NOBLE.V_UC_STOCKTRANSFERBILL V |
|||
WHERE V.DJBH = #{djbh} |
|||
) |
|||
WHERE RNUM BETWEEN (#{page} - 1) * #{size} + 1 AND #{page} * #{size} |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
|||
|
Loading…
Reference in new issue