0
点赞
收藏
分享

微信扫一扫

基于javaweb+jsp的校园快递管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Layui Ajax)

yundejia 2022-04-14 阅读 96
javamysql

基于javaweb+jsp的校园快递管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Layui Ajax)

JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Layui Ajax

基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可

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

适用

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

    session.removeAttribute("alert_msg");
    //登录拦截
    String uri = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/"));
    String[] access = new String[]{"login", "logout", "register", ".css", ".js", ".png", ".jpg", "validationCode"};
    for (String action : access) {
        if (uri.toLowerCase().contains(action.toLowerCase())) {
            return true;
        }
    }
    if (session.getAttribute("loginUser") == null) {
        session.setAttribute("alert_msg", "错误:请先登录!");
        response.sendRedirect("login.jsp");
        return false;
    }
    return true;
}

//@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {

</select>
<?xml version="1.0" encoding="UTF-8"?>
<resultMap id="BaseResultMap" type="com.demo.vo.Notice" >
        <result column="id" property="id" />
        <result column="notice_name" property="noticeName" />
        <result column="notice_text" property="noticeText" />
        <result column="notice_type" property="noticeType" />
        <result column="create_date" property="createDate" />
</resultMap>

<sql id="Base_Column_List">
    `id`,`notice_name`,`notice_text`,`notice_type`,`create_date`
</sql>
            <if test ='userText != null'>`user_text` = #{userText},</if>
            <if test ='userType != null'>`user_type` = #{userType}</if>
    </set>
    WHERE `id` = #{id}
</update>

<!--获取-->
<select id="findById" resultMap="BaseResultMap">
    SELECT <include refid="Base_Column_List" /> FROM `t_user` WHERE `id` = #{id}
</select>

<!--列表-->
<select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap">
    SELECT <include refid="Base_Column_List" /> FROM `t_user`
    <where>
        <if test="searchColumn != null and searchColumn != '' and keyword != null and keyword != ''">
            ${searchColumn} LIKE CONCAT('%',#{keyword},'%')  AND
        </if>
        1=1
    </where>
    ORDER BY id ASC
    <if test="startIndex != null and pageSize != null">
        LIMIT #{startIndex},#{pageSize};
    </if>
</select>
    </foreach>
</delete>

<!--修改-->
<update id="doUpdate" parameterType="com.demo.vo.Express">
    UPDATE `t_express`
    <set>
            <if test ='id != null'>`id` = #{id},</if>
            <if test ='expressNo != null'>`express_no` = #{expressNo},</if>
            <if test ='expressName != null'>`express_name` = #{expressName},</if>
            <if test ='expressPhone != null'>`express_phone` = #{expressPhone},</if>
            <if test ='expressArea != null'>`express_area` = #{expressArea},</if>
            <if test ='expressStatus != null'>`express_status` = #{expressStatus},</if>
            <if test ='expressSign != null'>`express_sign` = #{expressSign},</if>
            <if test ='expressTime != null'>`express_time` = #{expressTime},</if>
            <if test ='expressText != null'>`express_text` = #{expressText}</if>
    </set>
    WHERE `id` = #{id}
</update>

<!--获取-->
<select id="findById" resultMap="BaseResultMap">
    Serializable id = Util.decode(request, "id");
    expressService.delete(Arrays.asList(id));
    this.redirectList(request, response);
}

/**
 * 编辑快递
 *
 * @param response
 * @param request
 * @throws IOException
 */
@RequestMapping("expressEdit")
public void edit(HttpServletResponse response, HttpServletRequest request) throws IOException {
    Express vo = new Express();
    vo.setId(Long.valueOf(Util.decode(request, "id")));
    vo.setExpressNo(Util.decode(request, "expressNo"));
    vo.setExpressName(Util.decode(request, "expressName"));
        /*background-image: linear-gradient(to right, #fbc2eb, #a6c1ee); 设置渐变色 */
        padding: 0;
        margin: 0;
        background: url("img/1.jpg") no-repeat;
        background-size: 100% 100%;
    }

    .login-wrapper {
        background-color: #fff;
        width: 250px;
        height: 500px;
        position: relative;
        padding: 0 50px;
        border-radius: 15px;
        /* 设置框的居中位置也可以采用flex布局方式 */
        left: 50%;
        top: 50%;
        letter-spacing: .05em;
    }

    html {
        height: 100%;
    }

    body {
        height: 100%;
    }

    .container {
        height: 100%;
        /*background-image: linear-gradient(to right, #fbc2eb, #a6c1ee); 设置渐变色 */
        padding: 0;
        margin: 0;
        background: url("img/1.jpg") no-repeat;
        background-size: 100% 100%;
    }

    request.getRequestDispatcher("reset_password.jsp").forward(request, response);
}

