当前位置:网站首页>OA项目之会议通知(查询&是否参会&反馈详情)
OA项目之会议通知(查询&是否参会&反馈详情)
2022-07-28 19:52:00 【酒醉猫(^・ェ・^)】
目录
一、会议通知查询SQL(难点)
登录xx账号,就要查出凡是xx是参与者、列席这、主持人中的一员,那么都要查出来
查询条件:登录用户 id 2
分析(涉及到的表):
会议信息表:t_oa_meeting_info
会议反馈表:t_oa_meeting_feedback
例: 1、查询出带xx id=2 的会议信息:
SELECT * from t_oa_meeting_info where FIND_IN_SET(2,CONCAT(canyuze,',',liexize,',',zhuchiren)) and state=4运行SQL结果:
2、不管会议是否得到反馈,都要查询出来,所以选外连接,会议信息表为主:SELECT IFNULL(f.result,-1) result,t1.* FROM (SELECT * from t_oa_meeting_info where FIND_IN_SET(2,CONCAT(canyuze,',',liexize,',',zhuchiren)) and state=4) t1 LEFT JOIN t_oa_meeting_feedback f on t1.id=f.meetingId and f.personId=2 ORDER BY result;运行SQL结果:
二、会议反馈详情SQL(难点)
分析(涉及到的表):
用户表:t_oa_user
会议信息表:t_oa_meeting_info
会议反馈表:t_oa_meeting_feedback
查询条件:会议 id 12
1、拿到会议 id 为12的会议,所有参与人员的姓名
1) 先拿到所有的参与人员 id
SELECT CONCAT(canyuze,',',liexize,',',zhuchiren) from t_oa_meeting_info where id=12SQL运行结果:
2) 再拿到对应参与人员的姓名
SELECT * from t_oa_user where FIND_IN_SET(id, (SELECT CONCAT(canyuze,',',liexize,',',zhuchiren) from t_oa_meeting_info where id=12))SQL运行结果:
2、连接 会议信息反馈表,拿到对应的反馈情况(未读、参加、不参加)
SELECT * from t_oa_user where FIND_IN_SET(id, (SELECT CONCAT(canyuze,',',liexize,',',zhuchiren) from t_oa_meeting_info where id=12))SQL运行结果:
3、根据 会议信息反馈情况进行分组
select t.result,GROUP_CONCAT(t.name) names from (select t1.name,IFNULL(f.result,-1) result from (SELECT * from t_oa_user where FIND_IN_SET(id, (SELECT CONCAT(canyuze,',',liexize,',',zhuchiren) from t_oa_meeting_info where id=12))) t1 left join t_oa_meeting_feedback f on t1.id=f.personId and f.meetingId=12) t GROUP BY t.resultSQL运行结果:
三、会议通知后台代码实现
这里简单提及一下前端代码:
header.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <link rel="stylesheet" href="${pageContext.request.contextPath }/static/js/layui/css/layui.css"> <!-- 引入 layui.js --> <script src="${pageContext.request.contextPath }/static/js/layui/layui.js"></script> <!-- 指定整个项目的根路径 --> <base href="${pageContext.request.contextPath }/"/> <!-- 存放layui扩展模块的配置文件 --> <script src="${pageContext.request.contextPath }/static/js/layui/config.js"></script> <input id="ctx" value="${pageContext.request.contextPath }" type="hidden"/> <title>玉渊工作室</title>
前面SQL语句都已编写完毕,接下来就开始实现后台代码了:
实体类:MeetingFeedBack 对应会议反馈表
package com.zking.entity;
import java.io.Serializable;
/**
* t_oa_meeting_feedback 会议反馈表
* 实体类:会议反馈
* @author 杨总
*
*/
public class MeetingFeedBack implements Serializable {
private String id;
private Long meetingId;
private Integer personType;
private Long personId;
private Integer result;
private String reason;
// 会议标题
private String title;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Long getMeetingId() {
return meetingId;
}
public void setMeetingId(Long meetingId) {
this.meetingId = meetingId;
}
public Integer getPersonType() {
return personType;
}
public void setPersonType(Integer personType) {
this.personType = personType;
}
public Long getPersonId() {
return personId;
}
public void setPersonId(Long personId) {
this.personId = personId;
}
public Integer getResult() {
return result;
}
public void setResult(Integer result) {
this.result = result;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public MeetingFeedBack() {
super();
// TODO Auto-generated constructor stub
}
@Override
public String toString() {
return "MeetingFeedBack [id=" + id + ", meetingId=" + meetingId + ", personType=" + personType + ", personId="
+ personId + ", result=" + result + ", reason=" + reason + "]";
}
}MeetingFeedBackDao:
package com.zking.dao;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.zking.entity.MeetingFeedBack;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
public class MeetingFeedBackDao extends BaseDao<MeetingFeedBack>{
//会议通知查询
public List<Map<String, Object>> queryMeetingFeedBackByUserId(MeetingFeedBack back, PageBean pageBean)
throws SQLException, InstantiationException, IllegalAccessException {
String sql="SELECT\r\n" +
" IFNULL(f.result,-1) result,t1.*\r\n" +
" FROM\r\n" +
" (SELECT * from t_oa_meeting_info where FIND_IN_SET("+back.getPersonId()+",CONCAT(canyuze,',',liexize,',',zhuchiren)) and state=4) t1\r\n" +
" LEFT JOIN t_oa_meeting_feedback f on t1.id=f.meetingId\r\n" +
" and f.personId="+back.getPersonId()+"\r\n" +
" ORDER BY result";
return super.executeQuery(sql, pageBean);
}
// back.getPersonId()
}
MeetingFeedBackAction:
package com.zking.web;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zking.dao.MeetingFeedBackDao;
import com.zking.entity.MeetingFeedBack;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.PageBean;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
public class MeetingFeedBackAction extends ActionSupport implements ModelDriver<MeetingFeedBack>{
private MeetingFeedBack back=new MeetingFeedBack();
private MeetingFeedBackDao backDao=new MeetingFeedBackDao();
@Override
public MeetingFeedBack getModel() {
return back;
}
// 会议通知查询
public String queryMeetingFeedBackByUserId(HttpServletRequest req, HttpServletResponse resp) {
try {
PageBean pageBean=new PageBean();
pageBean.setRequest(req);
List<Map<String, Object>> infos = backDao.queryMeetingFeedBackByUserId(back, pageBean);
// 注意:layui中的数据表格的格式
ResponseUtil.writeJson(resp, R.ok(0, "会议通知数据查询成功",pageBean.getTotal(),infos));
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, "会议通知数据查询失败"));
} catch (Exception e2) {
e2.printStackTrace();
}
}
return null;
}
}
mvc.xml:
<action path="/feedBack" type="com.zking.web.MeetingFeedBackAction">
</action>运行效果如下:

