package com.hzy.quetosys.controller;
import com.github.pagehelper.PageInfo;
import com.hzy.quetosys.entity.Product;
import com.hzy.quetosys.entity.ProductType;
import com.hzy.quetosys.service.ProductService;
import com.hzy.quetosys.service.ProductTypeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class ProductController {
private static final Logger logger= LoggerFactory.getLogger(ProductController.class);
@Autowired
private ProductService productService;
@Autowired
private ProductTypeService productTypeService;
@GetMapping("/product/produce_add")
public ModelAndView produceAddView(){
ModelAndView mav=new ModelAndView("product/produce_add");
List<ProductType> productTypes= productTypeService.findAll();
mav.addObject("productTypes",productTypes);
return mav;
}
@GetMapping("/product/produce_list")
public ModelAndView produceListView(
@RequestParam(name = "pageNum",required = true,defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize",required = true,defaultValue = "5") int pageSize,
@RequestParam(name = "keyword",required = false) String keyword
){
ModelAndView mav=new ModelAndView("product/produce_list");
PageInfo<Product> page=productService.findByKeyword(pageNum,pageSize,keyword);
mav.addObject("page",page);
// mav.addObject(page);
return mav;
}
@GetMapping("/product/produce_modify")
public ModelAndView produceModifyView(
@RequestParam(name = "pageNum",required = true,defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize",required = true,defaultValue = "5") int pageSize,
@RequestParam(name = "id" ,required = true) int id,
@RequestParam(name = "keyword",required = false) String keyword
){
ModelAndView mav=new ModelAndView("product/produce_modify");
Product product=productService.findById(id);
mav.addObject("product",product);
return mav;
}
@PostMapping("/product/produce_add")
public ModelAndView produceAdd(@Validated Product product, BindingResult bindingResult){
ModelAndView mav=new ModelAndView("redirect:/product/produce_add");
Map<String,String> errorMessages=new HashMap<>();
if(bindingResult.hasErrors()){
final List<FieldError> fieldErrors = bindingResult.getFieldErrors();
for(FieldError error:fieldErrors){
errorMessages.put(error.getField(),error.getDefaultMessage());
}
mav.addObject("errorMessages",errorMessages);
mav.addObject("product",product);
mav.setViewName("product/produce_add");
}else {
boolean result= productService.append(product);
if(result){
logger.info("新增客户信息成功-"+product);
}else {
logger.info("新增客户信息失败-"+product);
}
}
return mav;
}
@PostMapping("/product/produce_modify")
public ModelAndView produceModify(
@RequestParam(name = "pageNum",required = true,defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize",required = true,defaultValue = "5") int pageSize,
@RequestParam(name = "keyword",required = false) String keyword,
Product product
) throws UnsupportedEncodingException {
String redirectUrl="redirect:/product/produce_list?pageNum="+pageNum+"&pageSize="+pageSize+"&keyword="+ URLEncoder.encode(keyword,"utf-8");
ModelAndView mav=new ModelAndView(redirectUrl);
boolean result=productService.modify(product);
return mav;
}
@GetMapping("/product/produce_remove")
public ModelAndView produceRemove(
@RequestParam(name = "pageNum",required = true,defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize",required = true,defaultValue = "5") int pageSize,
@RequestParam(name = "id" ,required = true) int id,
@RequestParam(name = "keyword",required = false) String keyword
) throws UnsupportedEncodingException {
String redirectUrl="redirect:/product/produce_list?pageNum="+pageNum+"&pageSize="+pageSize+"&keyword="+ URLEncoder.encode(keyword,"utf-8");
ModelAndView mav=new ModelAndView(redirectUrl);
boolean result=productService.remove(id);
return mav;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于JavaScript的个人理财系统设计源码
共715个文件
scss:148个
js:94个
jpg:78个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 160 浏览量
2024-04-15
18:06:28
上传
评论
收藏 71.22MB ZIP 举报
温馨提示
基于JavaScript的个人理财系统设计源码,该项目包含715个文件,主要文件类型有148个scss样式文件,以及94个javascript文件。此外,还包括78个jpg图像文件,60个png图像文件,以及60个html页面文件。该项目是一个基于JavaScript的个人理财系统设计源码,可能涉及用户界面设计、应用逻辑实现、数据存储等多个方面。
资源推荐
资源详情
资源评论
收起资源包目录
基于JavaScript的个人理财系统设计源码 (715个子文件)
ProductController.class 6KB
PayOutController.class 6KB
IncomeController.class 6KB
ProductTypeController.class 6KB
CustomerController.class 6KB
Product.class 6KB
OrderController.class 6KB
UserController.class 6KB
User.class 4KB
Customer.class 4KB
PayOut.class 3KB
Income.class 3KB
UserServiceImpl.class 3KB
Order.class 3KB
ProductTypeServiceImpl.class 3KB
ProductType.class 3KB
CustomerServiceImpl.class 3KB
ProductServiceImpl.class 3KB
IncomeServiceImpl.class 3KB
PayOutServiceImpl.class 3KB
LoginController.class 3KB
OrderServiceImpl.class 2KB
AppConfig.class 1KB
LoginInterceptor.class 1KB
GlobalExceptionHandler.class 1KB
CustomerMapper.class 1KB
QuetoSysApplication.class 919B
UserMapper.class 884B
UserService.class 825B
IndexController.class 787B
CustomerService.class 771B
ProductService.class 764B
PayOutService.class 757B
IncomeService.class 757B
ProductTypeService.class 741B
ProductMapper.class 707B
PayOutMapper.class 696B
IncomeMapper.class 696B
ProductTypeMapper.class 684B
OrderMapper.class 642B
OrderService.class 598B
QuetoSysApplicationTests.class 543B
icons.css 422KB
icons.css 422KB
icons.min.css 341KB
icons.min.css 341KB
app-dark-rtl.css 234KB
app-dark-rtl.css 234KB
app-rtl.css 234KB
app-rtl.css 234KB
bootstrap-dark.css 234KB
bootstrap-dark.css 234KB
bootstrap.css 234KB
bootstrap.css 234KB
app-dark-rtl.min.css 191KB
app-dark-rtl.min.css 191KB
app-rtl.min.css 191KB
app-rtl.min.css 191KB
bootstrap-dark.min.css 189KB
bootstrap-dark.min.css 189KB
bootstrap.min.css 189KB
bootstrap.min.css 189KB
app.css 176KB
app.css 176KB
app-dark.css 176KB
app-dark.css 176KB
app-dark.min.css 146KB
app-dark.min.css 146KB
app.min.css 145KB
app.min.css 145KB
jquery-ui.min.css 30KB
jquery-ui.min.css 30KB
metisMenu.min.css 2KB
metisMenu.min.css 2KB
2022-06-09T14-16-29_951-jvmRun1.dump 1022B
2022-06-09T12-56-31_061-jvmRun1.dump 1021B
materialdesignicons-webfont.eot 790KB
materialdesignicons-webfont.eot 790KB
fa-solid-900.eot 190KB
fa-solid-900.eot 190KB
fa-brands-400.eot 129KB
fa-brands-400.eot 129KB
line-awesome.eot 110KB
line-awesome.eot 110KB
typicons.eot 98KB
typicons.eot 98KB
themify.eot 77KB
themify.eot 77KB
dripicons-v2.eot 40KB
dripicons-v2.eot 40KB
fa-regular-400.eot 34KB
fa-regular-400.eot 34KB
produce_add.html 13KB
produce_add.html 13KB
produce_list.html 13KB
produce_list.html 13KB
income_list.html 12KB
income_list.html 12KB
produce_type_list.html 12KB
produce_type_list.html 12KB
共 715 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
沐知全栈开发
- 粉丝: 5701
- 资源: 5215
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功