“djh”
2024-12-04 d1549b8445c65a6775cf1ba093f5040ace0f87e7
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
32
33
34
package com.gkhy.huataiFourierSpecialGasMonitor.domain.account.repository.jpa;
 
import com.gkhy.huataiFourierSpecialGasMonitor.domain.account.entity.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
@Repository
public interface RoleRepository extends JpaRepository<Role, Long> {
 
    @Query(value = "select r from Role r where r.name = :name and r.delFlag = 0")
    Role findRoleByName(String name);
 
    List<Role> findAllByDelFlag(Byte delFlag);
 
    @Query(value = "update Role r set r.delFlag = 1 where r.id = :roleId")
    @Transactional
    @Modifying
    Integer deleteRole(Long roleId);
 
    List<Role> findAllByIdIn(List<Long> idList);
 
    @Query(value = "update Role r set r.name = :name where r.id = :roleId")
    @Transactional
    @Modifying
    Integer updateRoleName(Long roleId,String name);
    @Query(value = "select r from Role r where r.id in (:idList) and r.delFlag = 0")
    List<Role> findAllByIdInAndDelFlag(List<Long> idList);
 
}