Skip to content
Snippets Groups Projects
Commit 37606c8d authored by Mingyuan Chen's avatar Mingyuan Chen
Browse files

Revert "Merge branch 'wyl' into 'main'"

This reverts merge request !45
parent ba7e720c
No related branches found
No related tags found
1 merge request!47Revert "Merge branch 'wyl' into 'main'"
......@@ -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;
}
}
......@@ -46,6 +46,4 @@ public interface SuperAdminService {
* @return
*/
Result selectByItem(SelectDTO selectDTO);
Result selectPage(String type, Integer pageSize, int i);
}
......@@ -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);
}
}
......@@ -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>
`;
......
......@@ -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
......@@ -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>
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment