| | |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import io.swagger.models.auth.In; |
| | | import me.zhengjie.modules.system.domain.Dept; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | 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 java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | |
| | | /** |
| | | * 根据用户名查询 |
| | | * |
| | | * @param username 用户名 |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据邮箱查询 |
| | | * |
| | | * @param email 邮箱 |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据手机号查询 |
| | | * |
| | | * @param phone 手机号 |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改密码 |
| | | * @param username 用户名 |
| | | * @param pass 密码 |
| | | * |
| | | * @param username 用户名 |
| | | * @param pass 密码 |
| | | * @param lastPasswordResetTime / |
| | | */ |
| | | @Modifying |
| | | @Query(value = "update sys_user set password = ?2 , pwd_reset_time = ?3 where username = ?1",nativeQuery = true) |
| | | @Query(value = "update sys_user set password = ?2 , pwd_reset_time = ?3 where username = ?1", nativeQuery = true) |
| | | void updatePass(String username, String pass, Date lastPasswordResetTime); |
| | | |
| | | /** |
| | | * 修改邮箱 |
| | | * |
| | | * @param username 用户名 |
| | | * @param email 邮箱 |
| | | * @param email 邮箱 |
| | | */ |
| | | @Modifying |
| | | @Query(value = "update sys_user set email = ?2 where username = ?1",nativeQuery = true) |
| | | @Query(value = "update sys_user set email = ?2 where username = ?1", nativeQuery = true) |
| | | void updateEmail(String username, String email); |
| | | |
| | | /** |
| | | * 根据角色查询用户 |
| | | * |
| | | * @param roleId / |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据角色中的部门查询 |
| | | * |
| | | * @param deptId / |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据菜单查询 |
| | | * |
| | | * @param id 菜单ID |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据Id删除 |
| | | * |
| | | * @param ids / |
| | | */ |
| | | void deleteAllByIdIn(Set<Long> ids); |
| | | |
| | | /** |
| | | * 根据岗位查询 |
| | | * |
| | | * @param ids / |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据部门查询 |
| | | * |
| | | * @param deptIds / |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据角色查询 |
| | | * |
| | | * @param ids / |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据状态查询 |
| | | * |
| | | * @param enabled |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据排班查询 |
| | | * |
| | | * @param ids / |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据级别查询 |
| | | * |
| | | * @param ids / |
| | | * @return / |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * |
| | | * @param userIds |
| | | * @return |
| | | */ |
| | | List<User> findByIdIn(List<Long> userIds); |
| | | List<User> findByIdIn(List<Long> userIds); |
| | | |
| | | /** |
| | | * 根据部门查询 |
| | | * |
| | | * @param dept |
| | | * @return |
| | | */ |
| | | List<User> findByDeptAndEnabled(Dept dept, Boolean enabled); |
| | | List<User> findByDeptAndEnabled(Dept dept, Boolean enabled); |
| | | |
| | | @Query(value = "SELECT * FROM sys_user WHERE dept_id IN ?1 AND enabled = ?2", nativeQuery = true) |
| | | List<User> findByDeptIdInAndEnabled(List<Long> deptIds, Boolean enabled); |
| | | @Query(value = "SELECT * FROM sys_user WHERE dept_id IN ?1 AND enabled = ?2", nativeQuery = true) |
| | | List<User> findByDeptIdInAndEnabled(List<Long> deptIds, Boolean enabled); |
| | | |
| | | @Query(value = "select * from sys_user where dept_id = ?1 and enabled=?2", nativeQuery = true) |
| | | List<User> findByDeptIdInAndEnabledWithSingle(Long deptId, Boolean enabled); |
| | | |
| | | @Query(value = "select dept_id from sys_user where user_id = ?1",nativeQuery = true) |
| | | Long findDeptIdByUserId(Long userId); |
| | | |
| | | /** |
| | | * 查询部门 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT u.* FROM sys_user u JOIN sys_dept d ON u.dept_id = d.dept_id WHERE d.dept_id = ?;", nativeQuery = true) |
| | | List<User> findByDeptId(Long dept_id); |
| | | |
| | | /** |
| | | * 查询用户 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM sys_user WHERE user_id = ?;", nativeQuery = true) |
| | | List<User> findByUserId(Long user_id); |
| | | |
| | | @Query(value = "select * FROM sys_user WHERE user_id IN ?1 and enabled = true",nativeQuery = true) |
| | | void findByUserIdIn(List<Long> userIds, Long companyId); |
| | | |
| | | @Query(value = "select * FROM sys_user WHERE user_id IN ?1 and company_id = ?2 and enabled = true",nativeQuery = true) |
| | | void findByUserIdInAndCompanyId(List<Long> userIds, Long companyId); |
| | | } |