mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
change list Date value and add In Controller,Dto, mapper, mapper.xml,
service, views and change minor details
This commit is contained in:
@@ -1,5 +1,64 @@
|
||||
package com.no1.wms.in;
|
||||
|
||||
public class InController {
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/in")
|
||||
public class InController {
|
||||
|
||||
@Autowired
|
||||
InService inService;
|
||||
|
||||
@GetMapping("/list")
|
||||
//@ResponseBody
|
||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||
|
||||
int count = inService.count(searchn, search);
|
||||
|
||||
int perPage = 15;
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<InDto> dto = inService.inList(searchn, search, startRow, perPage);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
|
||||
m.addAttribute("list", dto);
|
||||
m.addAttribute("start", startRow + 1);
|
||||
m.addAttribute("searchn",searchn);
|
||||
m.addAttribute("search",search);
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
m.addAttribute("totalPages", totalPages);
|
||||
m.addAttribute("p" , page);
|
||||
|
||||
|
||||
return "/in/list";
|
||||
|
||||
}
|
||||
@PostMapping("/create")
|
||||
public String create() {
|
||||
return "in/create";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,46 @@
|
||||
package com.no1.wms.in;
|
||||
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.ibatis.type.Alias;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import com.no1.wms.planin.PlanInDto;
|
||||
import com.no1.wms.product.ProductDto;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Alias("InDto")
|
||||
public class InDto {
|
||||
|
||||
private String id;
|
||||
private String group_number;
|
||||
private String product_id;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date in_date;
|
||||
private String quantity;
|
||||
private String warehouse_id;
|
||||
private String manager_id;
|
||||
private String note;
|
||||
private boolean activation;//활성화
|
||||
private int latest_price;
|
||||
|
||||
private PlanInDto planInDto;
|
||||
private ProductDto productDto;
|
||||
private WarehouseDto warehouseDto;
|
||||
private AccountDto accountDto;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package com.no1.wms.in;
|
||||
|
||||
public class InMapper {
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface InMapper {
|
||||
List<InDto> inList(Map<String, Object> m);
|
||||
int count(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
package com.no1.wms.in;
|
||||
|
||||
public class InService {
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class InService {
|
||||
|
||||
@Autowired
|
||||
InMapper mapper;
|
||||
|
||||
public List<InDto> inList(int searchn, String search, int start, int perPage){
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
return mapper.inList(m);
|
||||
}
|
||||
|
||||
public int count(int searchn, String search) {
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count(m);
|
||||
};//카운터
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,12 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
@@ -29,13 +31,16 @@ public class MypageController {
|
||||
|
||||
@Autowired
|
||||
ImgService imgService;
|
||||
|
||||
|
||||
|
||||
@GetMapping("/mypage")
|
||||
public String mypage(Model m, HttpServletRequest request) {
|
||||
public String mypage(Model m, HttpSession session) {
|
||||
|
||||
HttpSession session = request.getSession();
|
||||
//HttpSession session = request.getSession();
|
||||
AccountDto dto = (AccountDto) session.getAttribute("userData");
|
||||
|
||||
|
||||
//System.out.println(dto.getId());
|
||||
|
||||
AccountDto list = accountService.selectById(dto);
|
||||
m.addAttribute("list", list);
|
||||
|
||||
@@ -88,9 +93,9 @@ public class MypageController {
|
||||
}
|
||||
|
||||
@PostMapping("/mypage/uplodeImg")
|
||||
public String imgFileUplode(HttpServletRequest request, MultipartFile file) {
|
||||
public String imgFileUplode(HttpServletRequest request,HttpSession session , MultipartFile file) {
|
||||
//System.out.println(file);
|
||||
HttpSession session = request.getSession();
|
||||
//HttpSession session = request.getSession();
|
||||
AccountDto dto = (AccountDto) session.getAttribute("userData");
|
||||
String fileName = dto.getId();
|
||||
//System.out.println(fileName);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.no1.wms.price;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.ibatis.type.Alias;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import com.no1.wms.product.ProductDto;
|
||||
@@ -21,6 +22,7 @@ public class PriceDto {
|
||||
|
||||
private String id;//id
|
||||
private String price;//가격
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date registration_date;//등록날짜
|
||||
private String manager_id;//담당자
|
||||
private String product_id; //제품 아이디
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.no1.wms.product;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -14,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import com.no1.wms.account.AccountService;
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.category.CategoryService;
|
||||
import com.no1.wms.price.PriceDto;
|
||||
@@ -30,6 +35,9 @@ public class ProductController {
|
||||
CategoryService categoryService;
|
||||
@Autowired
|
||||
VendorService service;
|
||||
@Autowired
|
||||
AccountService accountService;
|
||||
|
||||
|
||||
/*
|
||||
@GetMapping("list")
|
||||
@@ -81,7 +89,7 @@ public class ProductController {
|
||||
|
||||
// 생성 - 폼
|
||||
@PostMapping("/create")
|
||||
public String create() {
|
||||
public String create() {
|
||||
return "/product/create";
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.no1.wms.product;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.ibatis.type.Alias;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import com.no1.wms.authority.AuthorityDto;
|
||||
@@ -27,6 +28,7 @@ public class ProductDto {
|
||||
private String company_name = "미지정";//회사명
|
||||
private String kan_code;//분류코드
|
||||
private String vendor_id;//거래처 id
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date registration_date;//등록날짜
|
||||
private String manager_id;//담당자
|
||||
private boolean activation;//활성화
|
||||
|
||||
Reference in New Issue
Block a user