基于javaweb+SSM甜品冰淇淋奶茶店网上订餐系统

基于javaweb+SSM甜品冰淇淋奶茶店网上订餐系统,第1张

基于javaweb+SSM甜品冰淇淋奶茶店网上订餐系统(前台、后台)

开发工具:eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

    where id = #{id,jdbcType=INTEGER}
  update>
mapper>

DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dao.GoodsDao" >
  <resultMap id="BaseResultMap" type="com.entity.Goods" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="cover" property="cover" jdbcType="VARCHAR" />
    <result column="image1" property="image1" jdbcType="VARCHAR" />
    <result column="image2" property="image2" jdbcType="VARCHAR" />
    <result column="price" property="price" jdbcType="INTEGER" />
    <result column="intro" property="intro" jdbcType="VARCHAR" />
    <result column="stock" property="stock" jdbcType="INTEGER" />
    <result column="type_id" property="typeId" jdbcType="INTEGER" />
  resultMap>
  <sql id="Base_Column_List" >
    id, name, cover, image1, image2, price, intro, stock, type_id
  sql>
  <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
	public boolean dispose(int id) {
		Orders order = orderDao.selectById(id);
		order.setStatus(Orders.STATUS_SEND);
		return orderDao.updateByIdSelective(order) > 0;
	}
	
	/**
	 * 订单完成
	 * @param id
	 * @return 
	 */
	public boolean finish(int id) {
		Orders order = orderDao.selectById(id);
		order.setStatus(Orders.STATUS_FINISH);
		return orderDao.updateByIdSelective(order) > 0;
	}

	/**
	 * 删除订单
	 * @param id
	 */
	public boolean delete(int id) {
		return orderDao.deleteById(id) > 0;
	}
		
		$("#paytype").val(paytype);
		$("#payform").submit();
	}
script>

body>
html>

DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dao.OrdersDao" >
  <resultMap id="BaseResultMap" type="com.entity.Orders" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="total" property="total" jdbcType="INTEGER" />
    <result column="amount" property="amount" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="paytype" property="paytype" jdbcType="TINYINT" />
    <result column="name" property="name" jdbcType="VARCHAR" />
		return "/index/login.jsp";
	}
	
	/**
	 * 查看购物车
	 * @return
	 */
	@RequestMapping("/cart")
	public String cart(Model model) {
		model.addAttribute("typeList", typeService.getList());
		return "/index/cart.jsp";
	}
	
	/**
					<a href="javascript:dopay(1);"> 
						<img src="images/wechat.jpg" alt="微信支付">
					a>
				div>
			div>
			<div class="col-sm-6 col-md-4 col-lg-3 ">
				<div class="thumbnail">
					<a href="javascript:dopay(2);"> 
						<img src="images/alipay.jpg" alt="支付宝支付">
					a>
				div>
			div>
			<div class="col-sm-6 col-md-4 col-lg-3 ">
				<div class="thumbnail">
					<a href="javascript:dopay(3);"> 
						<img src="images/offline.jpg" alt="货到付款">
					a>
				div>
			div>
		div>
	 * 产品添加
	 * 
	 * @return
	 */
	@RequestMapping("/goodAdd")
	public String goodAdd(HttpServletRequest request) {
		request.setAttribute("flag", 3);
		request.setAttribute("typeList", typeService.getList());
		return "/admin/good_add.jsp";
	}

	/**
	 * 产品添加
	 * 
	 * @return
	 * @throws Exception 
	 */
		model.addAttribute("msg", "信息修改成功!");
		// 修改密码
		if(user.getPasswordNew()!=null && !user.getPasswordNew().trim().isEmpty()) {
			if (user.getPassword()!=null && !user.getPassword().trim().isEmpty() 
					&& SafeUtil.encode(user.getPassword()).equals(u.getPassword())) {
				if (user.getPasswordNew()!=null && !user.getPasswordNew().trim().isEmpty()) {
					u.setPassword(SafeUtil.encode(user.getPasswordNew()));
				}
				userService.update(u);  // 更新数据库
				session.setAttribute("user", u); // 更新session
				model.addAttribute("msg", "密码修改成功!");
			}else {
				model.addAttribute("msg", "原密码错误!");
			}
		}
		return "/index/my.jsp";
	}
	
	 * 通过名称获取产品列表
	 * @param page
	 * @param size
	 * @return
	 */
	public List<Goods> getListByName(String name, int page, int size){
		return goodDao.getListByName(name, size * (page-1), size);
	}
	
	/**
	 * 通过名称获取产品总数
	 * @return
	 */
	public long getTotalByName(String name){
		return goodDao.getTotalByName(name);
	}

	/**
	 * 通过分类搜索

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
    set>
    where id = #{id,jdbcType=INTEGER}
  update>
  <update id="updateById" parameterType="com.entity.Goods" >
    update goods
    set name = #{name,jdbcType=VARCHAR},
      cover = #{cover,jdbcType=VARCHAR},
      image1 = #{image1,jdbcType=VARCHAR},
      image2 = #{image2,jdbcType=VARCHAR},
      price = #{price,jdbcType=INTEGER},
      intro = #{intro,jdbcType=VARCHAR},
      stock = #{stock,jdbcType=INTEGER},
      type_id = #{typeId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  update>
mapper>

)
	public @ResponseBody String delete(int goodid, HttpSession session){
		Orders order = (Orders) session.getAttribute(INDENT_KEY);
		if (order != null) {
			session.setAttribute(INDENT_KEY, orderService.deleteIndentItem(order, goodService.get(goodid)));
		}
		return "ok";
	}
	
	
	/**
	 * 提交订单
	 * @return
	 */
	@RequestMapping("/save")
	public String save(ServletRequest request, HttpSession session, Model model){
		model.addAttribute("typeList", typeService.getList());
		Users user = (Users) session.getAttribute("user");

运行环境

Java≥8、Tomcat≥7.0、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

技术框架

JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) MySQL jQuery Bootstrap JavaScript CSS

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

分为前台和后台管理

前台用户可以注册、登录、查看商品列表与商品详情、加入购物车、下单购买等

后台管理员可以管理用户、商品、分类、订单等

前台

后台


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/877488.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-13
下一篇 2022-05-13

发表评论

登录后才能评论

评论列表(0条)

保存