• 会议OA项目之代开会议&全部会议


    目录:

    一,待开会议SQL编写

    二,全部会议SQL编写

    三,待开会议功能开发

    四,所有会议功能开发


    一,待开会议SQL编写

    待开会议sql编写其实与我的会议sql大同小异,主要区别在于:待开会议需要匹配三个数据库列段

    对比一下:

     主要区别已用方框标记出来

     待开会议SQL:

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

     分析:

    我们只需要查询出状态为4,即为待开的会议(state=4)

     函数find_in_set(y,xxx)y里放用户编号,xxx中放的包括参与者以及列席人员和主持人的编号,如果用户的编号存在于后面三个字段中就查询出来,意思就是该用户存在于这个会议中,是参会人员中的一员

     二,全部会议SQL编写

    与待开会议的区别已用方框圈出

     全部会议不需要限制状态,并且需要新增一个审批人列段

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

     全部会议SQL:

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

     三,待开会议功能开发

    第一步我们先导入待开会议的jsp页面与js文件

    全部会议jsp页面 

     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方法,将我们的sql语句放入

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

    在web层调用:

    1. // 待开会议
    2. public String queryMeetingInfoByState(HttpServletRequest req, HttpServletResponse resp) {
    3. try {
    4. PageBean pageBean = new PageBean();
    5. pageBean.setRequest(req);
    6. List> lst = infoDao.queryMeetingInfoByState(info, pageBean);
    7. // 注意:layui中的数据表的格式
    8. ResponseUtil.writeJson(resp, R.ok(0, "待开会议数据查询成功",pageBean.getTotal(),lst));
    9. } catch (Exception e) {
    10. e.printStackTrace();
    11. try {
    12. ResponseUtil.writeJson(resp, R.ok(0, "待开会议数据查询失败"));
    13. } catch (Exception e1) {
    14. e1.printStackTrace();
    15. }
    16. }
    17. return null;
    18. }

    四,所有会议功能开发

    导入全部会议jsp页面

    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方法,将我们的sql语句放入

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

    在web层进行调用:

    1. // 所有会议
    2. public String allInfos(HttpServletRequest req, HttpServletResponse resp) {
    3. try {
    4. PageBean pageBean = new PageBean();
    5. pageBean.setRequest(req);
    6. List> lst = infoDao.allInfos(info, pageBean);
    7. // 注意:layui中的数据表的格式
    8. ResponseUtil.writeJson(resp, R.ok(0, "所有会议数据查询成功",pageBean.getTotal(),lst));
    9. } catch (Exception e) {
    10. e.printStackTrace();
    11. try {
    12. ResponseUtil.writeJson(resp, R.ok(0, "所有会议数据查询失败"));
    13. } catch (Exception e1) {
    14. e1.printStackTrace();
    15. }
    16. }
    17. return null;
    18. }

    最终效果展示:

    所有会议: 

    待开会议:

     

  • 相关阅读:
    DM8表空间备份还原
    逆向WeChat(三)
    【机器学习算法】穿越神经网络的迷雾:深入探索机器学习的核心算法
    Flink学习13:Flink外接kafka数据源
    搜维尔科技:Movella Xsens MVN LINK 实际应用,一镜到底!
    React18原理: React核心对象之Update、UpdateQueue、Hook、Task对象
    CSShas伪类选择器案例附注释
    专业138+总分400+南航南京航空航天大学878考研经验电子信息与通信工程,真题,大纲,参考书
    在window10下python:ocr实战
    【无标题】
  • 原文地址:https://blog.csdn.net/weixin_64313980/article/details/126062000