四、会议反馈功能实现(是否参会)

MeetingFeedBackDao:
// 会议反馈
public int add(MeetingFeedBack back) throws Exception {
String sql="insert into t_oa_meeting_feedback values (?,?,?,?,?,?)";
//前台没有传递id到后台,所以自己生成id
back.setId(UUID.randomUUID().toString().replace("-", ""));
return super.executeUpdate(sql, back, new String [] {"id","meetingId","personType","personId","result","reason"});
}MeetingFeedBackAction:
//会议反馈
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
// rs是sql语句执行的影响行数
int rs = backDao.add(back);
if(rs>0) {
ResponseUtil.writeJson(resp, R.ok(200, "会议反馈信息成功"));
}else {
ResponseUtil.writeJson(resp, R.error(0, "会议反馈信息失败"));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, "会议反馈信息失败"));
} catch (Exception e2) {
e2.printStackTrace();
}
}
return null;
}
接下来运行:


点击会议反馈按钮之后:

我们会发现第16条数据已经没有了,进数据库查询 会议信息反馈表(t_oa_meeting_feedback):

会议反馈功能已实现~
五、反馈详情功能实现
MeetingFeedBackDao:
// 会议反馈详情
public List<Map<String, Object>> queryMeetingBackByMeetingId(MeetingFeedBack back, PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException {
String sql="select \r\n" +
" t.result,GROUP_CONCAT(t.name) names\r\n" +
" from\r\n" +
" (select \r\n" +
" t1.name,IFNULL(f.result,-1) result\r\n" +
" from\r\n" +
" (SELECT * from t_oa_user where FIND_IN_SET(id, (SELECT CONCAT(canyuze,',',liexize,',',zhuchiren) from\r\n" +
" t_oa_meeting_info \r\n" +
" where id="+back.getMeetingId()+"))) t1\r\n" +
" left join t_oa_meeting_feedback f on t1.id=f.personId and f.meetingId="+back.getMeetingId()+") t\r\n" +
" GROUP BY t.result";
return super.executeQuery(sql, pageBean);
}MeetingFeedBackAction:
//会议反馈详情
public String queryMeetingBackByMeetingId(HttpServletRequest req, HttpServletResponse resp) {
try {
PageBean pageBean=new PageBean();
pageBean.setRequest(req);
List<Map<String, Object>> lst = backDao.queryMeetingBackByMeetingId(back, pageBean);
// 注意:layui中的数据表格的格式
ResponseUtil.writeJson(resp, R.ok(0, "会议反馈详情数据查询成功",pageBean.getTotal(),lst));
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, "会议反馈详情数据查询失败"));
} catch (Exception e2) {
e2.printStackTrace();
}
}
return null;
}运行效果:
比如登录此(张强)账号,对 第8条 做出反馈:


