Browse Source

测试记录接口调整

zsf 1 year ago
parent
commit
01e9c03950

+ 4 - 4
src/main/java/com/rf/psychological/user/dao/repository/UserRepository.java

@@ -81,12 +81,12 @@ public interface UserRepository extends BaseRepository<UserEntity, String> {
      * @return
      */
     @Query(value = "select distinct tui.id,gender,password,pet_name,tui.phone,birthday,profession,institution_name,tui.institution_no,user_status,g_id,model,role_type from t_user_info tui join t_user_record tur on  tui.phone=tur.phone and tui.institution_no=tur.institution_no " +
-            " where tui.institution_no = :institutionNo  and role_type ='1' and (pet_name like %:searchKey% or tui.phone like %:searchKey% ) order by id  limit :pageNum ,:pageSize ", nativeQuery = true)
-    List<UserEntity> getTestListByInstitutionNo(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("institutionNo") String institutionNo, @Param("searchKey") String searchKey);
+            " where tui.institution_no = :institutionNo  and role_type ='1' and (pet_name like %:searchKey% or tui.phone like %:searchKey% ) and structure_no like :structureNo% order by id  limit :pageNum ,:pageSize ", nativeQuery = true)
+    List<UserEntity> getTestListByInstitutionNo(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("institutionNo") String institutionNo, @Param("searchKey") String searchKey, @Param("structureNo") String structureNo);
 
     @Query(value = "select count(distinct tui.id) from t_user_info tui join t_user_record tur on  tui.phone=tur.phone and tui.institution_no=tur.institution_no " +
-            " where tui.institution_no = :institutionNo  and role_type ='1'  and (pet_name like %:searchKey% or tui.phone like %:searchKey% )", nativeQuery = true)
-    int allNumByInstitutionNo(@Param("institutionNo") String institutionNo, @Param("searchKey") String searchKey);
+            " where tui.institution_no = :institutionNo  and role_type ='1'  and (pet_name like %:searchKey% or tui.phone like %:searchKey% ) and structure_no like :structureNo%", nativeQuery = true)
+    int allNumByInstitutionNo(@Param("institutionNo") String institutionNo, @Param("searchKey") String searchKey, @Param("structureNo") String structureNo);
 
     UserEntity findByPhoneAndInstitutionNoAndRoleType(String phone,String institutionNo,String roleType);
     UserEntity findByPhoneAndInstitutionNo(String phone,String institutionNo);

+ 3 - 3
src/main/java/com/rf/psychological/user/rest/UserController.java

@@ -188,13 +188,13 @@ public class UserController extends BaseController {
     @SafetyProcess
     @GetMapping("/institutionTest")
     @ApiOperation(value = "获取拥有测试记录机构下员工列表")
-    public Result institutionTest(int pageNum, int pageSize, String institutionNo, String searchKey) {
+    public Result institutionTest(int pageNum, int pageSize, String institutionNo, String searchKey, String structureNo) {
         if (pageSize == 0) {
             pageSize = 20;
         }
         int num;
-        List<UserEntity> userRecordEntityList = this.userService.getTestListByInstitutionNo(pageNum, pageSize, institutionNo, searchKey);
-        num = this.userService.allNumByInstitutionNo(institutionNo, searchKey);
+        List<UserEntity> userRecordEntityList = this.userService.getTestListByInstitutionNo(pageNum, pageSize, institutionNo, searchKey,structureNo);
+        num = this.userService.allNumByInstitutionNo(institutionNo, searchKey,structureNo);
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("userRecordEntityList", userRecordEntityList);
         jsonObject.put("allNum", num);

+ 2 - 2
src/main/java/com/rf/psychological/user/service/UserService.java

@@ -75,9 +75,9 @@ public interface UserService {
      * @param searchKey
      * @return
      */
-    List<UserEntity> getTestListByInstitutionNo(int pageNum, int pageSize, String institutionNo, String searchKey);
+    List<UserEntity> getTestListByInstitutionNo(int pageNum, int pageSize, String institutionNo, String searchKey, String structureNo);
 
-    int allNumByInstitutionNo(String institutionNo, String searchKey);
+    int allNumByInstitutionNo(String institutionNo, String searchKey, String structureNo);
 
 
     /**

+ 4 - 4
src/main/java/com/rf/psychological/user/service/impl/UserServiceImpl.java

@@ -115,14 +115,14 @@ public class UserServiceImpl implements UserService {
     }
 
     @Override
-    public List<UserEntity> getTestListByInstitutionNo(int pageNum, int pageSize, String institutionNo, String searchKey) {
+    public List<UserEntity> getTestListByInstitutionNo(int pageNum, int pageSize, String institutionNo, String searchKey, String structureNo) {
         int beginIndex = (pageNum - 1) * pageSize;
-        return this.userRepository.getTestListByInstitutionNo(beginIndex, pageSize, institutionNo, searchKey);
+        return this.userRepository.getTestListByInstitutionNo(beginIndex, pageSize, institutionNo, searchKey,structureNo);
     }
 
     @Override
-    public int allNumByInstitutionNo(String institutionNo, String searchKey) {
-        return this.userRepository.allNumByInstitutionNo(institutionNo, searchKey);
+    public int allNumByInstitutionNo(String institutionNo, String searchKey, String structureNo) {
+        return this.userRepository.allNumByInstitutionNo(institutionNo, searchKey,structureNo);
     }
 
     @Override