大家好~我又来啦~~我们接着上一期,今天的的主题是我的项目这一块的工作!!
目录
前期准备:
2.后台代码
1.MeetingInfoDao:
2、MeetingInfoAction
3、resource.properties文件
4、服务器
二、前端
1、myMeeting.jsp
2、myMeeting.js
前期准备:
进入mysql 查询sql语句,如下:
-- 我的会议 SELECt a.*,b.`name` zhuchirenname,c.`name` auditorname from t_oa_meeting_info a, t_oa_user b, t_oa_user c where a.zhuchiren=b.id and a.auditor = c.id; -- 会议没得审批人也要查询出来 会议信息表作为主表 用户表为从表 用户会议信息表左外链用户表 SELECt a.*,b.`name` zhuchirenname,c.`name` auditorname 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; -- 分析 -- 时间段要格式化,否者页面会显示一串数字 -- 会议状态是数字,前端要显示会议状态描述 -- 状态:0取消会议 1新建 2待审核 3驳回 4待开 5进行中 6开启投票 7结束会议,默认值为1 SELECt a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren,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 ,b.`name` zhuchirenname, c.`name` auditorname 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
2.后台代码
1.MeetingInfoDao:
package com.zking.dao; import java.sql.SQLException; import java.util.List; import java.util.Map; import com.zking.entity.MeetingInfo; import com.zking.util.BaseDao; import com.zking.util.PageBean; import com.zking.util.StringUtils; public class MeetingInfoDao extends BaseDao{ //会议信息的新增 public int add(MeetingInfo t) throws Exception { String sql = "insert into t_oa_meeting_info(title,content,canyuze,liexize,zhuchiren,location,startTime,endTime,remark) values(?,?,?,?,?,?,?,?,?)"; return super.executeUpdate(sql, t, new String[] {"title","content","canyuze","liexize","zhuchiren","location","startTime","endTime","remark"}); } private String getSQL() { return "SELECTrn" + " a.id,rn" + " a.title,rn" + " a.content,rn" + " a.liexize,rn" + " a.zhuchiren,rn" + " b.`name` zhuchirenname,rn" + " a.location,rn" + " DATE_FORMAT( a.startTime, '%y-%m-%d %H-%m-%s' ) startTime,rn" + " DATE_FORMAT( a.endTime, '%y-%m-%d %H-%m-%s' ) endTime,rn" + " a.state,rn" + " (rn" + "CASErn" + " a.state rn" + " WHEN 0 THENrn" + " '取消会议' rn" + " WHEN 1 THENrn" + " '新建' rn" + " WHEN 2 THENrn" + " '待审核' rn" + " WHEN 3 THENrn" + " '驳回' rn" + " WHEN 4 THENrn" + " '待开' rn" + " WHEN 5 THENrn" + " '进行中' rn" + " WHEN 6 THENrn" + " '开启投票' rn" + " WHEN 7 THENrn" + " '结束会议' ELSE '其他' rn" + "END rn" + " ) meetingstate,rn" + " a.seatPic,rn" + " a.remark,rn" + " a.auditor,rn" + " c.`name` auditorname rn" + "FROMrn" + " t_oa_meeting_info arn" + " INNER JOIN t_oa_user b ON a.zhuchiren = b.idrn" + " LEFT JOIN t_oa_user c ON a.auditor = c.id and 1=1 "; } //我的会议SQL,后续其他的菜单也会使用 public List
2、MeetingInfoAction
package com.zking.web;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.ConvertUtils;
import com.zking.dao.MeetingInfoDao;
import com.zking.entity.MeetingInfo;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.MyDateConverter;
import com.zking.util.PageBean;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
public class MeetingInfoAction extends ActionSupport implements ModelDriver{
private MeetingInfo info = new MeetingInfo();
private MeetingInfoDao meetingInfoDao = new MeetingInfoDao();
@Override
public MeetingInfo getModel() {
//方式二:
ConvertUtils.register(new MyDateConverter(),Date.class);
return info;
}
// 会议发布
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
int rs = meetingInfoDao.add(info);
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 e1) {
e1.printStackTrace();
}
}
return null;
}
// 我的会议
public String myInfos(HttpServletRequest req,HttpServletResponse resp) {
try {
PageBean pageBean = new PageBean();
pageBean.setRequest(req);
List
3、resource.properties文件
dirPath=E:/temp/images/T280/
serverPath=/test_layui/upload/paizuo/
dirPathSign=E:/temp/images/T280/sign/
serverPathSign=/test_layui/upload/sign/
4、服务器
dirPath=E:/temp/images/T280/ serverPath=/test_layui/upload/paizuo/ dirPathSign=E:/temp/images/T280/sign/ serverPathSign=/test_layui/upload/sign/
4、服务器
二、前端
1、myMeeting.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
用户管理
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/common/header.jsp"%>用户管理



