mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
추가
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -31,4 +31,6 @@ public interface AccountMapper {
|
||||
int delete(AccountDto dto);
|
||||
|
||||
AccountDto selectByLogin(AccountDto dto);
|
||||
|
||||
int count(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -29,11 +29,12 @@ public class AccountService {
|
||||
return mapper.selectById(dto);
|
||||
}
|
||||
|
||||
public List<AccountDto> selectAll(String search, int start, int perPage){
|
||||
public List<AccountDto> selectAll(int searchn, String search, int start, int perPage){
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("search", search);
|
||||
map.put("start", start);
|
||||
map.put("perPage", perPage);
|
||||
map.put("searchn", searchn);
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +50,7 @@ public class AccountService {
|
||||
return mapper.selectDeptAll(map);
|
||||
}
|
||||
|
||||
List<PositionDto> selectPosAll(String search, int start, int perPage){
|
||||
List<PositionDto> selectPosAll(int perPage, String search, int start){
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("search", search);
|
||||
map.put("start", start);
|
||||
@@ -69,4 +70,13 @@ public class AccountService {
|
||||
return mapper.selectByLogin(dto);
|
||||
}
|
||||
|
||||
int count(int searchn, String search, int start, int perPage){
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user