Răsfoiți Sursa

fix(trans): 敏感日期交易明细按当前对象过滤

- 明细接口改传 personNames(后端只认列表字段),修复明细混入其他对象数据
- 空对手/空卡号分别用「未知对手」「未知卡号」精确匹配 NULL
- Mapper 兼容 personName 单值,未知卡号按 otherCardNo IS NULL 处理
cc 2 săptămâni în urmă
părinte
comite
bbdf0466c9

+ 1 - 0
ai-electron/frontend/src/trans/api/types/query.ts

@@ -155,6 +155,7 @@ export interface TransCardHoldQuery extends Query {
  */
 export interface TransSensitiveQuery extends Query {
   otherCardNo?: string;
+  otherName?: string;
 }
 // ==================== 交易记录查询相关 ====================
 

+ 5 - 3
ai-electron/frontend/src/trans/views/transSensitive/index.vue

@@ -472,14 +472,16 @@
       const range = filters.value.dateRange as RangeValue;
       const selectedTarget = normalizeSelectedTargets(filters.value.target)[0];
       const rowPersonName = current.raw?.personName;
+      const personNames = rowPersonName ? [rowPersonName] : selectedTarget ? [selectedTarget] : undefined;
       const resp = await statSecondTransSensitive({
         page: detailPagination.value.current,
         limit: detailPagination.value.pageSize,
         startDate: range?.[0] || undefined,
         endDate: range?.[1] || undefined,
-        personName: rowPersonName || selectedTarget,
-        otherCardNo: current.raw?.otherCardNo || undefined,
-        otherName: current.raw?.otherName || undefined,
+        // 第二层接口只认 personNames(列表);传 personName 会被忽略,导致明细混入其他对象的数据
+        personNames,
+        otherCardNo: current.raw?.otherCardNo || '未知卡号',
+        otherName: current.raw?.otherName || '未知对手',
       });
 
       const records = normalizeList(resp) as TransRecord[];

+ 15 - 2
ai-server/src/main/resources/mappers/trans/TransSensitiveMapper.xml

@@ -13,6 +13,9 @@
                     #{name}
                 </foreach>
             </if>
+            <if test="query.personName != null and query.personName != ''">
+                AND personName = #{query.personName}
+            </if>
             <if test="query.startDate != null">
                 and transDate >= #{query.startDate}
             </if>
@@ -49,6 +52,9 @@
                     #{name}
                 </foreach>
             </if>
+            <if test="query.personName != null and query.personName != ''">
+                AND personName = #{query.personName}
+            </if>
             <if test="query.startDate != null">
                 and transDate >= #{query.startDate}
             </if>
@@ -65,8 +71,15 @@
                     </otherwise>
                 </choose>
             </if>
-            <if test="query.otherCardNo != null">
-                and otherCardNo =#{query.otherCardNo}
+            <if test="query.otherCardNo != null and query.otherCardNo != ''">
+                <choose>
+                    <when test="query.otherCardNo == '未知卡号'">
+                        and otherCardNo IS NULL
+                    </when>
+                    <otherwise>
+                        and otherCardNo = #{query.otherCardNo}
+                    </otherwise>
+                </choose>
             </if>
         </where>
         )