0
点赞
收藏
分享

微信扫一扫

基于javaweb+jsp的设备采购管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Layui Ajax)

脱下愤怒的小裤衩 2022-04-18 阅读 67
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等均可配置运行

适用

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

                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            title: '供应商列表',
            cols: [
                [
                        {
                            field: 'gysNo',
                            title: '编号',
                        },
                        {
                            field: 'gysName',
                            title: '名称',
                            templet: vo => (vo = vo.gysName) ? '<a href="#" style="color: #009688;">' + vo + '</a>' : '',
                            event: 'info',
                        },
                        {
                            field: 'gysContact',
                            title: '联系人',
                        },
                        {
                            field: 'gysPhone',
                            title: '电话',
    <link rel="stylesheet" href="js/layui/css/layui.css">
    <script src="js/jquery.js"></script>
    <script src="js/layer.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo" style="font-weight: bold;font-size: 19px">设备采购管理系统</div>
        <ul class="layui-nav layui-layout-left"></ul>
        <c:if test="${loginUser==null}">
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item"><a href="login.jsp">请登录</a></li>
            </ul>
        </c:if>
        <c:if test="${loginUser!=null}">
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item"><a>${loginUser.username}</a></li>
                <li class="layui-nav-item"><a href="authLogout">退出登录</a></li>
            </ul>
        </c:if>
    }

    /**
     * 跳转到列表页面
     *
     * @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(userService.list(params).get("list")));
    }
}
package com.demo.controller;

import com.demo.util.Util;
import com.demo.service.CaigouService;
import com.demo.vo.Caigou;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
     * @param response
     * @param request
     * @throws IOException
     */
    @RequestMapping({"gysGet", "gysEditPre"})
    public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
        Serializable id = Util.decode(request, "id");//取出主键id
        Gys vo = gysService.get(id);
        request.getSession().setAttribute("vo", vo);
        String to = request.getRequestURI().toLowerCase().contains("get") ? "info" : "edit";//判断是去详情显示页面还是编辑页面
        response.sendRedirect("gys_" + to + ".jsp");
    }

    /**
     * 根据条件查询供应商的列表并跳转回页面
     *
     * @param response
     * @param request
     * @throws IOException
     */
    @RequestMapping("gysList")
    public void list(HttpServletResponse response, HttpServletRequest request) throws IOException {
        this.redirectList(request, response);
    }

    /**
     * 跳转到列表页面
        let binary = '';
        let bytes = new Uint8Array(buffer);
        let len = bytes.byteLength;
        for (let i = 0; i < len; i++) {
            binary += String.fromCharCode(bytes[i]);
        }
        return window.btoa(binary);
    }

    layui.use('table', function () {
        let table = layui.table;
        table.render({
            elem: '#myData',
            id: 'myTable',
            url: 'gysList',
            parseData: function (res) { //res:即为原始返回的数据
                let result = this.page.curr ? res.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr) : res.slice(0, this.limit);
                return {
                            let flag = ${loginUser.userType == '管理员'};
                            return flag ? '<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>' : '';
                        }
                    }
                ]
            ],
        });
        //监听工具条
        table.on('tool(myTable)', function (obj) { //注:tool 是工具条事件名,myTable 是 table 原始容器的属性 lay-filter="对应的值"
            let data = obj.data; //获得当前行数据
            let layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
            if (layEvent === 'del') { //删除
                // layer.confirm('删除' + data.wupinName + "?", function (index) {
                $.ajax({
                    type: "GET",
                    dataType: "text",
                    url: "goodDelete?id=" + data.id,
                    success: function () {
                        console.log("已删除!");
                    }
                <if test ='gysNo != null'>`gys_no` = #{gysNo},</if>
                <if test ='gysName != null'>`gys_name` = #{gysName},</if>
                <if test ='gysContact != null'>`gys_contact` = #{gysContact},</if>
                <if test ='gysPhone != null'>`gys_phone` = #{gysPhone},</if>
                <if test ='gysText != null'>`gys_text` = #{gysText}</if>
        </set>
        WHERE `id` = #{id}
    </update>

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

    <!--列表-->
    <select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM `t_gys`
        <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};
    <insert id="doCreate" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.demo.vo.Good">
        INSERT INTO `t_good`
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test ='id != null'>`id`,</if>
                    <if test ='wupinName != null'>`wupin_name`,</if>
                    <if test ='wupinNo != null'>`wupin_no`,</if>
                    <if test ='wupinCount != null'>`wupin_count`,</if>
                    <if test ='wupinType != null'>`wupin_type`,</if>
                    <if test ='wupinGys != null'>`wupin_gys`,</if>
                    <if test ='wupinGuige != null'>`wupin_guige`,</if>
                    <if test ='wupinPrice != null'>`wupin_price`,</if>
                    <if test ='wupinText != null'>`wupin_text`</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test ='id != null'>#{id},</if>
                    <if test ='wupinName != null'>#{wupinName},</if>
                    <if test ='wupinNo != null'>#{wupinNo},</if>
                    <if test ='wupinCount != null'>#{wupinCount},</if>
                    <if test ='wupinType != null'>#{wupinType},</if>
                    <if test ='wupinGys != null'>#{wupinGys},</if>
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 增加用户
     *
     * @param response
                    <if test ='password != null'>#{password},</if>
                    <if test ='realName != null'>#{realName},</if>
                    <if test ='userSex != null'>#{userSex},</if>
                    <if test ='userPhone != null'>#{userPhone},</if>
                    <if test ='userText != null'>#{userText},</if>
                    <if test ='userType != null'>#{userType}</if>
        </trim>
    </insert>

    <!--批量删除-->
    <delete id="doRemoveBatch" parameterType="java.util.Collection">
        DELETE FROM `t_user` WHERE `id` IN
        <foreach collection="list" item="id" separator="," open="(" close=")">
            #{id}
        </foreach>

运行环境

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…均可

适用

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

功能说明

登录、注册、退出、用户模块、公告模块、供应商模块、物资模块、采购模块的增删改查管理

20220319003142

20220319003143

20220319003144

20220319003145

20220319003146

20220319003147

20220319003148

20220319003149

20220319003150

20220319003151

20220319003152

20220319003153

document

举报

相关推荐

0 条评论