当前位置:网站首页>OA Project Pending Meeting & History Meeting & All Meetings

OA Project Pending Meeting & History Meeting & All Meetings

2022-08-11 07:08:00 Yu Musheng

目录

一、SQL语句编写

1、待开会议

2、所有会议

二、功能开发

1、To be held meeting function development

2、All meeting functions developed


一、SQL语句编写

1、待开会议

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

分析:

We only need to query the status as 4,即为待开的会议(state=4)

 函数find_in_set(y,xxx)yput user number,xxxIn the middle are the numbers of the participants, attendees and moderators,If the user's ID exists in the last three fields, it will be queried,It means that the user exists in this conference,is one of the participants

SQL语句:

select CONCAT(canyuze,',',liexize,',',zhuchiren),a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren,
b.name zhuchirenname,a.location,
DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,
DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,
a.state,
(
case a.state
when 0 then '取消会议'
when 1 then '新建'
when 2 then '待审核'
when 3 then '驳回'
when 4 then '待开'
when 5 then '进行中'
when 6 then '开启投票'
when 7 then '结束会议'
else '其他' end
) meetingstate,
a.seatPic,a.remark,a.auditor,c.name anditorname from t_oa_meeting_info a
inner join t_oa_user b on a.zhuchiren = b.id
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))

效果:

  

2、所有会议

简介:当前登录账号,只要是 某会议 的参与者、列席者、主持人、One of the approvers,Then it must be inquired

分析:

 All meetings do not require restricted status,And you need to add an approver column

注意:If the current meeting has not been submitted for review, that is, there is no approver,我们需要用ifnullThe function sets its number to -1,Otherwise data loss will occur

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,
b.name zhuchirenname,a.location,
DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,
DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,
a.state,
(
case a.state
when 0 then '取消会议'
when 1 then '新建'
when 2 then '待审核'
when 3 then '驳回'
when 4 then '待开'
when 5 then '进行中'
when 6 then '开启投票'
when 7 then '结束会议'
else '其他' end
) meetingstate,
a.seatPic,a.remark,a.auditor,c.name anditorname from t_oa_meeting_info a
inner join t_oa_user b on a.zhuchiren = b.id
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)))

效果:

二、功能开发

1、To be held meeting function development

Import the meeting to be held firstjsp页面与js文件

 js文件

 代码块:

let layer,form,table,$;
var row;
layui.use(['layer','form','table'],function(){
    layer=layui.layer,form=layui.form,table=layui.table,$=layui.jquery;
    
    //初始化会议列表
    initMeeting();
   
    //绑定查询按钮的点击事件
    $('#btn_meeting_search').click(function(){
        query();
    });
});
 
//1.初始化会议列表
function initMeeting(){
    table.render({           //执行渲染
        elem: '#tb_meeting',   //指定原始表格元素选择器(推荐id选择器)
        height: 400,         //自定义高度
        loading: false,      //是否显示加载条(默认 true)
        cols: [[             //设置表头
            {field: 'title', title: '会议标题', width: 180},
            {field: 'location', title: '会议地点', width: 120},
            {field: 'startTime', title: '开始时间', width: 180},
            {field: 'endTime', title: '结束时间', width: 180},
            {field: 'meetingstate', title: '会议状态', width: 90},
            {field: 'zhuchirenname', title: '主持人', width: 120},
            //{field: '', title: '操作', width: 260, toolbar: '#tbMeeting'}
        ]]
    });
}
 
//2.待开会议
function query(){
    table.reload('tb_meeting', {
        url: 'info.action',     //请求地址
        method: 'POST',                    //请求方式,GET或者POST
        loading: true,                     //是否显示加载条(默认 true)
        page: true,                        //是否分页
        where: {                           //设定异步数据接口的额外参数,任意设
            'methodName':'queryMeetingInfoByState',
            'title':$('#title').val(),
            'zhuchiren':$('#userid').val(),
            'state':4
        },
        request: {                         //自定义分页请求参数名
            pageName: 'page', //页码的参数名称,默认:page
            limitName: 'rows' //每页数据量的参数名,默认:limit
        },
        done: function (res, curr, count) {
            //查询完成的回调函数
        }
    });
}

 编写dao方法