说明张强是缺席的。
接着换登录 admin 账号:

在我的会议中查看 反馈详情:
我们就可以看到张强在缺席人员的列表中了!
为了准确性,接着我们测试 添加一些参会人员,比如张三,
我们登录 张三 账号:

现在是未读状态,点击参会:

会议反馈成功之后,再次切换 admin 账号,
在我的会议中查看 反馈详情:

那么 张三就出现在参会人员的列表中啦~
今日功能已经实现,我们下期继续!感谢观看
边栏推荐
- LeetCode·581.最短无序连续子数组·双指针
- 关于一些小需求,用案例方式记录
- 酷派主动终止针对小米公司的专利侵权诉讼
- 学习Typescript(二)
- System integration under microservice architecture
- 提前布局6G赛道!紫光展锐发布《6G无界 有AI》白皮书
- 华为发布首款电驱动系统DriveONE:充电10分钟续航200km
- 作价11.5亿元,1206件设备注入合资公司!SK海力士抢食大陆晶圆代工市场!
- Quii Cordova plugin telerik imagepicker plug-in multi image upload out of sequence
- 瑞典法院取消对华为和中兴的5G频谱拍卖禁令
猜你喜欢

Timing analysis and constraints based on Xilinx

Explain C language 12 in detail (C language series)

Bus, protocol, specification, interface, data acquisition and control system in industrial communication field

Ijcai2022 tutorial | dialogue recommendation system

Leetcode linked list problem -- 142. circular linked list II (learn the linked list by one question and one article)

职场高薪 |「中高级测试」面试题

The greatest romance of programmers~

SSM use @async and create threadpooltaskexecutor thread pool

基于Xception-TD的中华传统刺绣分类模型构建

Uncaught Error:Invalid geoJson format Cannot read property ‘length‘ of undefind
随机推荐
日志瘦身神操作:从5G优化到1G到底是怎么做到的!(荣耀典藏版)
The ref value ‘xxx‘ will likely have changed by the time this effect function runs. If this ref......
Attribute based encryption simulation and code implementation (cp-abe) paper: ciphertext policy attribute based encryption
Niuke turns on the camera and the picture disappears a few seconds later | the picture flashes when the camera is turned on
入行4年,跳槽2次,我摸透了软件测试这一行~
蚂蚁集团境外站点 Seata 实践与探索
Capture video by buffering
Talk about row storage and column storage of database
LeetCode链表问题——142.环形链表II(一题一文学会链表)
Coolpad voluntarily terminated the patent infringement lawsuit against Xiaomi
It is said that Microsoft has obtained the supply license for Xianghua! Will Huawei usher in the full lifting of the ban?
基于BRNN的政务APP评论端到端方面级情感分析方法
酷派主动终止针对小米公司的专利侵权诉讼
30. Learn highcharts label rotation histogram
(PMIC) full and half bridge drive csd95481rwj PDF specification
聊一聊数据库的行存与列存
实现瀑布流效果
物联网技术栈之网关技术
Explain C language 12 in detail (C language series)
C process control statement






