weicd
2024-12-27 0766c42639d0e9b12d8dc2f93589b4713ced57a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package me.zhengjie.modules.treatment.repository;
 
import me.zhengjie.modules.system.domain.SysUserLevelOther;
import me.zhengjie.modules.treatment.domain.MeritLevel;
import me.zhengjie.modules.treatment.domain.MeritWage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
@Transactional
public interface MeritLevelRepository extends JpaRepository<MeritLevel, Long>, JpaSpecificationExecutor<MeritWage> {
 
    @Modifying
    @Query(value = "delete from merit_level where merit_wage_id = ?1", nativeQuery = true)
    void deleteByMeritWageId(Long wageId);
 
 
    List<MeritLevel> findByMeritWageId(Long meritWageId);
 
    /**
     * 查询等级
     * @param levelId
     * @return
     */
    @Query(value = "SELECT * FROM merit_level WHERE merit_wage_id = (SELECT id FROM merit_wage WHERE level_id = ?1) ORDER BY merit_standard ASC LIMIT 1", nativeQuery = true)
    MeritLevel findMinMeritStandardByLevelId(Long levelId);
}