| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package com.izouma.jiashanxia.repo;
- import com.izouma.jiashanxia.domain.User;
- import com.izouma.jiashanxia.security.Authority;
- 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 javax.transaction.Transactional;
- import java.util.List;
- public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {
- @Transactional
- @Modifying
- @Query("update User u set u.del = true where u.id = ?1")
- void softDelete(Long id);
- User findByUsernameAndDelFalse(String username);
- List<User> findAllByAuthoritiesContainsAndDelFalse(Authority authority);
- User findByOpenIdAndDelFalse(String openId);
- User findByPhoneAndDelFalse(String phone);
- List<User> findAllByParentAndDelFalse(Long parent);
- List<User> findAllByParentInAndDelFalse(Iterable<Long> parent);
- List<User> findAllByCompanyIdAndDelFalse(Long companyId);
- long countByParentAndDelFalse(Long parentId);
- List<User> findAllByCompanyIdIsNullAndDelFalse();
- @Transactional
- @Modifying
- @Query("update User u set u.companyId = null where u.id = ?1")
- void deleteCompanyIdByUserId(Long id);
- @Transactional
- @Modifying
- @Query("update User u set u.companyId = null where u.companyId = ?1")
- void deleteCompanyId(Long companyId);
- }
|