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

Merge branch 'revert-b7f5a3a1' into 'main'

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

See merge request !47
parents ba7e720c 37606c8d
Branches
No related tags found
1 merge request!47Revert "Merge branch 'wyl' into 'main'"
...@@ -71,15 +71,4 @@ public class SuperAdminController { ...@@ -71,15 +71,4 @@ public class SuperAdminController {
Result result= superAdminService.update(selectDTO); Result result= superAdminService.update(selectDTO);
return result; 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 { ...@@ -46,6 +46,4 @@ public interface SuperAdminService {
* @return * @return
*/ */
Result selectByItem(SelectDTO selectDTO); Result selectByItem(SelectDTO selectDTO);
Result selectPage(String type, Integer pageSize, int i);
} }
...@@ -200,25 +200,5 @@ public class SuperAdminServiceImp implements SuperAdminService { ...@@ -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) { ...@@ -280,7 +280,7 @@ function updateTable(data) {
<td class="tdOption"> <td class="tdOption">
<label id="edit" class="btn">Edit</label> <label id="edit" class="btn">Edit</label>
<label id="delete" class="btn">Delete</label> <label id="delete" class="btn">Delete</label>
<label id="freeze" class="btn">Change status</label> <label id="freeze" class="btn">Freeze</label>
</td> </td>
</tr> </tr>
`; `;
......
...@@ -247,36 +247,23 @@ function updateTable(data) { ...@@ -247,36 +247,23 @@ function updateTable(data) {
<td class="tdOption"> <td class="tdOption">
<label id="edit" class="btn">Edit</label> <label id="edit" class="btn">Edit</label>
<label id="delete" class="btn">Delete</label> <label id="delete" class="btn">Delete</label>
<label id="freeze" class="btn">Change status</label> <label id="freeze" class="btn">Freeze</label>
</td> </td>
</tr> </tr>
`; `;
tbody.append(tr); tbody.append(tr);
}); });
} }
$(document).on("change","#page-size",function (){
function pageSelect(pageSize,paginationDiv,pageNumber) { let pageSize=document.getElementById("page-size").value
$.ajax({ $.ajax({
contentType: "application/json", contentType: "application/json",
url: `/superAdmin/pageSelect?type=commonAdmin&pageSize=${pageSize}&pageNumber=${pageNumber}`, url: `/superAdmin/pageSelect?type=commonAdmin&pageSize=${pageSize}`,
type: "GET", type: "GET",
dataType: "Json", dataType: "Json",
success: function (data) { success: function (data) {
console.log(data) console.log(data)
if (data.code != 0) { 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) updateTable(data.data)
//location.reload() //location.reload()
} else { } else {
...@@ -284,10 +271,5 @@ function pageSelect(pageSize,paginationDiv,pageNumber) { ...@@ -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 @@ ...@@ -60,7 +60,7 @@
<td class="tdOption"> <td class="tdOption">
<label id="edit" class="btn">Edit</label> <label id="edit" class="btn">Edit</label>
<label id="delete" class="btn">Delete</label> <label id="delete" class="btn">Delete</label>
<label id="freeze" class="btn">Change status</label> <label id="freeze" class="btn">Freeze</label>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<td class="tdOption"> <td class="tdOption">
<label id="edit" class="btn">Edit</label> <label id="edit" class="btn">Edit</label>
<label id="delete" class="btn">Delete</label> <label id="delete" class="btn">Delete</label>
<label id="freeze" class="btn">Change status</label> <label id="freeze" class="btn">Freeze</label>
</td> </td>
</tr> </tr>
...@@ -91,22 +91,13 @@ ...@@ -91,22 +91,13 @@
<button type="button" id="addAdmin" style="margin-right: 170px;margin-left: 20px">Submit</button> <button type="button" id="addAdmin" style="margin-right: 170px;margin-left: 20px">Submit</button>
<button type="button" onclick="location.reload()">Cancel</button> <button type="button" onclick="location.reload()">Cancel</button>
</div> </div>
<div style="display: flex; align-items: center; gap: 10px; justify-content: center;"> <div>
<select id="page-size" style="background-color: #f9f9f9; <select id="page-size">
border: 1px solid #ccc;
border-radius: 4px;
padding: 8px 12px;
font-size: 14px;
color: #333;
cursor: pointer;
width: 150px;
transition: all 0.3s ease;">
<option value="">items per page</option> <option value="">items per page</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
<option value="15">15</option> <option value="15">15</option>
</select> </select>
<div id="pagination" style="margin-top: 10px;"></div>
</div> </div>
<script src="/js/mainSupAdminView.js"></script> <script src="/js/mainSupAdminView.js"></script>
</body> </body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment