mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
planin 작업 중
This commit is contained in:
@@ -1,5 +1,56 @@
|
||||
package com.no1.wms.planin;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import com.no1.wms.planin.PlanInService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping("planin")
|
||||
public class PlanInController {
|
||||
@Autowired
|
||||
PlanInService planinservice;
|
||||
|
||||
@GetMapping("/list")
|
||||
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 = planinservice.count(searchn, search, startRow, perPage);
|
||||
|
||||
|
||||
|
||||
int pageNum = 4;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
|
||||
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<AccountDto> list = planinservice.selectAll(searchn, search, startRow, 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("pageNum", pageNum);
|
||||
mav.addObject("begin", begin);
|
||||
mav.addObject("page", page);
|
||||
mav.setViewName("account/list");
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,18 @@
|
||||
package com.no1.wms.planin;
|
||||
|
||||
public class PlanInMapper {
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface PlanInMapper {
|
||||
|
||||
List<AccountDto> selectAll(Map<String, Object> m);
|
||||
|
||||
int count(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
package com.no1.wms.planin;
|
||||
|
||||
public class PlanInService {
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
|
||||
@Service
|
||||
public class PlanInService {
|
||||
@Autowired
|
||||
PlanInMapper mapper;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
return mapper.selectAll(map);
|
||||
}
|
||||
|
||||
|
||||
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