• 会议OA项目(待开会议&历史会议&所有会议)


                                                                    文章目录

    一、会议OA项目名词介绍

    二、SQL编写

    待开会议SQL

    所有会议SQL

     三、代码阶段

    待开会议

    所有会议


    一、会议OA项目名词介绍

    我的会议:当前登录账号,是 某会议 主持人,则查询出来
    我的审批:当前登录账号,是 某会议 的指定审批人,并且会议状态是待审核,则查询出来
    会议通知:当前登录账号,只要是 某会议 的参与者、列席者、主持人中的一员,并且该会议未反馈,则查询出来

     待开会议:当前登录账号,只要是 某会议 的参与者、列席者、主持人中的一员,并且会议状态是待开,则查询出来

     历史会议:当前登录账号,只要是 某会议 的参与者、列席者、主持人中的一员,并且会议状态是结束,则查询出来

     所有会议:当前登录账号,只要是 某会议 的参与者、列席者、主持人、审批人中的一员,那么必须查询出来

     二、SQL编写

    待开会议SQL

    待开会议与我的会议的区别:待开会议需要匹配3个数据库列段某会议 的参与者、列席者、主持人

    1. select CONCAT(canyuze,',',liexize,',',zhuchiren),a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren
    2. ,b.name zhuchirenname,
    3. a.location,
    4. DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,
    5. DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,
    6. a.state,
    7. (
    8. case a.state
    9. when 0 then '取消会议'
    10. when 1 then '新建'
    11. when 2 then '待审核'
    12. when 3 then '驳回'
    13. when 4 then '待开'
    14. when 5 then '进行中'
    15. when 6 then '开启投票'
    16. when 7 then '结束会议'
    17. else '其他' end
    18. ) meetingstate,
    19. a.seatPic,a.remark,a.auditor,
    20. c.name auditorname from t_oa_meeting_info a
    21. inner join t_oa_user b on a.zhuchiren = b.id
    22. left join t_oa_user c on a.auditor = c.id where 1=1
    23. and state=4

    1. select CONCAT(canyuze,',',liexize,',',zhuchiren),a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren
    2. ,b.name zhuchirenname,
    3. a.location,
    4. DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,
    5. DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,
    6. a.state,
    7. (
    8. case a.state
    9. when 0 then '取消会议'
    10. when 1 then '新建'
    11. when 2 then '待审核'
    12. when 3 then '驳回'
    13. when 4 then '待开'
    14. when 5 then '进行中'
    15. when 6 then '开启投票'
    16. when 7 then '结束会议'
    17. else '其他' end
    18. ) meetingstate,
    19. a.seatPic,a.remark,a.auditor,
    20. c.name auditorname from t_oa_meeting_info a
    21. inner join t_oa_user b on a.zhuchiren = b.id
    22. left join t_oa_user c on a.auditor = c.id where 1=1
    23. and state=4 and FIND_IN_SET(6,CONCAT(canyuze,',',liexize,',',zhuchiren))

     

     所有会议SQL

    这条SQL语句提供错误演示,不要运用在项目中👀

    所有会议与待开会议的区别:所有会议不需要限制状态,并且需要新增一个审批人列段

    1. select CONCAT(a.canyuze,',',a.liexize,',',a.zhuchiren,',',a.auditor),a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren
    2. ,b.name zhuchirenname,
    3. a.location,
    4. DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,
    5. DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,
    6. a.state,
    7. (
    8. case a.state
    9. when 0 then '取消会议'
    10. when 1 then '新建'
    11. when 2 then '待审核'
    12. when 3 then '驳回'
    13. when 4 then '待开'
    14. when 5 then '进行中'
    15. when 6 then '开启投票'
    16. when 7 then '结束会议'
    17. else '其他' end
    18. ) meetingstate,
    19. a.seatPic,a.remark,a.auditor,
    20. c.name auditorname from t_oa_meeting_info a
    21. inner join t_oa_user b on a.zhuchiren = b.id
    22. left join t_oa_user c on a.auditor = c.id where 1=1

     假设:id=6的用户,是会议OA的列席人员,会议OA又处于新建状态,意味着没有审批人,请问这条数据要不要查询出来?

    1. select CONCAT(a.canyuze,',',a.liexize,',',a.zhuchiren,',',IFNULL(a.auditor,-1)),a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren
    2. ,b.name zhuchirenname,
    3. a.location,
    4. DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,
    5. DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,
    6. a.state,
    7. (
    8. case a.state
    9. when 0 then '取消会议'
    10. when 1 then '新建'
    11. when 2 then '待审核'
    12. when 3 then '驳回'
    13. when 4 then '待开'
    14. when 5 then '进行中'
    15. when 6 then '开启投票'
    16. when 7 then '结束会议'
    17. else '其他' end
    18. ) meetingstate,
    19. a.seatPic,a.remark,a.auditor,
    20. c.name auditorname from t_oa_meeting_info a
    21. inner join t_oa_user b on a.zhuchiren = b.id
    22. left join t_oa_user c on a.auditor = c.id where 1=1
    23. and FIND_IN_SET(6,CONCAT(a.canyuze,',',a.liexize,',',a.zhuchiren,',',IFNULL(a.auditor,-1)))

    如果当前会议还没有送审也就是没有审批人的情况下,我们需要用ifnull函数设它编号为-1,否则会发生数据丢失 

     三、代码阶段

    待开会议

    meetingWaiting.jsp

    1. <%@ page language="java" contentType="text/html; charset=UTF-8"
    2. pageEncoding="UTF-8"%>
    3. <%@include file="/common/head.jsp"%>
    4. html>
    5. <html>
    6. <head>
    7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    8. <script type="text/javascript" src="${pageContext.request.contextPath }/static/js/meeting/meetingWaiting.js">script>
    9. head>
    10. <style>
    11. body{
    12. margin:15px;
    13. }
    14. .layui-table-cell {height: inherit;}
    15. .layui-layer-page .layui-layer-content { overflow: visible !important;}
    16. style>
    17. <body>
    18. <div class="layui-form-item">
    19. <div class="layui-inline">
    20. <label class="layui-form-label">会议标题:label>
    21. <div class="layui-input-inline">
    22. <input type="hidden" id="userid" value="${sessionScope.user.id }"/>
    23. <input type="text" id="title" autocomplete="off"
    24. class="layui-input">
    25. div>
    26. div>
    27. <div class="layui-inline">
    28. <button id="btn_meeting_search" class="layui-btn layui-btn-normal">
    29. <i class="layui-icon">i> 查询
    30. button>
    31. div>
    32. div>
    33. <table style="margin-top: -15px;" id="tb_meeting" lay-filter="tb_meeting">table>
    34. body>
    35. html>

    meetingWaiting.js

    1. let layer,form,table,$;
    2. var row;
    3. layui.use(['layer','form','table'],function(){
    4. layer=layui.layer,form=layui.form,table=layui.table,$=layui.jquery;
    5. //初始化会议列表
    6. initMeeting();
    7. //绑定查询按钮的点击事件
    8. $('#btn_meeting_search').click(function(){
    9. query();
    10. });
    11. });
    12. //1.初始化会议列表
    13. function initMeeting(){
    14. table.render({ //执行渲染
    15. elem: '#tb_meeting', //指定原始表格元素选择器(推荐id选择器)
    16. height: 400, //自定义高度
    17. loading: false, //是否显示加载条(默认 true)
    18. cols: [[ //设置表头
    19. {field: 'title', title: '会议标题', width: 180},
    20. {field: 'location', title: '会议地点', width: 120},
    21. {field: 'startTime', title: '开始时间', width: 180},
    22. {field: 'endTime', title: '结束时间', width: 180},
    23. {field: 'meetingstate', title: '会议状态', width: 90},
    24. {field: 'zhuchirenname', title: '主持人', width: 120},
    25. //{field: '', title: '操作', width: 260, toolbar: '#tbMeeting'}
    26. ]]
    27. });
    28. }
    29. //2.待开会议
    30. function query(){
    31. table.reload('tb_meeting', {
    32. url: 'info.action', //请求地址
    33. method: 'POST', //请求方式,GET或者POST
    34. loading: true, //是否显示加载条(默认 true)
    35. page: true, //是否分页
    36. where: { //设定异步数据接口的额外参数,任意设
    37. 'methodName':'queryMeetingInfoByState',
    38. 'title':$('#title').val(),
    39. 'zhuchiren':$('#userid').val(),
    40. 'state':4
    41. },
    42. request: { //自定义分页请求参数名
    43. pageName: 'page', //页码的参数名称,默认:page
    44. limitName: 'rows' //每页数据量的参数名,默认:limit
    45. },
    46. done: function (res, curr, count) {
    47. //查询完成的回调函数
    48. }
    49. });
    50. }

    dao层

    1. //待开会议
    2. public List> queryMeetingInfoByState(MeetingInfo info, PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException {
    3. String sql = "select CONCAT(canyuze,',',liexize,',',zhuchiren),a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren\r\n" +
    4. " ,b.name zhuchirenname,\r\n" +
    5. " a.location,\r\n" +
    6. " DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,\r\n" +
    7. " DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,\r\n" +
    8. " a.state,\r\n" +
    9. " (\r\n" +
    10. " case a.state\r\n" +
    11. " when 0 then '取消会议'\r\n" +
    12. " when 1 then '新建'\r\n" +
    13. " when 2 then '待审核'\r\n" +
    14. " when 3 then '驳回'\r\n" +
    15. " when 4 then '待开'\r\n" +
    16. " when 5 then '进行中'\r\n" +
    17. " when 6 then '开启投票'\r\n" +
    18. " when 7 then '结束会议'\r\n" +
    19. " else '其他' end\r\n" +
    20. " ) meetingstate,\r\n" +
    21. " a.seatPic,a.remark,a.auditor,\r\n" +
    22. " c.name auditorname from t_oa_meeting_info a\r\n" +
    23. " inner join t_oa_user b on a.zhuchiren = b.id\r\n" +
    24. " left join t_oa_user c on a.auditor = c.id where 1=1\r\n" +
    25. " and state = 4 and FIND_IN_SET("+info.getZhuchiren()+",CONCAT(canyuze,',',liexize,',',zhuchiren))\r\n" +
    26. "";
    27. return super.executeQuery(sql, pageBean);
    28. }

    web层

    1. //待开会议
    2. public String queryMeetingInfoByState(HttpServletRequest req, HttpServletResponse resp) {
    3. try {
    4. PageBean pageBean = new PageBean();
    5. //初始化pageBean
    6. pageBean.setRequest(req);
    7. //调用方法
    8. List> lst =infoDao.queryMeetingInfoByState(info, pageBean) ;
    9. // layui 的code 返回一定要是 0,不能是200,否者返回不了数据
    10. //传输到界面
    11. //pageBean.getTotal()总记录数
    12. ResponseUtil.writeJson(resp, R.ok(0, "待开会议数据查询成功",pageBean.getTotal(),lst));
    13. } catch (Exception e) {
    14. e.printStackTrace();
    15. try {
    16. ResponseUtil.writeJson(resp, R.error(0, "待开会议数据查询失败"));
    17. } catch (Exception e1) {
    18. e1.printStackTrace();
    19. }
    20. }
    21. return null;
    22. }

    页面运行效果

     所有会议

    meetingAll.jsp

    1. <%@ page language="java" contentType="text/html; charset=UTF-8"
    2. pageEncoding="UTF-8"%>
    3. <%@include file="/common/head.jsp"%>
    4. html>
    5. <html>
    6. <head>
    7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    8. <script type="text/javascript" src="${pageContext.request.contextPath }/static/js/meeting/meetingAll.js">script>
    9. head>
    10. <style>
    11. body{
    12. margin:15px;
    13. }
    14. .layui-table-cell {height: inherit;}
    15. .layui-layer-page .layui-layer-content { overflow: visible !important;}
    16. style>
    17. <body>
    18. <div class="layui-form-item">
    19. <div class="layui-inline">
    20. <label class="layui-form-label">会议标题:label>
    21. <div class="layui-input-inline">
    22. <input type="hidden" id="userid" value="${sessionScope.user.id }"/>
    23. <input type="text" id="title" autocomplete="off"
    24. class="layui-input">
    25. div>
    26. div>
    27. <div class="layui-inline">
    28. <button id="btn_meeting_search" class="layui-btn layui-btn-normal">
    29. <i class="layui-icon">i> 查询
    30. button>
    31. div>
    32. div>
    33. <table style="margin-top: -15px;" id="tb_meeting" lay-filter="tb_meeting">table>
    34. body>
    35. html>

     meetingAll.js

    1. let layer,form,table,$;
    2. var row;
    3. layui.use(['layer','form','table'],function(){
    4. layer=layui.layer,form=layui.form,table=layui.table,$=layui.jquery;
    5. //初始化会议列表
    6. initMeeting();
    7. //绑定查询按钮的点击事件
    8. $('#btn_meeting_search').click(function(){
    9. query();
    10. });
    11. });
    12. //1.初始化会议列表
    13. function initMeeting(){
    14. table.render({ //执行渲染
    15. elem: '#tb_meeting', //指定原始表格元素选择器(推荐id选择器)
    16. height: 400, //自定义高度
    17. loading: false, //是否显示加载条(默认 true)
    18. cols: [[ //设置表头
    19. {field: 'title', title: '会议标题', width: 180},
    20. {field: 'location', title: '会议地点', width: 120},
    21. {field: 'startTime', title: '开始时间', width: 180},
    22. {field: 'endTime', title: '结束时间', width: 180},
    23. {field: 'meetingstate', title: '会议状态', width: 90},
    24. {field: 'zhuchirenname', title: '主持人', width: 120},
    25. //{field: '', title: '操作', width: 260, toolbar: '#tbMeeting'}
    26. ]]
    27. });
    28. }
    29. //2.查询所有会议
    30. function query(){
    31. table.reload('tb_meeting', {
    32. url: 'info.action', //请求地址
    33. method: 'POST', //请求方式,GET或者POST
    34. loading: true, //是否显示加载条(默认 true)
    35. page: true, //是否分页
    36. where: { //设定异步数据接口的额外参数,任意设
    37. 'methodName':'allInfos',
    38. 'title':$('#title').val(),
    39. 'zhuchiren':$('#userid').val()
    40. },
    41. request: { //自定义分页请求参数名
    42. pageName: 'page', //页码的参数名称,默认:page
    43. limitName: 'rows' //每页数据量的参数名,默认:limit
    44. },
    45. done: function (res, curr, count) {
    46. //查询完成的回调函数
    47. }
    48. });
    49. }

     dao层

    1. //所有会议
    2. public List> allInfos(MeetingInfo info, PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException {
    3. String sql = "select a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren\r\n" +
    4. ",b.name zhuchirenname,\r\n" +
    5. "a.location,\r\n" +
    6. "DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,\r\n" +
    7. "DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,\r\n" +
    8. "a.state,\r\n" +
    9. "(\r\n" +
    10. " case a.state\r\n" +
    11. " when 0 then '取消会议'\r\n" +
    12. " when 1 then '新建'\r\n" +
    13. " when 2 then '待审核'\r\n" +
    14. " when 3 then '驳回'\r\n" +
    15. " when 4 then '待开'\r\n" +
    16. " when 5 then '进行中'\r\n" +
    17. " when 6 then '开启投票'\r\n" +
    18. " when 7 then '结束会议'\r\n" +
    19. " else '其他' end\r\n" +
    20. ") meetingstate,\r\n" +
    21. "a.seatPic,a.remark,a.auditor,\r\n" +
    22. "c.name auditorname from t_oa_meeting_info a\r\n" +
    23. "inner join t_oa_user b on a.zhuchiren = b.id\r\n" +
    24. "left join t_oa_user c on a.auditor = c.id where 1=1\r\n" +
    25. "and FIND_IN_SET("+info.getZhuchiren()+",CONCAT(a.canyuze,',',a.liexize,',',a.zhuchiren,',',IFNULL(a.auditor,-1)))";
    26. return super.executeQuery(sql, pageBean);
    27. }

    web层 

    1. //所有会议
    2. public String allInfos(HttpServletRequest req, HttpServletResponse resp) {
    3. try {
    4. PageBean pageBean = new PageBean();
    5. //初始化pageBean
    6. pageBean.setRequest(req);
    7. //调用方法
    8. List> lst =infoDao.allInfos(info, pageBean) ;
    9. // layui 的code 返回一定要是 0,不能是200,否者返回不了数据
    10. //传输到界面
    11. //pageBean.getTotal()总记录数
    12. ResponseUtil.writeJson(resp, R.ok(0, "所有会议数据查询成功",pageBean.getTotal(),lst));
    13. } catch (Exception e) {
    14. e.printStackTrace();
    15. try {
    16. ResponseUtil.writeJson(resp, R.error(0, "所有会议数据查询失败"));
    17. } catch (Exception e1) {
    18. e1.printStackTrace();
    19. }
    20. }
    21. return null;
    22. }

    页面运行效果 

    拜了个拜~~ 

    历史会议思路与以上会议思路相差无几,待我实现后即补全

  • 相关阅读:
    毕设准备---Maven
    谈谈 MySQL 事务隔离级别
    Linux-5-进程控制
    Python实现基于Optuna超参数自动优化的Catboost分类模型(CatBoostClassifier算法)项目实战
    GStreamer在Linux平台的交叉编译
    C#序列化与反序列化详解
    Grial UI Kit 4发布,版本4中的新增功能
    Communication-Efficient Learning of Deep Networks from Decentralized Data
    使用mod_rewrite时常用的服务器变量: RewriteRule规则表达式的说明:
    【Python】QTreeWidget树形结构添加
  • 原文地址:https://blog.csdn.net/weixin_67450855/article/details/126061679