会议信息管理系统SSM记录(五)

news2024/9/20 14:29:08

目录:

(1)搜索员工

(2)查看会议室

(3)会议室详情

(4)添加会议室


(1)搜索员工

创建EmployeeController:

 public static final Integer PAGE_SIZE = 10;//定义默认显示10条

    /**
     * 分页查询员工
     * 获取员工的数量
     *
     * @param employee 员工
     * @param page     页数
     * @param model
     * @return 搜索员工页面
     */
    @RequestMapping("/searchemployees")
    public String getAllEmployees(Employee employee, @RequestParam(defaultValue = "1") Integer page, Model model){
        List<Employee> emps = employeeService.getAllEmps(employee,page,PAGE_SIZE);//分页搜索员工方法
        Long total = employeeService.getTotal(employee);//查询员工总条数方法
        model.addAttribute("emps",emps);
        model.addAttribute("total",total);//总条数
        model.addAttribute("page",page);//当前页
        model.addAttribute("pagenum",total%PAGE_SIZE == 0?total/PAGE_SIZE :total/PAGE_SIZE+1);//可以分为多少页
        return "searchemployees";
    }  

在EmployeeService:添加方法: 

 

//分页搜索员工方法
    public List<Employee> getAllEmps(Employee employee, Integer page, Integer pageSize) {
        //这个page是从第几行数据开始查
        page = (page - 1)*pageSize;
        return employeeMapper.getAllEmps(employee,page,pageSize);
    }
//查询员工总条数方法
    public Long getTotal(Employee employee) {
        return employeeMapper.getTotal(employee);
    }

在EmployeeMapper接口:

 

 //搜索员工方法
    List<Employee> getAllEmps(@Param("emp") Employee employee, @Param("page") Integer page, @Param("pageSize") Integer pageSize);
//查询员工总条数方法
    Long getTotal(Employee employee);

在EmployeeMapper.xml添加sql语句:

