目录
今天与大家分享的会议OA项目中的会议通知功能,我将会议通知分割为两部分来实现,会议通知与反馈详情。
一、会议通知
1、会议通知的SQL语句编写(难点)
我们先使用函数find_in_set(id,条件)来查询出我们想要查询的那条会议的会议信息
由于不论会议是否得到反馈我们都需要查询出来,所以我们得使用左外连接,会议信息表为主表,会议反馈详情表作为从表,这样能够保证我们的数据不会丢失
--会议通知查询sql
--查询出会议id为2的会议信息
SELECT * from t_oa_meeting_info where FIND_IN_SET(2,CONCAT
(canyuze,liexize,zhuchiren)) and state = 4
--不管会议是否得到反馈,都要查询出来,所以选用外连接,会议信息表为主
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 personId =2
ORDER BY result
2、后台编码
因为我们需要用到一个新的表会议反馈详情表t_oa_meeting_feedback,所以我们需要以该表建立一个实体类
package com.zking.entity;
import java.io.Serializable;
/**
* 会议反馈表
* @author Administrator
*
*/
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 + "]";
}
}
Dao层
//会议通知查询
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" +
&#