From 83490ce94006ea940a5b3e5b4c587ff2e15a798f Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Mon, 26 Dec 2022 01:24:23 +0000
Subject: [PATCH] 分支合并

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java
new file mode 100644
index 0000000..d89f3c3
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysUserLevelWageRepository.java
@@ -0,0 +1,45 @@
+/*
+*  Copyright 2019-2020 Zheng Jie
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+package me.zhengjie.modules.system.repository;
+
+import me.zhengjie.modules.system.domain.SysUserLevelWage;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+/**
+* @website https://eladmin.vip
+* @author 赵士淞
+* @date 2022-12-19
+**/
+public interface SysUserLevelWageRepository extends JpaRepository<SysUserLevelWage, Long>, JpaSpecificationExecutor<SysUserLevelWage> {
+
+    /**
+     * 根据用户ID查询最新记录
+     * @param userId /
+     * @return /
+     */
+    @Query(value = "SELECT * FROM sys_user_level_wage WHERE user_id = ?1 ORDER BY start_date DESC, create_time DESC LIMIT 1", nativeQuery = true)
+    SysUserLevelWage findLastByUserId(Long userId);
+
+    /**
+     * 根据级别查询
+     * @param ids /
+     * @return /
+     */
+    @Query(value = "SELECT count(1) FROM sys_user_level_wage WHERE level_id IN ?1", nativeQuery = true)
+    int countByLevels(Long[] ids);
+}
\ No newline at end of file

--
Gitblit v1.9.3