//	待开会议
	public List<Map<String, Object>> queryMeetingInfoByState(MeetingInfo info, PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException {
		String sql=" select CONCAT(canyuze,',',liexize,',',zhuchiren),a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren,\r\n" + 
				" b.name zhuchirenname,a.location,\r\n" + 
				" DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,\r\n" + 
				" DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,\r\n" + 
				" a.state,\r\n" + 
				" (\r\n" + 
				" case a.state\r\n" + 
				" when 0 then '取消会议'\r\n" + 
				" when 1 then '新建'\r\n" + 
				" when 2 then '待审核'\r\n" + 
				" when 3 then '驳回'\r\n" + 
				" when 4 then '待开'\r\n" + 
				" when 5 then '进行中'\r\n" + 
				" when 6 then '开启投票'\r\n" + 
				" when 7 then '结束会议'\r\n" + 
				" else '其他' end\r\n" + 
				" ) meetingstate,\r\n" + 
				" a.seatPic,a.remark,a.auditor,c.name anditorname from t_oa_meeting_info a\r\n" + 
				" inner join t_oa_user b on a.zhuchiren = b.id\r\n" + 
				" 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" + 
				" ";
		return super.executeQuery(sql, pageBean);
	}

 web层调用

	
//	待开会议
	public String queryMeetingInfoByState(HttpServletRequest req, HttpServletResponse resp) {
		try {
			PageBean pageBean = new PageBean();
			pageBean.setRequest(req);
			List<Map<String, Object>> lst = infoDao.queryMeetingInfoByState(info, pageBean);
//		注意:layuiThe format of the data table in 
			ResponseUtil.writeJson(resp, R.ok(0, "待开会议数据查询成功",pageBean.getTotal(),lst));
		} catch (Exception e) {
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.ok(0, "待开会议数据查询失败"));
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		}
		return null;
	}

2、All meeting functions developed

Arrive as first as a pending meetingjsp页面和js文件

代码块:

js文件

let layer,form,table,$;
var row;
layui.use(['layer','form','table'],function(){
    layer=layui.layer,form=layui.form,table=layui.table,$=layui.jquery;
    
    //初始化会议列表
    initMeeting();
   
    //绑定查询按钮的点击事件
    $('#btn_meeting_search').click(function(){
        query();
    });
});
 
//1.初始化会议列表
function initMeeting(){
    table.render({           //执行渲染
        elem: '#tb_meeting',   //指定原始表格元素选择器(推荐id选择器)
        height: 400,         //自定义高度
        loading: false,      //是否显示加载条(默认 true)
        cols: [[             //设置表头
            {field: 'title', title: '会议标题', width: 180},
            {field: 'location', title: '会议地点', width: 120},
            {field: 'startTime', title: '开始时间', width: 180},
            {field: 'endTime', title: '结束时间', width: 180},
            {field: 'meetingstate', title: '会议状态', width: 90},
            {field: 'zhuchirenname', title: '主持人', width: 120},
            //{field: '', title: '操作', width: 260, toolbar: '#tbMeeting'}
        ]]
    });
}
 
//2.查询所有会议
function query(){
    table.reload('tb_meeting', {
        url: 'info.action',     //请求地址
        method: 'POST',                    //请求方式,GET或者POST
        loading: true,                     //是否显示加载条(默认 true)
        page: true,                        //是否分页
        where: {                           //设定异步数据接口的额外参数,任意设
            'methodName':'allInfos',
            'title':$('#title').val(),
            'zhuchiren':$('#userid').val()
        },
        request: {                         //自定义分页请求参数名
            pageName: 'page', //页码的参数名称,默认:page
            limitName: 'rows' //每页数据量的参数名,默认:limit
        },
        done: function (res, curr, count) {
            //查询完成的回调函数
        }
    });
}

编写dao方法

//所有会议
	public List<Map<String, Object>> allInfos(MeetingInfo info, PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException {
		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" + 
				" b.name zhuchirenname,a.location,\r\n" + 
				" DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,\r\n" + 
				" DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,\r\n" + 
				" a.state,\r\n" + 
				" (\r\n" + 
				" case a.state\r\n" + 
				" when 0 then '取消会议'\r\n" + 
				" when 1 then '新建'\r\n" + 
				" when 2 then '待审核'\r\n" + 
				" when 3 then '驳回'\r\n" + 
				" when 4 then '待开'\r\n" + 
				" when 5 then '进行中'\r\n" + 
				" when 6 then '开启投票'\r\n" + 
				" when 7 then '结束会议'\r\n" + 
				" else '其他' end\r\n" + 
				" ) meetingstate,\r\n" + 
				" a.seatPic,a.remark,a.auditor,c.name anditorname from t_oa_meeting_info a\r\n" + 
				" inner join t_oa_user b on a.zhuchiren = b.id\r\n" + 
				" 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)))";
		return super.executeQuery(sql, pageBean);
	}

web层调用:

//	所有会议
	public String allInfos(HttpServletRequest req, HttpServletResponse resp) {
		try {
			PageBean pageBean = new PageBean();
			pageBean.setRequest(req);
			List<Map<String, Object>> lst = infoDao.allInfos(info, pageBean);
//		注意:layuiThe format of the data table in 
			ResponseUtil.writeJson(resp, R.ok(0, "所有会议数据查询成功",pageBean.getTotal(),lst));
		} catch (Exception e) {
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.ok(0, "所有会议数据查询失败"));
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		}
		return null;
	}

效果:

 

 

原网站

版权声明
本文为[Yu Musheng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110517296730.html