package com.main.controller;
import com.main.dao.glyDao;
import com.main.model.gly;
import com.main.util.DBO;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping({"/gly"})
public class glyController {
@Autowired
glyDao glydao;
@Autowired
private JdbcTemplate jdbcTemplate;
public glyController() {
}
@RequestMapping({"listpage"})
public ModelAndView listpage(HttpServletRequest request, HttpServletResponse response) {
try {
request.setCharacterEncoding("gb2312");
} catch (Exception var10) {
var10.printStackTrace();
}
Map<String, Object> map = new HashMap();
ModelAndView mav = new ModelAndView();
mav.setViewName("gly/glylist");
String glyid = request.getParameter("glyid");
if (glyid != null && !glyid.equals("")) {
map.put("glyid", glyid);
}
String yhm = request.getParameter("yhm");
if (yhm != null && !yhm.equals("")) {
map.put("yhm", yhm);
}
String mm = request.getParameter("mm");
if (mm != null && !mm.equals("")) {
map.put("mm", mm);
}
String xm = request.getParameter("xm");
if (xm != null && !xm.equals("")) {
map.put("xm", xm);
}
List<gly> list = this.glydao.getAll(map);
mav.addObject("list", list);
return mav;
}
@RequestMapping({"add"})
public ModelAndView add(HttpServletRequest request, HttpServletResponse response) {
try {
request.setCharacterEncoding("gb2312");
} catch (Exception var20) {
var20.printStackTrace();
}
ModelAndView mav = new ModelAndView();
mav.setViewName("gly/glyadd");
gly bean = new gly();
String glyid = request.getParameter("glyid");
bean.setGlyid(glyid);
String yhm = request.getParameter("yhm");
bean.setYhm(yhm);
String mm = request.getParameter("mm");
bean.setMm(mm);
String xm = request.getParameter("xm");
bean.setXm(xm);
DBO db = new DBO();
ResultSet rs = null;
String sql = "";
int num = 0;
try {
sql = "select count(1) as num from gly where yhm='" + yhm + "'";
rs = db.query(sql);
if (rs.next()) {
num = rs.getInt("num");
}
if (num > 0) {
request.setAttribute("msg", "<script>alert('添加失败、用户名重复');</script>");
} else {
this.glydao.add(bean);
request.setAttribute("msg", "<script>alert('添加成功');</script>");
}
} catch (Exception var18) {
var18.printStackTrace();
} finally {
db.close();
}
return this.addpage(request, response);
}
@RequestMapping({"addpage"})
public ModelAndView addpage(HttpServletRequest request, HttpServletResponse response) {
try {
request.setCharacterEncoding("gb2312");
} catch (Exception var4) {
var4.printStackTrace();
}
ModelAndView mav = new ModelAndView();
mav.setViewName("gly/glyadd");
return mav;
}
@RequestMapping({"del"})
public ModelAndView del(HttpServletRequest request, HttpServletResponse response) {
String id = request.getParameter("keyid");
new ModelAndView();
try {
this.glydao.delete(Integer.parseInt(id));
} catch (Exception var6) {
var6.printStackTrace();
}
request.setAttribute("msg", "<script>alert('删除成功');</script>");
return this.listpage(request, response);
}
@RequestMapping({"detail"})
public ModelAndView detail(HttpServletRequest request, HttpServletResponse response) {
String id = request.getParameter("keyid");
try {
request.setCharacterEncoding("gb2312");
} catch (Exception var8) {
var8.printStackTrace();
}
new gly();
ModelAndView mav = new ModelAndView();
mav.setViewName("gly/glydetail");
try {
gly bean = this.glydao.getglyByID(Integer.parseInt(id));
request.setAttribute("glyid", bean.getGlyid());
request.setAttribute("yhm", bean.getYhm());
request.setAttribute("mm", bean.getMm());
request.setAttribute("xm", bean.getXm());
} catch (Exception var7) {
var7.printStackTrace();
}
return mav;
}
@RequestMapping({"modifypage"})
public ModelAndView modifypage(HttpServletRequest request, HttpServletResponse response) {
String id = request.getParameter("keyid");
new gly();
ModelAndView mav = new ModelAndView();
mav.setViewName("gly/glymodify");
try {
gly bean = this.glydao.getglyByID(Integer.parseInt(id));
request.setAttribute("glyid", bean.getGlyid());
request.setAttribute("yhm", bean.getYhm());
request.setAttribute("mm", bean.getMm());
request.setAttribute("xm", bean.getXm());
} catch (Exception var7) {
var7.printStackTrace();
}
return mav;
}
@RequestMapping({"mod"})
public ModelAndView mod(HttpServletRequest request, HttpServletResponse response) {
String id = (String)request.getSession().getAttribute("id");
new gly();
ModelAndView mav = new ModelAndView();
mav.setViewName("gly/modify");
try {
gly bean = this.glydao.getglyByID(Integer.parseInt(id));
request.setAttribute("glyid", bean.getGlyid());
request.setAttribute("yhm", bean.getYhm());
request.setAttribute("mm", bean.getMm());
request.setAttribute("xm", bean.getXm());
} catch (Exception var7) {
var7.printStackTrace();
}
return mav;
}
@RequestMapping({"upd"})
public ModelAndView upd(HttpServletRequest request, HttpServletResponse response) {
try {
request.setCharacterEncoding("gb2312");
} catch (Exception var9) {
var9.printStackTrace();
}
new ModelAndView();
gly bean = new gly();
String glyid = request.getParameter("glyid");
bean.setGlyid(glyid);
String yhm = request.getParameter("yhm");
bean.setYhm(yhm);
String mm = request.getParameter("mm");
bean.setMm(mm);
String xm = request.getParameter("xm");
bean.setXm(xm);
this.glydao.update(bean);
request.setAttribute("msg", "<script>alert('修改成功');</script>");
return this.mod(request, response);
}
@RequestMapping({"update"})
public ModelAndView update(HttpServletRequest request, HttpServletResponse response) {
try {
request.setCharacterEncoding("gb2312");
} catch (Exception var9) {
var9.printStackTrace();
}
new ModelAndView();
gly bean = new gly();
String glyid = request.getParameter("glyid");
bean.setGlyid(glyid);
String yhm = request.getParameter("yhm");
bean.setYhm(yhm);
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
一、源码特点 springboot 数码商城系统是一套完善的完整信息系统,结合mvc框架和LayUI框架完成本系统springboot spring mybatis ,对理解JSP java编程开发语言有帮助系统采用springboot框架 (MVC模式开发),系统具有完整的源代码和数据库,系统主要采用B/S模式开发。 前段主要技术 css jquery LayUI框架 后端主要技术 Springboot spring mybatis 数据库 mysql 开发工具 IDEA JDK1.8 二、功能介绍 如博客中介绍 三、注意事项 1、管理员账号:admin密码:admin 数据库配置文件src\main\resources 下的 application.properties 2、开发环境为IDEA开发,数据库为mysql,使用java语言开发。 3、数据库文件名是jspspsm.sql 系统名称spsm 4、地址:qt/index.jsp 不含人工
资源推荐
资源详情
资源评论
收起资源包目录
idea Springboot 数码商城系统LayUI框架开发mysql数据库web结构java编程计算机网页源码 (963个子文件)
main.css.bak 8KB
main.css.bak 8KB
lanrenzhijia.css.bak 2KB
lanrenzhijia.css.bak 2KB
glyController.class 7KB
yonghuController.class 7KB
dingdanController.class 7KB
shangpinController.class 6KB
ddmxController.class 6KB
ddpjController.class 6KB
gonggaoController.class 5KB
splbController.class 5KB
DBO.class 4KB
StaticMethod.class 3KB
dingdan.class 2KB
shangpin.class 2KB
ddmx.class 2KB
yonghu.class 2KB
ddpj.class 2KB
shangpinService.class 1KB
indexController.class 1KB
gonggaoService.class 1KB
dingdanService.class 1KB
yonghuService.class 1KB
ddpjService.class 1KB
splbService.class 1KB
ddmxService.class 1KB
glyService.class 1KB
gonggao.class 1KB
gly.class 1KB
splb.class 766B
MainApplication.class 717B
shangpinDao.class 565B
dingdanDao.class 559B
gonggaoDao.class 559B
yonghuDao.class 553B
ddpjDao.class 541B
ddmxDao.class 541B
splbDao.class 541B
glyDao.class 535B
MainApplicationTests.class 515B
layui.css 59KB
layui.css 59KB
style.css 22KB
style.css 22KB
layer.css 14KB
layer.css 14KB
admin.css 11KB
admin.css 11KB
layui.mobile.css 10KB
layui.mobile.css 10KB
main.css 8KB
main.css 8KB
album.css 8KB
album.css 8KB
laydate.css 7KB
laydate.css 7KB
css_body.css 7KB
css_body.css 7KB
laydate.css 6KB
laydate.css 6KB
login.css 6KB
login.css 6KB
content.css 5KB
content.css 5KB
public.css 4KB
public.css 4KB
datepicker.css 4KB
datepicker.css 4KB
datepicker.css 4KB
datepicker.css 4KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
laydate.css 3KB
css_top_user.css 3KB
css_top_user.css 3KB
css_top.css 3KB
css_top.css 3KB
view.css 3KB
view.css 3KB
css_menu_user.css 3KB
css_menu_user.css 3KB
base.css 3KB
base.css 3KB
css_menu.css 2KB
css_menu.css 2KB
lanrenzhijia.css 2KB
lanrenzhijia.css 2KB
all.css 2KB
all.css 2KB
wbox.css 2KB
共 963 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
翰文编程
- 粉丝: 1w+
- 资源: 2037
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功