• 项目总结-新增商品-Pagehelper插件分页查询


    (1)新增商品

    工具类:

    1. /**
    2. * @Title: FileUtils.java
    3. * @Package com.qfedu.common.utils
    4. * @Description: TODO(用一句话描述该文件做什么)
    5. * @author Feri
    6. * @date 2018年5月29日
    7. * @version V1.0
    8. */
    9. package com.gdsdxy.common.utils;
    10. import java.io.File;
    11. import java.text.SimpleDateFormat;
    12. import java.util.Date;
    13. import java.util.UUID;
    14. /**
    15. * @Title: FileUtils.java
    16. * @Package com.qfedu.common.utils
    17. * @Description: TODO(用一句话描述该文件做什么)
    18. * @author Feri
    19. * @date 2018年5月29日
    20. * @version V1.0
    21. * 文件工具类
    22. */
    23. public class FileUtils {
    24. //创建文件夹 一个月一个文件夹
    25. public static File createDir(String dir) {
    26. //子文件名称:201805 201806
    27. String month=new SimpleDateFormat("yyyyMM").format(new Date());
    28. File dir1=new File(new File(dir).getParent(),"fmwimages");
    29. File dir2=new File(dir1,month) ;
    30. if(!dir2.exists()) {
    31. dir2.mkdirs();
    32. }
    33. return dir2;
    34. }
    35. //创建唯一名称
    36. public static String createFileName(String fn) {
    37. if(fn.length()>30) {
    38. fn=fn.substring(fn.length()-30);
    39. }
    40. return UUID.randomUUID().toString()+"_"+fn;
    41. }
    42. }

    Controller:

    Service:

    实现类:

    Dao:

    insert into t_goods(name,price,pubdate,typeName,intro,picture,flag,star,num) values(#{name},#{price},#{pubdate},#{typeName},#{intro},#{picture},1,#{star},#{num})
    1. //新增
    2. @Insert("insert into t_goods(name,price,pubdate,typeName,intro,picture,flag,star,num) values(#{name},#{price},#{pubdate},#{typeName},#{intro},#{picture},1,#{star},#{num})")
    3. public int save(Goods goods);

    (2)分页查询-Pagehelper插件

     

    Controller:

    OrderService:

    实现类 

    OrderDao: 

    显示页面:

    1. <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    3. <%@ page language="java" contentType="text/html; charset=utf-8"
    4. pageEncoding="utf-8"%>
    5. "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    6. "Content-Type" content="text/html; charset=utf-8">
    7. HITECH-订单管理
    8. "X-UA-Compatible" content="IE=edge">
    9. "viewport" content="width=device-width, initial-scale=1">
    10. "stylesheet" href="${pageContext.request.contextPath }/css/bootstrap.min.css">
    11. "row" style="width:100%;margin-left: 1%;margin-top: 5px;">
    12. "col-xs-12 col-sm-12 col-md-12 col-lg-12">
    13. "panel panel-default">
    14. "panel-heading">
    15. 订单管理
  • "panel-body">
  • "row">
  • "col-xs-5 col-sm-5 col-md-5 col-lg-5">
  • "form-group form-inline">
  • 用户姓名
  • "text" name="username" class="form-control">
  • "col-xs-5 col-sm-5 col-md-5 col-lg-5">
  • "form-group form-inline">
  • 订单状态
  • "col-xs-2 col-sm-2 col-md-2 col-lg-2">
  • "tb_list" class="table table-striped table-hover table-bordered">
  • "${orders}" var="order" varStatus="i">
  • 序号订单编号总金额订单状态订单时间用户姓名操作
    ${i.count}${order.id}${order.money}
  • if test="${order.flag eq 1}">
  • 未支付
  • if>
  • if test="${order.flag eq 2}">
  • 已支付,待发货
  • if>
  • if test="${order.flag eq 3}">
  • 已发货,待收货
  • if>
  • if test="${order.flag eq 4}">
  • 已收货,未评价
  • if>
  • if test="${order.flag eq 5}">
  • 订单完成
  • if>
  • ${order.createtime}${order.username}
  • if test="${order.flag eq 2}">
  • if>
  • 每页${page.pageSize}条 当前页${page.size}条 ${page.pageNum}/${page.pages}页 总条数${page.total}
  • if test="${page.isFirstPage==true}">首页if>
  • if test="${page.isFirstPage==false}">
  • if>
  • if test="${page.hasPreviousPage==true}">
  • if>
  • if test="${page.hasPreviousPage==false}">上一页if>
  • if test="${page.hasNextPage==true}">
  • if>
  • if test="${page.hasNextPage==false}">下一页if>
  • if test="${page.isLastPage==true}">末页if>
  • if test="${page.isLastPage==false}">
  • if>
  • 根据条件查询

    Controller:

    OrderService:

    实现类:

     OrderDao

    1. //根据用户姓名和订单的支付状态查询订单(admin)
    2. @Select("")
    3. @ResultType(Order.class)
    4. public List selectByNameAndFlag(@Param("username") String username, @Param("flag") Integer flag);

  • 相关阅读:
    150398-22-4,三肽Phe-Arg-Arg
    flutter 抓包工具charles
    maven
    L2桥接风险架构
    【C语言】浅谈代码运行效率及内存优化
    如何在Docker环境下安装Firefox浏览器并结合内网穿透工具实现公网访问
    pwncollege.ReverseEngineering
    ES5中实现继承
    【批处理DOS-CMD命令-汇总和小结】-查看或修改文件属性(ATTRIB),查看、修改文件关联类型(assoc、ftype)
    不完全微分PD控制器(CODESYS源代码+算法详细介绍)
  • 原文地址:https://blog.csdn.net/dengfengling999/article/details/134045838