<!--分页搜索员所有员工方法-->
    <select id="getAllEmps" resultType="com.xzb.meeting.model.Employee">
        select *
        from employee
        where status = #{emp.status}
        <if test="emp.employeeName != null">
            and employeename like concat('%',#{emp.employeeName},'%')
        </if>
        <if test="emp.username != null">
            and username like concat('%',#{emp.username},'%')
        </if>
        limit #{page},#{pageSize}
    </select>
 <!--查询员工总条数方法-->
    <select id="getTotal" resultType="java.lang.Long">
        select count(*)
        from employee
        where status = #{status}
        <if test="employeeName != null">
            and employeename like concat('%',#{employeeName},'%')
        </if>
        <if test="username != null">
            and username like concat('%',#{username},'%')
        </if>
    </select>

删除页面searchemployees.ftl的固定代码:

 添加:

 

修改form表单:添加action  name属性

 <form action="/admin/searchemployees" method="get">
            <fieldset>
                <legend>搜索员工</legend>
                <table class="formtable">
                    <tr>
                        <td>姓名:</td>
                        <td>
                            <input type="text" id="employeename" name="employeeName" value="<#if employee??>${employee.employeeName!''}</#if>" maxlength="20"/>
                        </td>
                        <td>账号名:</td>
                        <td>
                            <input type="text" id="accountname" name="username" value="<#if employee??>${employee.username!''}</#if>" maxlength="20"/>
                        </td>
                        <td>状态:</td>
                        <td>
                        <#if employee??>
                            <#if employee.status == 0>
                                <input type="radio" id="status" name="status" value="1"/><label>已批准</label>
                                <input checked="checked" type="radio" id="status" name="status" value="0"/>
                                <label>待审批</label>
                                <input type="radio" id="status" name="status" value="2"/><label>已关闭</label>
                            <#elseif employee.status == 1>
                                <input checked="checked" type="radio" id="status" name="status" value="1"/>
                                <label>已批准</label>
                                <input type="radio" id="status" name="status" value="0"/>
                                <label>待审批</label>
                                <input type="radio" id="status" name="status" value="2"/><label>已关闭</label>
                            <#elseif employee.status == 2>
                                <input type="radio" id="status" name="status" value="1"/>
                                <label>已批准</label>
                                <input type="radio" id="status" name="status" value="0"/>
                                <label>待审批</label>
                                <input checked="checked" type="radio" id="status" name="status" value="2"/>
                                <label>已关闭</label>
                            </#if>
                        <#else >
                            <input type="radio" id="status" name="status" value="1"
                                   checked="checked"/><label>已批准</label>
                            <input type="radio" id="status" name="status" value="0"/><label>待审批</label>
                            <input type="radio" id="status" name="status" value="2"/><label>已关闭</label>
                        </#if>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" class="command">
                            <input type="submit" class="clickbutton" value="查询"/>
                            <input type="reset" id="myset" class="clickbutton" value="重置" onclick="clear()"/>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </form>

 <h3 style="text-align:center;color:black">查询结果</h3>
            <div class="pager-header">
                <div class="header-info">
                    共<span class="info-number">${total}</span>条结果,
                    分成<span class="info-number">${pagenum}</span>页显示,
                    当前第<span class="info-number">${page}</span>页
                </div>
                <div class="header-nav">
                    <a type="button" class="clickbutton" href="/admin/searchemployees?status=${employee.status}&page=1">首页</a>
                    <a type="button" class="clickbutton"
                       href="/admin/searchemployees?status=${employee.status}&page=${page-1}">上页</a>
                    <a type="button" class="clickbutton"
                       href="/admin/searchemployees?status=${employee.status}&page=${page+1}">下页</a>
                    <a type="button" class="clickbutton"
                       href="/admin/searchemployees?status=${employee.status}&page=${pagenum}">末页</a>
                    <form action="/admin/searchemployees"
                          style="display: inline"
                          method="get">
                        <input type="hidden" name="status" value="${employee.status}">
                        跳到第<input name="page" type="text" id="pagenum" class="nav-number"/>页
                        <input type="submit" class="clickbutton" value="跳转"/>
                    </form>
                </div>
            </div>

 

 

 在EmployeeController:

/**
     * 关闭账号 修改状态为2
     *
     * @param id 员工编号
     * @return 重定向到审批通过的员工页面
     */
    @RequestMapping("/updateemp")
    public String updateemp(Integer id){
        employeeService.updateStatus(id,2);
        return "redirect:/admin/searchemployees?status=1";
    }

EmployeeService:

//更新用户状态(status)
    public Integer updateStatus(Integer employeeid, Integer status) {
        return employeeMapper.updateStatus(employeeid,status);
    }

在EmoloyeeMapper:

//更新用户状态(status)
    Integer updateStatus(@Param("employeeid") Integer employeeid,@Param("status") Integer status);

EmoloyeeMapper.xml:sql语句

<!--更新用户状态(status)-->
    <update id="updateStatus">
        update  employee
        set status = #{status}
        where employeeid = #{employeeid}
    </update>

 (2)查看会议室

创建MeetingRoomController:

创建Meetingroom实体类:

 

创建MeetingMapper接口、MeetingMapper.xml

 

 

 创建MeetingRoomService:

 在MeetingRoomController加方法:

//查询会议室,并进行会议室页面的跳转
    @RequestMapping("/meetingrooms")
    public String meetingrooms(Model model){
        model.addAttribute("mrs",meetingRoomService.getAllMr());//调用查询所有会议室名称的方法
        return "meetingrooms";
    }

 在MeetingRoomService添加这个方法:

 //查询所有会议室
    public List<MeetingRoom> getAllMr() {
        return meetingRoomMapper.getAllMr();
    }

 在MeetingRoomMapper添加方法:

 //查询所有会议室
    public List<MeetingRoom> getAllMr();

 在MeetingRoomMapper.xml添加sql语句:

<!--查询所有会议室-->
    <select id="getAllMr" resultType="com.xzb.meeting.model.MeetingRoom">
        select *
        from meetingroom
    </select>

删除meetingroom页面的固定数据:从数据库中获取数据

 

 

(3)会议室详情

修改a标签的连接:

在MeetingRoomController:添加方法:

 

 //会议室详情页面
    @RequestMapping("/roomdetails")
    public String roomdetails(Integer roomid,Model model){
        model.addAttribute("mr",meetingRoomService.getMrById(roomid));
        return "roomdetails";
    }

 

在MeetingRoomService添加方法:

 

 

 //根据roomid获取对应的会议室
    public MeetingRoom getMrById(Integer roomid) {
        return meetingRoomMapper.getMrById(roomid);
    }

 在MeetingRoomMapper添加方法:

//根据roomid获取对应的会议室
    MeetingRoom getMrById(Integer roomid);

 MeetingRoomMapper.xml添加对应的sql语句:

 

 <!--根据roomid获取对应的会议室-->
    <select id="getMrById" resultType="com.xzb.meeting.model.MeetingRoom">
        select *
        from meetingroom
        where roomid = #{roomid}
    </select>

修改meetingdetail会议室详情页面:

<form action="/updateroom" method="post">
            <fieldset>
                <legend>会议室信息</legend>
                <table class="formtable">
                    <tr>
                        <td>门牌号:</td>
                        <td>
                            <input id="roomnumber" name="roomnum" type="text" value="${mr.roomnum}" maxlength="10"/>
                        </td>
                    </tr>
                    <tr>
                        <td>会议室名称:</td>
                        <td>
                            <input id="capacity" name="roomname" type="text" value="${mr.roomname}" maxlength="20"/>
                        </td>
                    </tr>
                    <tr>
                        <td>最多容纳人数:</td>
                        <td>
                            <input id="roomcapacity" name="capacity" type="text" value="${mr.capacity}"/>
                        </td>
                    </tr>
                    <tr>
                        <td>当前状态:</td>
                        <td>
                            <#if mr.status==0>
                                <input type="radio" id="status" name="status" checked="checked" value="0"/><label
                                    for="status">启用</label>
                                <input type="radio" id="status" value="1" name="status"/><label for="status">已占用</label>
                            <#else >
                                <input type="radio" id="status" name="status" value="0"/><label for="status">启用</label>
                                <input type="radio" id="status" name="status" value="1" checked="checked"/><label for="status"
                                                                                                        >已占用</label>
                            </#if>
                        </td>
                    </tr>
                    <tr>
                        <td>备注:</td>
                        <td>
                            <textarea id="description" name="description" maxlength="200" rows="5"
                                      cols="60">${mr.description}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="command">
                            <input type="hidden" value="${mr.roomid}" name="roomid">
                            <input type="submit" value="确认修改" class="clickbutton"/>
                            <input type="button" class="clickbutton" value="返回" onclick="window.history.back();"/>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </form>

 

 

点击:

 

修改会议室:

在MeetingRoomController:添加修改请求:

 

/**
     * 更新会议房间信息
     *
     * @param meetingRoom MeetingRoom
     * @return Integer
     */
    @RequestMapping("/updateroom")
    public String updateroom(MeetingRoom meetingRoom){
        Integer result = meetingRoomService.updateroom(meetingRoom);
        if (result == 1){
            return "redirect:/meetingrooms";//更新成功跳转会议室页面
        }else {
            return "forward:/roomdetails?roomid="+meetingRoom.getRoomid();//失败还返回这个页面详情更改页面
        }
    }

 在MeetingRoomService添加方法:

//更新会议房间信息
    public Integer updateroom(MeetingRoom meetingRoom) {
        return meetingRoomMapper.updateroom(meetingRoom);
    }

  在MeetingRoomMapper添加修改方法:

//更新会议房间信息
    Integer updateroom(MeetingRoom meetingRoom);

 MeetingRoomMapper.xml:添加sql语句

 

<!--更新会议房间信息-->
    <update id="updateroom">
        update meetingroom
        set roomnum = #{roomnum},roomname = #{roomname},capacity = #{capacity},status = #{status},description = #{description}
        where roomid = #{roomid}
    </update>

给详情页面的表单添加form action

添加name属性:

 

添加roomid:

 

 

 

 

 (4)添加会议室

 

 在MeetingRoomController中添加:跳转提加页面请求:

 

//跳转到添加添加会议室页面
    @RequestMapping("/admin/addmeetingroom")
    public String addmeetingroom(){
        return "addmeetingroom";
    }

添加请求: 

 

 //添加会议室请求
    @RequestMapping("/admin/doAddMr")
    public String doAddMr(MeetingRoom meetingRoom){
        meetingRoomService.doAddMr(meetingRoom);
        return "redirect:/meetingrooms";//添加成功跳转会议室页面
    }

 在MeetingRoomServoce添加这个方法:

 //添加会议室请求
    public Integer doAddMr(MeetingRoom meetingRoom) {
        return meetingRoomMapper.doAddMr(meetingRoom);
    }

 在MeetingRoomMapper添加:

//添加会议室请求
    Integer doAddMr(MeetingRoom meetingRoom);

 MeetingRoomMapper.xml添加sql语句:

 

<!--添加会议室请求-->
    <insert id="doAddMr">
        insert into meetingroom (roomnum,roomname,capacity,status,description)
        values (#{roomnum},#{roomname},#{capacity},#{status},#{description})
    </insert>

给添加会议页面:修改form表单:name属性

 

 

<form action="/admin/doAddMr" method="post">
                    <fieldset>
                        <legend>会议室信息</legend>
                        <table class="formtable">
                            <tr>
                                <td>门牌号:</td>
                                <td>
                                    <input name="roomnum" id="roomnumber" type="text" placeholder="例如:201" maxlength="10"/>
                                </td>
                            </tr>
                            <tr>
                                <td>会议室名称:</td>
                                <td>
                                    <input name="roomname" id="capacity" type="text" placeholder="例如:第一会议室" maxlength="20"/>
                                </td>
                            </tr>
                            <tr>
                                <td>最多容纳人数:</td>
                                <td>
                                    <input name="capacity" id="roomcapacity" type="text" placeholder="填写一个正整数"/>
                                </td>
                            </tr>
                            <tr>
                                <td>当前状态:</td>
                                <td>
                                    <input type="radio" id="status" name="status" checked="checked" value="0"/><label for="status">启用</label>
                                    <input type="radio" id="status" name="status" value="1"/><label for="status" >已占用</label>
                                </td>
                            </tr>
                            <tr>
                                <td>备注:</td>
                                <td>
                                    <textarea name="description" id="description" maxlength="200" rows="5" cols="60" placeholder="200字以内的文字描述"></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="command">
                                    <input type="submit" value="添加" class="clickbutton"/>
                                    <input type="reset" value="重置" class="clickbutton"/>
                                </td>
                            </tr>
                        </table>
                    </fieldset>
                </form>

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/31195.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

11.23二叉树

目录 一.笔试强训习题订正 1.选择题 2.编程题-组队竞赛 3.删除公共字符 解法1 哈希映射思想 解法2 暴力解法 解法3 substring解法replaceAll() 二.二叉树相关Oj题 1.二叉树的遍历 2.二叉树分层遍历 三.二叉树的最近公共祖先 1.思路一 2.思路2 四.将二叉搜索树转化…

力扣(LeetCode)795. 区间子数组个数(C++)

模拟 有一种构想&#xff0c;只考虑上边界&#xff0c;在小边界和大边界之间的连续子数组个数 小于等于大边界的连续子数组个数 −-− 小于小边界的连续子数组个数。 连续子数组个数计算公式 sumn(n1)2sum \dfrac{n\times (n1)}{2}sum2n(n1)​ 长度为 nnn 的小于某上界的区间…

UML建模

UML定义了行为图&#xff08;动态&#xff09;和状态图&#xff08;静态&#xff09;两大类。&#xff08;分类依据&#xff1a;对象是否根据时间变化&#xff09; 下面简介一下用例图、类图、时序图和状态图的概念。 “41”视图模型 逻辑视图&#xff1a;逻辑试图主要是用来…

CV攻城狮入门VIT(vision transformer)之旅——近年超火的Transformer你再不了解就晚了!

&#x1f34a;作者简介&#xff1a;秃头小苏&#xff0c;致力于用最通俗的语言描述问题 &#x1f34a;专栏推荐&#xff1a;深度学习网络原理与实战 &#x1f34a;近期目标&#xff1a;写好专栏的每一篇文章 &#x1f34a;支持小苏&#xff1a;点赞&#x1f44d;&#x1f3fc;、…

PowerJob 定时从SFTP下载文件踩的坑

一. 业务需求 SFTP上有多个目录, 每小时要下载一次文件, 每个目录的下载任务都是一个独立的工作流任务. 二.问题描述 手动执行每个任务可以正常执行, 但是当所有任务都开启定定时任务执行时(每小时执行一次),任务实例就会报错. 三.问题分析 查看服务端和worker端的日志, …

【ML特征工程】第 2 章 :简单数字的花式技巧

&#x1f50e;大家好&#xff0c;我是Sonhhxg_柒&#xff0c;希望你看完之后&#xff0c;能对你有所帮助&#xff0c;不足请指正&#xff01;共同学习交流&#x1f50e; &#x1f4dd;个人主页&#xff0d;Sonhhxg_柒的博客_CSDN博客 &#x1f4c3; &#x1f381;欢迎各位→点赞…

PDF怎么转换成Word?给大家分享三种简单的转换方法

我们怎么把拿到手的PDF文件转换成Word文档格式呢&#xff1f;众所周知&#xff0c;PDF文件虽然没有办法能够直接在文件上进行编辑&#xff0c;但是我们可以借助一些编辑软件来实现这一操作&#xff0c;尽管这样还是会有很多小伙伴习惯在Word中来编辑文件内容&#xff0c;因此怎…

EasyRecovery2023重新找回丢失的文件数据恢复软件

Ontrack EasyRecovery2023易恢复一款数据文件恢复软件&#xff0c;号称最好的数据恢复软件&#xff01;可以全面恢复删除丢失数据&#xff0c;能对电脑误删文件恢复&#xff0c;格式化硬盘数据恢复&#xff0c;手机U盘数据恢复等等&#xff0c;威力非常的强大&#xff01;支持恢…

运动耳机怎么选,盘点目前适合运动的几款耳机

​相对于传统耳机而言&#xff0c;现如今越来越多的人喜欢使用骨传导耳机&#xff0c;毕竟无需入耳不管是在运动还是日常&#xff0c;防丢能力会更加好&#xff0c;耳挂式的佩戴更加不用担心在剧烈运动的情况下脱落&#xff0c;但在骨传导耳机中已经有了很多个品牌入驻&#xf…

先聊聊「堆栈」,再聊聊「逃逸分析」。Let’s Go!

要搞清楚GO的逃逸分析一定要先搞清楚内存分配和堆栈&#xff1a; 内存分配既可以分配到堆中&#xff0c;也可以分配到栈中。 什么样的数据会被分配到栈中&#xff0c;什么样的数据又会被分配到堆中呢&#xff1f; GO语言是如何进行内存分配的呢&#xff1f;其设计初衷和实现原…

云原生丨5大Datadog集成,快速提高团队效率!

Datadog是DevOps、开发人员和 SRE 团队的必备好物&#xff0c;它适用于各种规模的云应用程序。 然而&#xff0c;尽管 Datadog 功能十分强大&#xff0c;但大多数企业并没有充分发挥 Datadog 全部价值。 什么是 Datadog Datadog 是一个可观察性平台&#xff0c;提供监控、安…

3.1、数据链路层概述

3.1、数据链路层概述 3.1.1、数据链路层在网络体系结构中所处的地位 如下所示&#xff0c;主机 H1 给主机 H2 发送数据&#xff0c;中间要经过三个路由器和电话网、局域网以及广域网等多种网络 从五层协议原理体系结构的角度来看&#xff1a; 主机应具有体系结构中的各个层…

使用HTML制作静态网站:传统文化戏剧锡剧带psd设计图(2个页面)

&#x1f389;精彩专栏推荐 &#x1f4ad;文末获取联系 ✍️ 作者简介: 一个热爱把逻辑思维转变为代码的技术博主 &#x1f482; 作者主页: 【主页——&#x1f680;获取更多优质源码】 &#x1f393; web前端期末大作业&#xff1a; 【&#x1f4da;毕设项目精品实战案例 (10…

【项目_01】搭建项目基本框架、底部tabbar、头部banner | 旅途拾景 | 基于Vue3全家桶

&#x1f4ad;&#x1f4ad; ✨&#xff1a;搭建项目基本框架、底部tabbar、头部banner| 路途拾景 | 基于Vue3全家桶   &#x1f49f;&#xff1a;东非不开森的主页   &#x1f49c;: 因为很多东西来不及去做去看可是时间很快总是赶不上&#xff0c;所以要去成长呀&#x1f4…

作业-11.23

1、广播 接收端 #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <netinet/ip.h> #include <arpa/inet.h> #include <unistd.h> #include <str…

Diffusion Autoencoders: Toward a Meaningful and Decodable Representation

​ Diffusion Autoencoders: Toward a Meaningful and Decodable Representation 扩散自编码器:面向有意义和可解码的表示 code&#xff1a;https://github.com/phizaz/diffae A CVPR 2022 (ORAL) paper (paper, site, 5-min video) Diffusion probabilistic models (DPMs) hav…

算法设计与分析 SCAU17089 最大m子段和

17089 最大m子段和 时间限制:1000MS 代码长度限制:10KB 提交次数:0 通过次数:0 题型: 编程题 语言: G;GCC;VC;JAVA Description “最大m子段和”问题&#xff1a;给定由n个整数&#xff08;可能为负&#xff09;组成的序列a1、a2、a3、…、an&#xff0c;以及一个正整数m&a…

【Java】初识IO流【附导航】

文章目录01 什么是IO02 数据源03 什么是流04 IO流原理⇩➩ 导航01 什么是IO 对于任何程序设计语言而言&#xff0c;输入输出&#xff08;Input / Output&#xff09;系统都是非常核心的功能。程序运行需要数据&#xff0c;数据的获取往往需要跟系统外部进行通信&#xff0c;外部…

论文复现|Panoptic Deeplab(全景分割PyTorch)

摘要&#xff1a;这是发表于CVPR 2020的一篇论文的复现模型。本文分享自华为云社区《Panoptic Deeplab(全景分割PyTorch)》&#xff0c;作者&#xff1a;HWCloudAI 。 这是发表于CVPR 2020的一篇论文的复现模型&#xff0c;B. Cheng et al, “Panoptic-DeepLab: A Simple, Str…

63. 不同路径 II

题目 一个机器人位于一个 m x n 网格的左上角 &#xff08;起始点在下图中标记为 “Start” &#xff09;。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角&#xff08;在下图中标记为 “Finish”&#xff09;。 现在考虑网格中有障碍物。那么从左上角到…