// 返回一个随机颜色(Color对象)
private Color getRandomColor(int minColor, int maxColor) {
    Random random = new Random();
    // 保存minColor最大不会超过255
    if (minColor > 255)
        minColor = 255;
    //  保存minColor最大不会超过255
    if (maxColor > 255)
        maxColor = 255;
    //  获得红色的随机颜色值
</bean>
// 随机获得当前验证码的字符 char codeChar = codeChars.charAt(random.nextInt(charsLength)); validationCode.append(codeChar); // 随机设置当前验证码字符的颜色 g.setColor(getRandomColor(10, 100)); // 在图形上输出验证码字符,x和y都是随机生成的 g.drawString(String.valueOf(codeChar), 16 * i + random.nextInt(7), height - random.nextInt(6)); } HttpSession session = request.getSession(); session.setMaxInactiveInterval(5 * 60); // 将验证码保存在session对象中,key为validation_code session.setAttribute("validationCode", validationCode.toString()); g.dispose();// 关闭Graphics对象 OutputStream os = response.getOutputStream(); ImageIO.write(image, "JPEG", os);// 以JPEG格式向客户端发送图形验证码 } 校园快递管理系统

    • 请登录
    `express_text` = #{expressText} WHERE `id` = #{id}
    <!--获取-->
    <select id="findById" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM `t_express` WHERE `id` = #{id}
    </select>
    
    <!--列表-->
    <select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM `t_express`
        <where>
            <if test="searchColumn != null and searchColumn != '' and keyword != null and keyword != ''">
                ${searchColumn} LIKE CONCAT('%',#{keyword},'%')  AND
            </if>
            1=1
        </where>
        ORDER BY id ASC
        <if test="startIndex != null and pageSize != null">
            LIMIT #{startIndex},#{pageSize};
        </if>
    </select>
    <!--数量-->
    <select id="getAllCount" parameterType="java.util.Map" resultType="Integer">
        SELECT COUNT(*) FROM `t_express`
    
    <sql id="Base_Column_List">
        `id`,`username`,`password`,`real_name`,`user_sex`,`user_phone`,`user_text`,`user_type`
    </sql>
    
    <!--新增-->
    <insert id="doCreate" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.demo.vo.User">
        INSERT INTO `t_user`
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test ='id != null'>`id`,</if>
                    <if test ='username != null'>`username`,</if>
                    <if test ='password != null'>`password`,</if>
                    <if test ='realName != null'>`real_name`,</if>
                    <if test ='userSex != null'>`user_sex`,</if>
                    <if test ='userPhone != null'>`user_phone`,</if>
    </div>
    
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <!-- 侧边栏 -->
                <jsp:include page="menu.jsp">
                    <jsp:param value="active" name="Notice_active"/>
                </jsp:include>
            </ul>
        </div>
    </div>
    
    <div class="layui-body">
     * @param request
     * @param response
     */
    private void redirectList(HttpServletRequest request, HttpServletResponse response) throws IOException {
        //查询列和关键字
        String searchColumn = Util.decode(request, "searchColumn");
        String keyword = Util.decode(request, "keyword");
        Map<String, Object> params = new HashMap();//用来保存控制层传进来的参数(查询条件)
        params.put("searchColumn", searchColumn);//要查询的列
        params.put("keyword", keyword);//查询的关键字
        response.getWriter().println(com.alibaba.fastjson.JSONObject.toJSONString(noticeService.list(params).get("list")));
    }
    

    }
    package com.demo.util;

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.text.SimpleDateFormat;

    /**

    • 该方法为通用的工具类,放置一些共用的方法
      /
      public class Util {
      /
      *
      • 获取系统当前时间并格式化为字符串
      •          type: 2,
                 area: ['800px', '550px'],
                 fixed: false, //不固定
                 maxmin: true,
                 content: 'noticeEditPre?id=' + data.id
             });
             obj.update({});//同步更新缓存对应的值
         } else if (layEvent === 'info') { //详情
             layer.open({
                 type: 2,
                 area: ['800px', '650px'],
                 fixed: false, //不固定
                 maxmin: true,
                 content: 'noticeGet?id=' + data.id
             });
             obj.update({});//同步更新缓存对应的值
         } else if (layEvent === 'LAYTABLE_TIPS') {
             layer.alert('Hi,头部工具栏扩展的右侧图标。');
         }
        
        });

    运行环境

    Java≥6、Tomcat≥7.0、MySQL≥5.5

    开发工具

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

    技术框架

    JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Layui Ajax

    基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可

    适用

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

    功能说明

    登录、注册、退出、用户模块、公告模块、快递模块的增删改查管理

    20220319002213

    20220319002214

    20220319002215

    20220319002216

    20220319002217

    20220319002218

    20220319002219

    20220319002220

    document

    举报

    相关推荐

    0 条评论