diff --git a/src/main/java/com/cardiff/client_project/controller/admin/SuperAdminController.java b/src/main/java/com/cardiff/client_project/controller/admin/SuperAdminController.java index 1c01ed8b716310b0badffa0e2c83adbd53949a28..a33e0be93552abfb37a66157ef00f73d996dd59f 100644 --- a/src/main/java/com/cardiff/client_project/controller/admin/SuperAdminController.java +++ b/src/main/java/com/cardiff/client_project/controller/admin/SuperAdminController.java @@ -71,15 +71,4 @@ public class SuperAdminController { Result result= superAdminService.update(selectDTO); return result; } - - /** - * page selete - */ - @GetMapping("/pageSelect") - public Result pageSelect(@RequestParam String type,@RequestParam Integer pageSize,@RequestParam Integer pageNumber){ - Result result=superAdminService.selectPage(type,pageSize,pageNumber); - return result; - } } - - diff --git a/src/main/java/com/cardiff/client_project/service/SuperAdminService.java b/src/main/java/com/cardiff/client_project/service/SuperAdminService.java index 94d22a2d3dcb9d68d9cd789f8a3501bfb5c9bbfe..02968edbc4de931bdcbdec570f07a3b031b4fe6e 100644 --- a/src/main/java/com/cardiff/client_project/service/SuperAdminService.java +++ b/src/main/java/com/cardiff/client_project/service/SuperAdminService.java @@ -46,6 +46,4 @@ public interface SuperAdminService { * @return */ Result selectByItem(SelectDTO selectDTO); - - Result selectPage(String type, Integer pageSize, int i); } diff --git a/src/main/java/com/cardiff/client_project/service/imp/SuperAdminServiceImp.java b/src/main/java/com/cardiff/client_project/service/imp/SuperAdminServiceImp.java index d238ec423a368aca939e788060b03ba5f86a8fda..4589db4183759ad1b7be5687419df2ecf6cebc41 100644 --- a/src/main/java/com/cardiff/client_project/service/imp/SuperAdminServiceImp.java +++ b/src/main/java/com/cardiff/client_project/service/imp/SuperAdminServiceImp.java @@ -200,25 +200,5 @@ public class SuperAdminServiceImp implements SuperAdminService { } } - - @Override - public Result selectPage(String type, Integer pageSize, int pageNumber) { - if(type.equals("commonAdmin")){ - List<CommonAdmin> commonAdmins = superAdminMapper.selectPageCommonAdmin(pageSize, pageNumber); - //get all and count items - List<AdminVO> adminVOS = superAdminMapper.selectAllAdmin(); - if(commonAdmins.size()>0){ - System.out.println(adminVOS.size()); - Integer count=adminVOS.size()%pageSize==0?adminVOS.size()/pageSize:adminVOS.size()/pageSize+1; - return Result.success(count.toString(),commonAdmins); - } - } - if(type.equals("hospital")){ - - } - return Result.error(ResponseCode.ERROR); - } - - } diff --git a/src/main/resources/static/js/mainHospitalView.js b/src/main/resources/static/js/mainHospitalView.js index 22d8d4702ee4860fbbde1c75a974befcb15e194c..1e6a9e183c6874cc0af7b47a9784c149e4a06117 100644 --- a/src/main/resources/static/js/mainHospitalView.js +++ b/src/main/resources/static/js/mainHospitalView.js @@ -280,7 +280,7 @@ function updateTable(data) { <td class="tdOption"> <label id="edit" class="btn">Edit</label> <label id="delete" class="btn">Delete</label> - <label id="freeze" class="btn">Change status</label> + <label id="freeze" class="btn">Freeze</label> </td> </tr> `; diff --git a/src/main/resources/static/js/mainSupAdminView.js b/src/main/resources/static/js/mainSupAdminView.js index 2005f653be22fff349de1d1e1cf654b65587ec7a..8d4328f4f27bf1ae04881fd531bca973f0f1062f 100644 --- a/src/main/resources/static/js/mainSupAdminView.js +++ b/src/main/resources/static/js/mainSupAdminView.js @@ -247,36 +247,23 @@ function updateTable(data) { <td class="tdOption"> <label id="edit" class="btn">Edit</label> <label id="delete" class="btn">Delete</label> - <label id="freeze" class="btn">Change status</label> + <label id="freeze" class="btn">Freeze</label> </td> </tr> `; tbody.append(tr); }); } - -function pageSelect(pageSize,paginationDiv,pageNumber) { - +$(document).on("change","#page-size",function (){ + let pageSize=document.getElementById("page-size").value $.ajax({ contentType: "application/json", - url: `/superAdmin/pageSelect?type=commonAdmin&pageSize=${pageSize}&pageNumber=${pageNumber}`, + url: `/superAdmin/pageSelect?type=commonAdmin&pageSize=${pageSize}`, type: "GET", dataType: "Json", success: function (data) { - console.log(data) + console.log(data) if (data.code != 0) { - console.log(data.code) - console.log(data.data) - paginationDiv.innerHTML = ""; //clear old button - for (let i = 1; i <= data.msg; i++) { - const button = document.createElement("button"); - button.textContent = i; - button.style.margin = "0 5px"; - button.style.padding = "5px 10px"; - button.style.cursor = "pointer"; - button.onclick = () => pageSelect(pageSize,paginationDiv,button.textContent); - paginationDiv.appendChild(button); - } updateTable(data.data) //location.reload() } else { @@ -284,10 +271,5 @@ function pageSelect(pageSize,paginationDiv,pageNumber) { } }, }) -} -$(document).on("change","#page-size",function (){ - let pageSize=document.getElementById("page-size").value - let paginationDiv = document.getElementById("pagination"); - pageSelect(pageSize,paginationDiv,"1"); }) \ No newline at end of file diff --git a/src/main/resources/templates/mainHospitalView.html b/src/main/resources/templates/mainHospitalView.html index 8531c7773fb71da8cabe13a2c7af3edc4bf31b7f..d53b851731370c57dfc2d9123f68a6a57be608e0 100644 --- a/src/main/resources/templates/mainHospitalView.html +++ b/src/main/resources/templates/mainHospitalView.html @@ -60,7 +60,7 @@ <td class="tdOption"> <label id="edit" class="btn">Edit</label> <label id="delete" class="btn">Delete</label> - <label id="freeze" class="btn">Change status</label> + <label id="freeze" class="btn">Freeze</label> </td> </tr> </tbody> diff --git a/src/main/resources/templates/mainSupAdminView.html b/src/main/resources/templates/mainSupAdminView.html index d3d05a2464b6386f182cf8d9f090d41fdd9e2a8a..c0d52d8c8936318bcfcdc2a215e498caa8fafdb3 100644 --- a/src/main/resources/templates/mainSupAdminView.html +++ b/src/main/resources/templates/mainSupAdminView.html @@ -48,7 +48,7 @@ <td class="tdOption"> <label id="edit" class="btn">Edit</label> <label id="delete" class="btn">Delete</label> - <label id="freeze" class="btn">Change status</label> + <label id="freeze" class="btn">Freeze</label> </td> </tr> @@ -91,22 +91,13 @@ <button type="button" id="addAdmin" style="margin-right: 170px;margin-left: 20px">Submit</button> <button type="button" onclick="location.reload()">Cancel</button> </div> -<div style="display: flex; align-items: center; gap: 10px; justify-content: center;"> - <select id="page-size" style="background-color: #f9f9f9; - border: 1px solid #ccc; - border-radius: 4px; - padding: 8px 12px; - font-size: 14px; - color: #333; - cursor: pointer; - width: 150px; - transition: all 0.3s ease;"> +<div> + <select id="page-size"> <option value="">items per page</option> <option value="1">1</option> <option value="2">2</option> <option value="15">15</option> </select> - <div id="pagination" style="margin-top: 10px;"></div> </div> <script src="/js/mainSupAdminView.js"></script> </body>