From fe031e01cc1737c2f05a133fde7c36c7a2a7b4b4 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期三, 21 一月 2026 17:38:32 +0800
Subject: [PATCH] 2026.1.21 1. 新增完善台账复制逻辑

---
 src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt
index ac1f61b..335d27c 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt
@@ -1,10 +1,13 @@
 package cn.flightfeather.supervision.domain.repository
 
+import cn.flightfeather.supervision.common.exception.BizException
 import cn.flightfeather.supervision.domain.entity.BaseInfo
 import cn.flightfeather.supervision.domain.entity.UserConfig
+import cn.flightfeather.supervision.domain.entity.UserSetting
 import cn.flightfeather.supervision.domain.entity.Userinfo
 import cn.flightfeather.supervision.domain.mapper.BaseInfoMapper
 import cn.flightfeather.supervision.domain.mapper.UserConfigMapper
+import cn.flightfeather.supervision.domain.mapper.UserSettingMapper
 import cn.flightfeather.supervision.domain.mapper.UserinfoMapper
 import org.springframework.stereotype.Repository
 import tk.mybatis.mapper.entity.Example
@@ -14,6 +17,7 @@
     private val userConfigMapper: UserConfigMapper,
     private val userinfoMapper: UserinfoMapper,
     private val baseInfoMapper: BaseInfoMapper,
+    private val userSettingMapper: UserSettingMapper,
 ) {
 
     fun select(configId: Int): UserConfig? {
@@ -79,4 +83,19 @@
         return userConfigMapper.selectByPrimaryKey(configId)
     }
 
+    fun getUserSetting(userId: String): UserSetting? {
+        val userInfo = userinfoMapper.selectByPrimaryKey(userId) ?: throw BizException("璇ョ敤鎴蜂笉瀛樺湪")
+        val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
+        val userSetting = UserSetting().apply {
+            userTypeId = userInfo.usertypeid?.toInt()
+            provinceName = baseInfo?.biProvinceName
+            cityName = baseInfo?.biCityName
+            districtName = baseInfo?.biDistrictName ?: userInfo.extension1
+            sceneTypeId = userInfo.extension2?.toInt()
+        }
+        val res = userSettingMapper.selectBestConfig(userSetting)
+
+//        return if (res.isNotEmpty()) res[0] else null
+        return res
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3