mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-06 07:21:24 +08:00
Added search in StaffManagement
This commit is contained in:
@@ -5,7 +5,6 @@ import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||
import com.cfive.pinnacle.entity.permission.User;
|
||||
import com.cfive.pinnacle.service.IStaffService;
|
||||
import com.cfive.pinnacle.utils.WebUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -32,8 +31,8 @@ public class StaffController {
|
||||
|
||||
@GetMapping
|
||||
@PreAuthorize("hasAnyAuthority('staff:manege:get', 'staff:admin:get')")
|
||||
public ResponseResult<IPage<User>> getAllStaff(Long currentPage, Long pageSize) {
|
||||
return ResponseResult.databaseSelectSuccess(staffService.getAllStaff(currentPage, pageSize, WebUtil.hasAuthority("staff:admin:get") ? null : WebUtil.getLoginUser().getUser().getDepartmentId()));
|
||||
public ResponseResult<IPage<User>> getAllStaff(Long currentPage, Long pageSize, Integer searchType, String searchInput, Integer searchGender, String searchBirthFrom, String searchBirthTo) {
|
||||
return ResponseResult.databaseSelectSuccess(staffService.getAllStaff(currentPage, pageSize, searchType, searchInput, searchGender, searchBirthFrom, searchBirthTo));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
|
||||
@@ -17,5 +17,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
@Mapper
|
||||
public interface StaffMapper extends BaseMapper<Staff> {
|
||||
IPage<User> getAllStaff(IPage<User> page, @Param("departmentId")Long departmentId);
|
||||
IPage<User> getAllStaff(IPage<User> page, @Param("departmentId") Long departmentId, @Param("searchType") Integer searchType, @Param("searchInput") String searchInput, @Param("searchGender") Integer searchGender, @Param("searchBirthFrom") String searchBirthFrom, @Param("searchBirthTo") String searchBirthTo);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.cfive.pinnacle.entity.permission.User;
|
||||
* @since 2023-04-30
|
||||
*/
|
||||
public interface IStaffService extends IService<Staff> {
|
||||
IPage<User> getAllStaff(Long currentPage, Long pageSize, Long departmentId);
|
||||
IPage<User> getAllStaff(Long currentPage, Long pageSize, Integer searchType, String searchInput, Integer searchGender, String searchBirthFrom, String searchBirthTo);
|
||||
|
||||
boolean modifyStaff(User user);
|
||||
}
|
||||
|
||||
@@ -39,14 +39,16 @@ public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<User> getAllStaff(Long currentPage, Long pageSize, Long departmentId) {
|
||||
public IPage<User> getAllStaff(Long currentPage, Long pageSize, Integer searchType, String searchInput, Integer searchGender, String searchBirthFrom, String searchBirthTo) {
|
||||
Long departmentId = WebUtil.hasAuthority("staff:admin:get") ? null : WebUtil.getLoginUser().getUser().getDepartmentId();
|
||||
IPage<User> userIPage;
|
||||
if (currentPage == null || pageSize == null) {
|
||||
userIPage = PageDTO.of(0, -1);
|
||||
} else {
|
||||
userIPage = PageDTO.of(currentPage, pageSize);
|
||||
}
|
||||
return staffMapper.getAllStaff(userIPage, departmentId);
|
||||
searchInput = searchInput.trim();
|
||||
return staffMapper.getAllStaff(userIPage, departmentId, searchType, searchInput, searchGender, searchBirthFrom, searchBirthTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user