This commit is contained in:
Suh
2024-01-16 12:04:48 +09:00
parent f21300a991
commit 88806ccde6
5 changed files with 95 additions and 10 deletions

View File

@@ -1,8 +1,6 @@
package com.no1.wms.account;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.stream.JsonReader;
import com.no1.wms.authority.AuthorityDto;
import com.no1.wms.authority.AuthorityService;
import com.no1.wms.utils.ConstantValues;
@@ -11,7 +9,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.io.StringReader;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -27,11 +24,32 @@ public class AccountController {
AuthorityService authorityService;
@GetMapping("/list")
public ModelAndView list(ModelAndView mav, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "0") int start){
public ModelAndView list(ModelAndView mav,@RequestParam(defaultValue = "0") int searchn, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "1") int page){
int perPage = 10;
int startRow = (page - 1) * perPage;
int count = accountService.count(searchn, search, startRow, perPage);
List<AccountDto> list = accountService.selectAll(search, start, ConstantValues.PER_PAGE);
int pageNum = 4;//보여질 페이지 번호 수
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
//스톡서비스로 재고 리스트 출력 메서트 작성
List<AccountDto> list = accountService.selectAll(searchn, search, searchn, perPage);
int begin = (page - 1) / pageNum * pageNum + 1;
int end = begin + pageNum - 1;
if (end > totalPages) {
end = totalPages;
}
mav.addObject("list", list);
mav.addObject("end", end);
mav.addObject("searchn", searchn);
mav.addObject("search", search);
mav.addObject("page", startRow);
mav.addObject("begin", begin);
mav.setViewName("account/list");
return mav;
}
@@ -120,7 +138,7 @@ public class AccountController {
}else if(name.equals("dept")){
list = accountService.selectDeptAll(search, start, ConstantValues.PER_PAGE);
}else if(name.equals("pos")){
list = accountService.selectPosAll(search, start, ConstantValues.PER_PAGE);
list = accountService.selectPosAll(10, search, start);
}
//
mav.addObject("list", list);