package com.synnex.wms.controller;
/**
*
* */
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.synnex.wms.pojo.Zhandian;
import com.synnex.wms.service.ZhandianService;
import com.synnex.wms.service.UserService;
import com.synnex.wms.util.PageUtil;
/**
* ZhandianController
* */
@Controller
@RequestMapping(value = "/Zhandian")
public class ZhandianController {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String csrq = formatter.format(currentTime);
@Autowired
private ZhandianService ZhandianService;
@Autowired
private UserService UserService;
/*管理员分页查询、模糊查询*/
@RequestMapping(value = "/page")
public void page(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int pageIndex = 1;//设置初始的当前页,页面显示的都是第一页
int pageSize = 4;//设置每一页显示几条数据,用于计算总页数,此处设置的值必须与sql语句的limit最后的数值一样
PageUtil<Zhandian> pageUtil = new PageUtil<Zhandian>();//初始化工具类
List<Zhandian> list = new ArrayList<Zhandian>();
if (request.getParameter("pageIndex") != null) {
pageIndex = Integer.parseInt(request.getParameter("pageIndex"));
}//对页面上的分页标签传的值,进行获取,也是就点击'上一页或者下一页'传过来的pageindex
pageUtil.setPageIndex(pageIndex);//保存至工具类
String name = request.getParameter("name");
Zhandian Zhandian = new Zhandian();
Zhandian.setName(name);
int number = ZhandianService.pagecount(Zhandian);//调用service层方法计算出总数据量,就是多少条数据.
pageUtil.setPageNumber(number);//保存至工具类
pageUtil.setPageSize(pageSize);//保存至工具类
pageUtil.setPageCount((int) Math.ceil((double) (pageUtil
.getPageNumber() / pageUtil.getPageSize())) + 1);//计算出总页数,并封装到工具类
int index = (pageIndex - 1) * pageSize;//计算出每一页从数据库中第几条数据开始取值,也就是limit后面的第一个数字
Zhandian.setFenye(index);
list = ZhandianService.showlist(Zhandian);//调用service层的方法,取得数据库中的值
pageUtil.setList(list);//保存到工具类中的集合
request.setAttribute("pageUtil", pageUtil);//传递到页面,存入值栈中
request.setAttribute("Zhandian", Zhandian);//传递到页面,存入值栈中
request.getRequestDispatcher("/jsp/Zhandian/list.jsp").forward(request,
response);
}
/*管理员分页查询、模糊查询*/
@RequestMapping(value = "/pageUser")
public void pageUser(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int pageIndex = 1;//设置初始的当前页,页面显示的都是第一页
int pageSize = 4;//设置每一页显示几条数据,用于计算总页数,此处设置的值必须与sql语句的limit最后的数值一样
PageUtil<Zhandian> pageUtil = new PageUtil<Zhandian>();//初始化工具类
List<Zhandian> list = new ArrayList<Zhandian>();
if (request.getParameter("pageIndex") != null) {
pageIndex = Integer.parseInt(request.getParameter("pageIndex"));
}//对页面上的分页标签传的值,进行获取,也是就点击'上一页或者下一页'传过来的pageindex
pageUtil.setPageIndex(pageIndex);//保存至工具类
String name = request.getParameter("name");
Zhandian Zhandian = new Zhandian();
Zhandian.setName(name);
int number = ZhandianService.pagecount(Zhandian);//调用service层方法计算出总数据量,就是多少条数据.
pageUtil.setPageNumber(number);//保存至工具类
pageUtil.setPageSize(pageSize);//保存至工具类
pageUtil.setPageCount((int) Math.ceil((double) (pageUtil
.getPageNumber() / pageUtil.getPageSize())) + 1);//计算出总页数,并封装到工具类
int index = (pageIndex - 1) * pageSize;//计算出每一页从数据库中第几条数据开始取值,也就是limit后面的第一个数字
Zhandian.setFenye(index);
list = ZhandianService.showlist(Zhandian);//调用service层的方法,取得数据库中的值
pageUtil.setList(list);//保存到工具类中的集合
request.setAttribute("pageUtil", pageUtil);//传递到页面,存入值栈中
request.setAttribute("Zhandian", Zhandian);//传递到页面,存入值栈中
request.getRequestDispatcher("/jsp/Zhandian/list1.jsp").forward(request,
response);
}
/*管理员删除数据*/
@RequestMapping(value = "/delete/{id}")
public String delete(@PathVariable Integer id) {
ZhandianService.deleteByPrimaryKey(id);
return "redirect:/Zhandian/page";
}
/*用户删除数据*/
@RequestMapping(value = "/delete1/{id}/{userid}")
public String delete1(@PathVariable Integer id,@PathVariable Integer userid) {
ZhandianService.deleteByPrimaryKey(id);
return "redirect:/Zhandian/page2/"+userid;
}
/*用户删除数据*/
@RequestMapping(value = "/delete3/{id}/{userid}")
public String delete3(@PathVariable Integer id,@PathVariable Integer userid) {
ZhandianService.deleteByPrimaryKey(id);
return "redirect:/Qiantai/dingzhi/"+userid;
}
/*添加、插入数据*/
@RequestMapping(value = "/insert")
public String insertTp(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Zhandian Zhandian=new Zhandian();
FileItemFactory itemFactory=new DiskFileItemFactory();
ServletFileUpload fileUpload=new ServletFileUpload(itemFactory);
try {
List<FileItem> items=fileUpload.parseRequest(request);
for(FileItem fileItem:items){
//判断是否是普通表单数据
if(fileItem.isFormField()){//是普通表单
//获取表单名称
if("name".equals(fileItem.getFieldName())){
Zhandian.setName(fileItem.getString("utf-8"));
}else if("jieshao".equals(fileItem.getFieldName())){
Zhandian.setJieshao(fileItem.getString("utf-8"));
}else if("wh".equals(fileItem.getFieldName())){
if(!"".equals(fileItem.getString())&&fileItem.getString()!=null)
Zhandian.setWh(Integer.parseInt(fileItem.getString()));
}else if("id".equals(fileItem.getFieldName())){
if(!"".equals(fileItem.getString())&&fileItem.getString()!=null)
Zhandian.setId(Integer.parseInt(fileItem.getString()));
}
}else{//文件
if("picture".equals(fileItem.getFieldName())){
//获取上传的文件类型
fileItem.getContentType();
//获取上传的文件的大小
fileItem.getSize();
//获取文件名称
String oldName=fileItem.getName();
if(!"".equals(oldName)&&oldName!=null){
//获取文件的后缀
St
没有合适的资源?快使用搜索试试~ 我知道了~
电子商务网站设计,倾向于网络安全方面的
共1022个文件
gif:660个
png:93个
jpg:50个
需积分: 2 2 下载量 87 浏览量
2023-08-28
00:32:43
上传
评论
收藏 22.62MB ZIP 举报
温馨提示
在传输层和应用层之间为了实现传输信息的可靠性,使用了ssl(TSL安全套接层协议),用于实现数据的可靠传输。并且通过hash SHA-256对用户身份进行验证登录。
资源推荐
资源详情
资源评论
收起资源包目录
电子商务网站设计,倾向于网络安全方面的 (1022个子文件)
AdminController.class 11KB
ZhandianController.class 9KB
UserController.class 8KB
User.class 3KB
AdminService.class 2KB
UserService.class 2KB
ZhandianService.class 2KB
PageUtil.class 2KB
Zhandian.class 2KB
Admin.class 1KB
AdminMapper.class 765B
UserMapper.class 756B
ZhandianMapper.class 736B
.classpath 574B
org.eclipse.wst.common.component 533B
org.eclipse.wst.jsdt.ui.superType.container 49B
amazeui.min.css 227KB
miniui.css 95KB
layui.css 73KB
animsition.min.css 41KB
admin.css 36KB
jedate.css 29KB
skin.css 18KB
skin.css 16KB
layer.css 14KB
skin.css 14KB
skin.css 13KB
skin.css 13KB
skin.css 13KB
skin.css 13KB
flatstyle.css 13KB
skin.css 12KB
skin.css 12KB
style.css 12KB
layui.mobile.css 10KB
large-mode.css 10KB
medium-mode.css 9KB
xadmin.css 8KB
laydate.css 7KB
xsfx.css 7KB
common.css 7KB
skin.css 6KB
skin.css 6KB
skin.css 6KB
skin.css 6KB
skin.css 6KB
skin.css 6KB
jquery-labelauty.css 3KB
drop-down.css 3KB
icons.css 3KB
code.css 1KB
qk.css 909B
font.css 505B
Thumbs.db 290KB
Thumbs.db 17KB
Thumbs.db 7KB
Thumbs.db 6KB
Thumbs.db 5KB
iconfont.eot 48KB
iconfont.eot 46KB
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
4.gif 6KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
3.gif 4KB
23.gif 4KB
34.gif 4KB
41.gif 4KB
38.gif 4KB
65.gif 3KB
32.gif 3KB
45.gif 3KB
7.gif 3KB
12.gif 3KB
26.gif 3KB
60.gif 3KB
2.gif 3KB
40.gif 3KB
25.gif 3KB
共 1022 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
秋生@
- 粉丝: 46
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功