当前位置:网站首页>My meeting of OA project
My meeting of OA project
2022-07-26 13:54:00 【Pulis kengmi】
Hello everyone ~ I'm here again ~~ Let's continue with the last issue , Today's theme is my work in the project !!
Catalog
Preparation :
Get into mysql Inquire about sql sentence , as follows :
-- My meeting
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;
-- The approver should also find out if the meeting is not approved The meeting information table is used as the main table User table is a slave table User conference information table left outer chain user table
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;
-- analysis
-- The time period should be formatted , Otherwise, the page will display a string of numbers
-- Conference status is numeric , The front end should display the meeting status description
-- state :0 Cancel the meeting 1 newly build 2 To audit 3 rejected 4 To be opened 5 Have in hand 6 Start voting 7 Close the meeting , The default value is 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 ' Cancel the meeting '
when 1 then ' newly build '
when 2 then ' To audit '
when 3 then ' rejected '
when 4 then ' To be opened '
when 5 then ' Have in hand '
when 6 then ' Start voting '
when 7 then ' Close the meeting '
else ' other ' 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. Background code
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<MeetingInfo>{
// New conference information
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 "SELECT\r\n" +
" a.id,\r\n" +
" a.title,\r\n" +
" a.content,\r\n" +
" a.liexize,\r\n" +
" a.zhuchiren,\r\n" +
" b.`name` zhuchirenname,\r\n" +
" 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\r\n" +
" a.state \r\n" +
" WHEN 0 THEN\r\n" +
" ' Cancel the meeting ' \r\n" +
" WHEN 1 THEN\r\n" +
" ' newly build ' \r\n" +
" WHEN 2 THEN\r\n" +
" ' To audit ' \r\n" +
" WHEN 3 THEN\r\n" +
" ' rejected ' \r\n" +
" WHEN 4 THEN\r\n" +
" ' To be opened ' \r\n" +
" WHEN 5 THEN\r\n" +
" ' Have in hand ' \r\n" +
" WHEN 6 THEN\r\n" +
" ' Start voting ' \r\n" +
" WHEN 7 THEN\r\n" +
" ' Close the meeting ' ELSE ' other ' \r\n" +
"END \r\n" +
" ) meetingstate,\r\n" +
" a.seatPic,\r\n" +
" a.remark,\r\n" +
" a.auditor,\r\n" +
" c.`name` auditorname \r\n" +
"FROM\r\n" +
" 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 and 1=1 ";
}
// My meeting SQL, Other menus will also be used later
public List<Map<String, Object>> myInfos(MeetingInfo info,PageBean pageBean)
throws SQLException, InstantiationException, IllegalAccessException {
String sql=getSQL();
// Get the title of the meeting
String title = info.getTitle();
if(StringUtils.isNotBlank(title)) {
sql +=" and title like '%"+title+"%' ";
}
sql +=" and zhuchiren = "+info.getZhuchiren()+" ";
return super.executeQuery(sql, pageBean);
}
}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<MeetingInfo>{
private MeetingInfo info = new MeetingInfo();
private MeetingInfoDao meetingInfoDao = new MeetingInfoDao();
@Override
public MeetingInfo getModel() {
// Mode two :
ConvertUtils.register(new MyDateConverter(),Date.class);
return info;
}
// The meeting was announced
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
int rs = meetingInfoDao.add(info);
if (rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " The conference was published successfully "));
}else {
ResponseUtil.writeJson(resp, R.error(0, " Conference publishing failed "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Conference publishing failed "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
// My meeting
public String myInfos(HttpServletRequest req,HttpServletResponse resp) {
try {
PageBean pageBean = new PageBean();
pageBean.setRequest(req);
List<Map<String, Object>> lst = meetingInfoDao.myInfos(info, pageBean);
// Be careful :layui Format of data in
ResponseUtil.writeJson(resp, R.ok(0, " My meeting data query succeeded ",pageBean.getTotal(),lst));
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp,R.error(0, " My meeting data query failed "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
}
3、resource.properties file
dirPath=E:/temp/images/T280/
serverPath=/test_layui/upload/paizuo/
dirPathSign=E:/temp/images/T280/sign/
serverPathSign=/test_layui/upload/sign/
4、 The server

Two 、 front end
1、myMeeting.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/meeting/myMeeting.js"></script>
<title> User management </title>
</head>
<style>
body{
margin:15px;
}
.layui-table-cell {height: inherit;}
.layui-layer-page .layui-layer-content { overflow: visible !important;}
</style>
<body>
<!-- Search bar -->
<div class="layui-form-item" style="margin:15px 0px;">
<div class="layui-inline">
<label class="layui-form-label"> The title of the meeting </label>
<div class="layui-input-inline">
<input type="hidden" id="zhuchiren" value="${user.id }"/>
<input type="text" id="title" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button id="btn_search" type="button" class="layui-btn"><i class="layui-icon layui-icon-search"></i> Inquire about </button>
</div>
</div>
<!-- Data table -->
<table id="tb" lay-filter="tb" class="layui-table" style="margin-top:-15px"></table>
<!-- Dialog box ( submit for censorship ) -->
<div id="audit" style="display:none;">
<form style="margin:20px 15px;" class="layui-form layui-form-pane" lay-filter="audit">
<div class="layui-inline">
<label class="layui-form-label"> Submitter </label>
<div class="layui-input-inline">
<input type="hidden" id="meetingId" value=""/>
<select id="auditor" style="poistion:relative;z-index:1000">
<option value="">--- Please select ---</option>
</select>
</div>
<div class="layui-input-inline">
<button id="btn_auditor" class="layui-btn"> submit for censorship </button>
</div>
</div>
</form>
</div>
<!-- Dialog box ( Feedback details ) -->
<div id="feedback" style="display:none;padding:15px;">
<fieldset class="layui-elem-field layui-field-title">
<legend> Participants </legend>
</fieldset>
<blockquote class="layui-elem-quote" id="meeting_ok"></blockquote>
<fieldset class="layui-elem-field layui-field-title">
<legend> Absentees </legend>
</fieldset>
<blockquote class="layui-elem-quote" id="meeting_no"></blockquote>
<fieldset class="layui-elem-field layui-field-title">
<legend> Unread people </legend>
</fieldset>
<blockquote class="layui-elem-quote" id="meeting_noread"></blockquote>
</div>
<script type="text/html" id="tbar">
{
{# if(d.state==1 || d.state==3){ }}
<a class="layui-btn layui-btn-xs" lay-event="seat"> Meeting row </a>
<a class="layui-btn layui-btn-xs" lay-event="send"> submit for censorship </a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"> Delete </a>
{
{# } }}
{
{# if(d.state!=1 && d.state!=2 && d.state!=3){ }}
<a class="layui-btn layui-btn-xs" lay-event="back"> Feedback details </a>
{
{# } }}
</script>
</body>
</html>
2、myMeeting.js
let layer,$,table;
var row;
layui.use(['jquery','layer','table'],function(){
layer=layui.layer,
$=layui.jquery,
table=layui.table;
// Initialization table
initTable();
// Bind the click event of the query button
$('#btn_search').click(function(){
query();
});
});
//1. Initialize the data table
function initTable(){
table.render({ // Perform rendering
elem: '#tb', // Specify the original table element selector ( recommend id Selectors )
// url: 'user.action?methodName=list', // Request address
height: 340, // Custom height
loading: false, // Whether to load the bar ( Default true)
cols: [[ // Set the header
{field: 'id', title: ' Conference number ', width: 120},
{field: 'title', title: ' The title of the meeting ', width: 120},
{field: 'location', title: ' Place of meeting ', width: 140},
{field: 'startTime', title: ' Starting time ', width: 120},
{field: 'endTime', title: ' End time ', width: 140},
{field: 'meetingstate', title: ' Meeting status ', width: 120},
{field: 'seatPic', title: ' Meeting row ', width: 140,templet: function(d){
console.log(d);
// Get the current row data , And spliced into a custom template
return '<img src="'+d.seatPic+'">'
}},
{field: 'auditor', title: ' Approved by ', width: 120},
{field: '', title: ' operation ', width: 220,toolbar:'#tbar'},
]]
});
// In the page <table> Must be configured in lay-filter="tb_goods" Attribute can trigger attribute !!!
table.on('tool(tb)', function (obj) {
row = obj.data;
if (obj.event == "seat") {
layer.msg(" Row seat ");
}else if(obj.event == "send"){
layer.msg(" submit for censorship ");
}else if(obj.event == "del"){
layer.msg(" Cancel the meeting ");
}else if(obj.event == "back"){
layer.msg(" Feedback details ");
}else {
}
});
}
//2. Click to query
function query(){
table.reload('tb', {
url: 'info.action', // Request address
method: 'POST', // Request mode ,GET perhaps POST
loading: true, // Whether to load the bar ( Default true)
page: true, // Pagination or not
where: { // Set additional parameters for asynchronous data interface , Arbitrarily set
'methodName':'myInfos',
'title':$('#title').val(),
'zhuchiren':$("#zhuchiren").val()
},
request: { // Custom paging request parameter name
pageName: 'page', // Parameter name of page number , Default :page
limitName: 'rows' // Parameter name of data volume per page , Default :limit
}
});
}
Running results :
边栏推荐
- C语言_结构体指针来访问结构体数组
- Intercept the coordinate points (four point coordinates of the face frame) face image from the marked XML file and save it in the specified folder
- Comparison between SIGMOD function and softmax function
- C语言_结构体和数组的结合
- Algorithm -- continuous sequence (kotlin)
- 数据泄漏、删除事件频发,企业应如何构建安全防线?
- 历时15年、拥有5亿用户的飞信,彻底死了
- Completable future practical usage
- Unicorn, valued at $1.5 billion, was suddenly laid off, and another track was cold?
- Code cloud, which officially supports the pages function, can deploy static pages
猜你喜欢

.net6与英雄联盟邂逅之——根据官方LCU API制作游戏助手

JS download files, filesaver.js export txt and Excel files

Official announcement! Edweisen group and Baidu xirang reached a deep co creation cooperation

WPS凭什么拒绝广告?

Polymorphic case - making drinks

天翼云Web应用防火墙(边缘云版)支持检测和拦截Apache Spark shell命令注入漏洞

ROS2学习(1)ROS2简述

Add a display horizontal line between idea methods

Multi objective optimization series 1 --- explanation of non dominated sorting function of NSGA2

The serialization class in unity is in JSON format
随机推荐
[turn] judge the relationship between two geometries in ArcGIS
Tianjin emergency response Bureau and central enterprises in Tianjin signed an agreement to deepen the construction of emergency linkage mechanism
Ros2 learning (1) introduction to ros2
「中高级试题」:MVCC实现原理是什么?
历时15年、拥有5亿用户的飞信,彻底死了
C语言_结构体指针来访问结构体数组
Pytorch学习笔记(一)安装与常用函数的使用
.net6与英雄联盟邂逅之——根据官方LCU API制作游戏助手
Polymorphic case - making drinks
php使用sqlserver
Pytorch学习笔记(三)模型的使用、修改、训练(CPU/GPU)及验证
Detailed relation extraction model casrel
Add a display horizontal line between idea methods
Solve the problem that JUnit of idea console cannot be input with scanner
【Oauth2】五、OAuth2LoginAuthenticationFilter
万字长文,浅谈企业数字化建模蓝图
Tdsql-c serverless: help start-ups achieve cost reduction and efficiency increase
Latest battle report: Ten certifications and five best practices
Tianyi cloud web application firewall (edge cloud version) supports the detection and interception of Apache spark shell command injection vulnerabilities
421. 数组中两个数的最大异或值