| | |
| | | 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 |
| | |
| | | private val userConfigMapper: UserConfigMapper, |
| | | private val userinfoMapper: UserinfoMapper, |
| | | private val baseInfoMapper: BaseInfoMapper, |
| | | private val userSettingMapper: UserSettingMapper, |
| | | ) { |
| | | |
| | | fun select(configId: Int): UserConfig? { |
| | |
| | | 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.select(userSetting) |
| | | |
| | | return if (res.isNotEmpty()) res[0] else null |
| | | } |
| | | } |