Skip to content
Snippets Groups Projects
Commit df7f1327 authored by Yulong Wang's avatar Yulong Wang
Browse files

Revert "Merge branch..."

This reverts merge request !41
parent 5e6b9bcf
Branches
No related tags found
1 merge request!42Revert "Merge branch..."
......@@ -71,14 +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){
System.out.println("type: "+type+"" +pageSize);
Result result=superAdminService.selectPage(type,pageSize,1);
return result;
}
}
......@@ -570,24 +570,29 @@ public class SuperAdminMapper {
public Object getInforByName(String username){
try {
// 1. 查询 super_admin 表
String sql = "select * from super_admin where name=?";
return jdbcTemplate.queryForObject(sql, new Object[]{username}, new BeanPropertyRowMapper<>(SuperUser.class));
} catch (Exception s) {
try {
// 2. 查询 hospital 表
String sql = "select * from hospital where email=?";
return jdbcTemplate.queryForObject(sql, new Object[]{username}, new BeanPropertyRowMapper<>(Hospital.class));
} catch (Exception h) {
try {
// 3. 查询 common_admin 表
String sql = "select * from common_admin where email=?";
return jdbcTemplate.queryForObject(sql, new Object[]{username}, new BeanPropertyRowMapper<>(CommonAdmin.class));
} catch (Exception c) {
try {
// 4. 查询 patient 表
String sql = "select * from patient where email=?";
return jdbcTemplate.queryForObject(sql, new Object[]{username}, new BeanPropertyRowMapper<>(Patient.class));
} catch (Exception p) {}
}
}
}
// 如果所有查询都为空,返回 null
return null;
}
......@@ -641,16 +646,4 @@ public class SuperAdminMapper {
return Result.error(ResponseCode.ERROR);
}
}
/**
* page select
* @param pageSize
*/
public List<CommonAdmin> selectPageCommonAdmin(Integer pageSize,Integer pageNumber) {
String sql="select * from common_admin LIMIT ? OFFSET ?";
int offset = (pageNumber - 1) * pageSize;
List<CommonAdmin> query = jdbcTemplate.query(sql, new Object[]{pageSize,offset}, new BeanPropertyRowMapper<>(CommonAdmin.class));
System.out.println(query);
return query;
}
}
......@@ -46,12 +46,4 @@ public interface SuperAdminService {
* @return
*/
Result selectByItem(SelectDTO selectDTO);
/**
* page select
* @param type
* @param pageSize
* @return
*/
Result selectPage(String type, Integer pageSize,Integer pageNumber);
}
......@@ -200,25 +200,5 @@ public class SuperAdminServiceImp implements SuperAdminService {
}
}
/**
* page select
* @param type
* @param pageSize
* @return
*/
@Override
public Result selectPage(String type, Integer pageSize,Integer pageNumber) {
if(type.equals("commonAdmin")){
List<CommonAdmin> commonAdmins = superAdminMapper.selectPageCommonAdmin(pageSize, pageNumber);
if(commonAdmins.size()>0){
return Result.success(commonAdmins);
}
}
if(type.equals("hospital")){
}
return Result.error(ResponseCode.ERROR);
}
}
......@@ -253,23 +253,4 @@ function updateTable(data) {
`;
tbody.append(tr);
});
}
$(document).on("change","#page-size",function (){
let pageSize=document.getElementById("page-size").value
$.ajax({
contentType: "application/json",
url: `/superAdmin/pageSelect?type=commonAdmin&pageSize=${pageSize}`,
type: "GET",
dataType: "Json",
success: function (data) {
console.log(data)
if (data.code != 0) {
updateTable(data.data)
//location.reload()
} else {
alert(data.msg)
}
},
})
})
\ No newline at end of file
}
\ No newline at end of file
......@@ -91,14 +91,7 @@
<button type="button" id="addAdmin" style="margin-right: 170px;margin-left: 20px">Submit</button>
<button type="button" onclick="location.reload()">Cancel</button>
</div>
<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>
<script src="/js/mainSupAdminView.js"></script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment