Browse Source

fix: SQL注入异常调整

chenjianhua 2 months ago
parent
commit
efb0c19562

+ 2 - 2
service-base/src/main/resources/mapper/DeletionInfoMapper.xml

@@ -128,8 +128,8 @@
             and ddn.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
         </if>
         <choose>
-            <when test="sort != null and sort !='' and sort=='lastDeletionDate' and order != null and order !=''">
-                order by d.last_deletion_date #{order}
+            <when test="sort != null and  sort=='lastDeletionDate' and order != null and order =='asc'">
+                order by d.last_deletion_date asc
             </when>
             <otherwise>
                 order by d.last_deletion_date desc

+ 2 - 2
service-base/src/main/resources/mapper/DistributionMapper.xml

@@ -90,8 +90,8 @@
             and d.distribute_date <![CDATA[ <= ]]> #{endDate}
         </if>
         <choose>
-            <when test="sort != null and sort !='' and sort=='distributeDate' and order != null and order !=''">
-                order by d.distribute_date #{order}
+            <when test="sort != null and sort !='' and sort=='distributeDate' and order != null and order =='asc'">
+                order by d.distribute_date asc
             </when>
             <otherwise>
                 order by d.distribute_date desc

+ 2 - 2
service-base/src/main/resources/mapper/EmailFundAssetMapper.xml

@@ -101,8 +101,8 @@
             </foreach>
         </if>
         <choose>
-            <when test="sort != null and sort !='' and sort=='priceDate' and order != null and order !=''">
-                order by asset.price_date #{order}
+            <when test="sort != null  and sort=='priceDate' and order != null and order =='asc'">
+                order by asset.price_date asc
             </when>
             <otherwise>
                 order by asset.price_date desc

+ 2 - 2
service-base/src/main/resources/mapper/EmailFundNavMapper.xml

@@ -105,8 +105,8 @@
             and parse.id =#{emailId}
         </if>
         <choose>
-            <when test="sort != null and sort !='' and sort=='priceDate' and order != null and order !=''">
-                order by nav.price_date #{order}
+            <when test="sort != null and sort=='priceDate' and order != null and order =='asc'">
+                order by nav.price_date asc
             </when>
             <otherwise>
                 order by nav.price_date desc

+ 7 - 4
service-base/src/main/resources/mapper/EmailParseInfoMapper.xml

@@ -93,11 +93,14 @@
         <include refid="selectEmailParse"/>
         <include refid="sqlwhereSearch"/>
         <choose>
-            <when test="sort != null and sort !='' and sort=='parseDate' and order != null and order !=''">
-                order by epi.parse_date #{order}
+            <when test="sort != null and sort=='parseDate' and order != null and order =='asc'">
+                order by epi.parse_date asc
             </when>
-            <when test="sort != null and sort !='' and sort=='emailDate'  and order != null and order !=''">
-                order by epi.email_date #{order}
+            <when test="sort != null  and sort=='emailDate'  and order != null and order =='asc'">
+                order by epi.email_date asc
+            </when>
+            <when test="sort != null  and sort=='emailDate'  and order != null and order =='desc'">
+                order by epi.email_date desc
             </when>
             <otherwise>
                 order by epi.parse_date desc

+ 2 - 2
service-base/src/main/resources/mapper/FundAliasMapper.xml

@@ -120,13 +120,13 @@
             and alias.target_fund_id is not null
         </if>
         <choose>
-            <when test="sort != null and sort !='' and sort=='priceDate' and order != null and order !=''">
+            <when test="sort != null  and sort=='priceDate' and order != null and order =='asc'">
                 order by
                 CASE
                     WHEN a.last_price_date IS NULL THEN 1
                 ELSE 0
                 END,
-                a.last_price_date #{order}
+                a.last_price_date asc
             </when>
             <otherwise>
                 order by a.last_price_date desc

+ 20 - 4
service-base/src/main/resources/mapper/FundInfoMapper.xml

@@ -90,21 +90,37 @@
             and f.inception_date <![CDATA[ <= ]]> #{endDate}
         </if>) a
         <choose>
-            <when test="sort != null and sort !='' and sort=='lastPriceDate' and order != null and order !=''">
+            <when test="sort != null and sort=='lastPriceDate' and order != null and order =='asc'">
                 order by
                 CASE
                     WHEN a.lastPriceDate IS NULL THEN 1
                 ELSE 0
                 END,
-                a.lastPriceDate #{order}
+                a.lastPriceDate asc
             </when>
-            <when test="sort != null and sort !='' and sort=='firstPriceDate' and order != null and order !=''">
+            <when test="sort != null and sort=='lastPriceDate' and order != null and order =='desc'">
+                order by
+                CASE
+                WHEN a.lastPriceDate IS NULL THEN 1
+                ELSE 0
+                END,
+                a.lastPriceDate desc
+            </when>
+            <when test="sort != null and sort !='' and sort=='firstPriceDate' and order != null and order =='asc'">
+                order by
+                CASE
+                WHEN a.firstPriceDate IS NULL THEN 1
+                ELSE 0
+                END,
+                a.firstPriceDate asc
+            </when>
+            <when test="sort != null and sort !='' and sort=='firstPriceDate' and order != null and order =='desc'">
                 order by
                 CASE
                 WHEN a.firstPriceDate IS NULL THEN 1
                 ELSE 0
                 END,
-                a.firstPriceDate #{order}
+                a.firstPriceDate desc
             </when>
             <otherwise>
                 order by a.lastPriceDate desc

+ 2 - 2
service-base/src/main/resources/mapper/FundNavAssetMapper.xml

@@ -50,8 +50,8 @@
             and (nav.updatetime <![CDATA[ <= ]]> #{updateEndDate} or asset.updatetime <![CDATA[ <= ]]> #{updateEndDate})
         </if>
         <choose>
-            <when test="sort != null and sort !='' and sort=='priceDate' and order != null and order !=''">
-                order by price_date #{order}
+            <when test="sort != null  and sort=='priceDate' and order != null and order =='asc'">
+                order by price_date asc
             </when>
             <otherwise>
                 order by price_date desc