当前位置:网站首页>My meeting of OA project (query)
My meeting of OA project (query)
2022-07-26 08:43:00 【Xiao Chen likes sugar ①】
Catalog
Two 、 My conference background code writing
3、 ... and 、 My conference front
One 、 My meeting SQL To write
analysis :
-- You need to find out if the meeting has not been approved , Then the meeting information table will be used as the main table , User table as slave table , Connect the user table with the left outside of the conference information table
-- 1. The time field should be formatted , Otherwise, the page will display a string of numbers
-- 2. Conference status is numeric , The front end should display the meeting status descriptionstate :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
Final SQL sentence :
select 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 ' 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,
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
Running results :


Two 、 My conference background code writing
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>{
// Conference information added
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"});
}
// My meeting SQL Other menus will also be used later
private String getSQL() {
return "select a.id,a.title,a.content,a.canyuze,a.liexize,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 a.state \r\n" +
" when 0 then ' Cancel the meeting '\r\n" +
" when 1 then ' newly build '\r\n" +
" when 2 then ' To audit '\r\n" +
" when 3 then ' rejected '\r\n" +
" when 4 then ' To be opened '\r\n" +
" when 5 then ' Have in hand '\r\n" +
" when 6 then ' Start voting '\r\n" +
" when 7 then ' Close the meeting '\r\n" +
" else ' other ' end\r\n" +
") meetingstate,\r\n" +
"a.seatPic,a.remark,a.auditor,\r\n" +
"c.name auditorname 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 and 1=1";
}
// My meeting
public List<Map<String, Object>> myInfos(MeetingInfo info, PageBean pageBean)
throws SQLException, InstantiationException, IllegalAccessException {
String sql = getSQL();
// 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);
}
}
test MeetingInfoDaoTest
package com.zking.dao;
import static org.junit.Assert.*;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import com.zking.entity.MeetingInfo;
import com.zking.util.PageBean;
public class MeetingInfoDaoTest {
private MeetingInfoDao mid = new MeetingInfoDao();
@Test
public void testMyInfos() {
MeetingInfo info = new MeetingInfo();
PageBean pageBean = new PageBean();
//fail("Not yet implemented");
try {
List<Map<String, Object>> myInfos = mid.myInfos(info, pageBean);
for (Map<String, Object> map : myInfos) {
System.out.println(map);
}
System.out.println(pageBean);
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
function :

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 infoDao = new MeetingInfoDao();
@Override
public MeetingInfo getModel() {
ConvertUtils.register(new MyDateConverter(), Date.class);
return info;
}
// New users
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
//rs It affects the number of rows
int rs = infoDao.add(info);
if(rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " Conference information added successfully "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
} 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 = infoDao.myInfos(info, pageBean);
// Be careful :layui Format of data table in
ResponseUtil.writeJson(resp, R.ok(0, " My meeting data query succeeded ",pageBean.getTotal(),lst));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " My meeting data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
}
3、 ... and 、 My conference front
To build a myMeeting.jsp, The project directory is as follows

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>
Write the corresponding interface js Code , Directory structure

myMeeting.js
let layer,$,table;
var row;
layui.use(['jquery', 'layer', 'table'], function(){
layer = layui.layer
,$ = layui.jquery
,table = layui.table;
// Initialize the data 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: 120},
{field: 'meetingState', title: ' Meeting status ', width: 140},
{field: 'seatPic', title: ' Meeting row ', width: 120 ,templet: function(d){
if(d.seatPic==null || d.seatPic=="")
return " Not yet seated ";
else
return "<img width='120px' src='"+d.seatPic+"'/>";
}},
{field: 'auditorName', 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
}
});
}
function :
display picture ①
According to the image path of the database Create a folder uploads, Put the corresponding pictures inside

display picture ②
stay conf Write a configuration file under the folder of resource.properties
dirPath=E:/T280/images/
serverPath=/test_layui/upload/paizuo/
dirPathSign=E:/T280/images/layui/
serverPathSign=/test_layui/upload/sign/double-click

Click the position where the red circle is drawn Complete the configuration

Delete ( Cancel ) meeting
Modify the field to status The effect can be achieved
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>{
// Conference information added
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"});
}
// General meeting query SQL sentence , Include meeting information table data , Host name 、 Name of approver 、 Meeting status
private String getSQL() {
return "SELECT a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren,b.`name`,a.location\r\n" +
",DATE_FORMAT(a.startTime,'%Y-%m-%d %H:%i:%s') as startTime\r\n" +
",DATE_FORMAT(a.endTime,'%Y-%m-%d %H:%i:%s') as endTime\r\n" +
",a.state\r\n" +
",(case a.state\r\n" +
"when 0 then ' Cancel the meeting '\r\n" +
"when 1 then ' newly build '\r\n" +
"when 2 then ' To audit '\r\n" +
"when 3 then ' rejected '\r\n" +
"when 4 then ' To be opened '\r\n" +
"when 5 then ' Have in hand '\r\n" +
"when 6 then ' Start voting '\r\n" +
"else ' At the end of the meeting ' end\r\n" +
") as meetingState\r\n" +
",a.seatPic,a.remark,a.auditor,c.`name` as auditorName\r\n" +
"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 ";
}
// My meeting
public List<Map<String, Object>> myInfos(MeetingInfo info, PageBean pageBean) throws Exception {
String sql = getSQL();
String title = info.getTitle();
if(StringUtils.isNotBlank(title)) {
sql += " and title like '%"+title+"%'";
}
// According to the current login user ID As a condition of the host field
sql+=" and zhuchiren="+info.getZhuchiren();
//System.out.println(sql);
return super.executeQuery(sql, pageBean);
}
// 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
public int updatezt(MeetingInfo m) throws Exception {
String sql = "update t_oa_meeting_info set state=? where id = ?";
return super.executeUpdate(sql, m, new String[] {"state","id"});
}
}
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.BaseDao;
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 infoDao = new MeetingInfoDao();
@Override
public MeetingInfo getModel() {
ConvertUtils.register(new MyDateConverter(), Date.class);
return info;
}
// New users
public String add(HttpServletRequest req, HttpServletResponse resp) {
try {
//rs It affects the number of rows
int rs = infoDao.add(info);
if(rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " Conference information added successfully "));
}
else {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Failed to add meeting information "));
} 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 = infoDao.myInfos(info, pageBean);
// Be careful :layui Format of data table in
ResponseUtil.writeJson(resp, R.ok(0, " My meeting data query succeeded ",pageBean.getTotal(),lst));
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " My meeting data query failed "));
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
return null;
}
// My meeting : Delete ( Cancel the meeting )
public String updatezt(HttpServletRequest req, HttpServletResponse resp) {
try {
int rs = infoDao.updatezt(info);
if (rs > 0) {
ResponseUtil.writeJson(resp, R.ok(200, " The meeting was cancelled successfully "));
} else {
ResponseUtil.writeJson(resp, R.error(0, " Meeting cancellation failed "));
}
} catch (Exception e) {
e.printStackTrace();
try {
ResponseUtil.writeJson(resp, R.error(0, " Meeting cancellation failed "));
} catch (Exception e1) {
e1.printStackTrace();
}
}
return null;
}
}
myMeeting.js
let layer,table,$,form;
let row;
layui.use(['layer','table','jquery','form'],function(){
layer=layui.layer,
table=layui.table,
form=layui.form,
$=layui.jquery;
initTable();
// Query events
$('#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 )
height: 400, // Custom height
loading: false, // Whether to load the bar ( Default true)
cols: [[ // Set the header
{field: 'id', title: ' Conference number ', width: 90},
{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: 120},
{field: 'meetingState', title: ' Meeting status ', width: 120},
{field: 'seatPic', title: ' Meeting row ', width: 120,
templet: function(d){
if(d.seatPic==null || d.seatPic=="")
return " Not yet seated ";
else
return "<img width='120px' src='"+d.seatPic+"'/>";
}
},
{field: 'auditName', title: ' Approved by ', width: 120},
{field: '', title: ' operation ', width: 200,toolbar:'#tbar'},
]]
});
}
//2. Click to query
function query(){
table.reload('tb', {
url: $("#ctx").val()+'/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',
'zhuchiren':$('#zhuchiren').val(),
'title':$('#title').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
},
done: function (res, curr, count) {
console.log(res);
}
});
// Toolbar events
table.on('tool(tb)', function(obj){ // notes :tool Is the toolbar event name ,test yes table Properties of the original container lay-filter=" Corresponding value "
row = obj.data; // Get current row data
var layEvent = obj.event; // get lay-event Corresponding value ( It can also be in the header event The corresponding value of the parameter )
var tr = obj.tr; // Get the current line tr Of DOM object ( If any )
console.log(row);
if(layEvent === 'seat'){ // Meeting row
} else if(layEvent === 'send'){ // submit for censorship
} else if(layEvent==="back"){ // Feedback details
} else {// Delete
layer.confirm(' Are you sure you want to delete ?', {icon: 3, title:' Tips '}, function(index){
$.post($("#ctx").val()+'/info.action',{
'methodName':'updatezt',
'state':0,
'id':row.id
},function(rs){
if(rs.success){
// Call the query method to refresh the data
query();
}else{
layer.msg(rs.msg,function(){});
}
},'json');
layer.close(index);
});
}
});
}
function :

Be careful : Pictures in this record The local has been deleted, so it is not displayed Conference number is 6
Click delete

Click ok

边栏推荐
- What are the contents of Oracle OCP and MySQL OCP certification exams?
- Flutter distribution
- [freeswitch development practice] user defined module creation and use
- General file upload vulnerability getshell of a digital campus system (penetration test -0day)
- 基于C语言实现的人机交互软件
- Oracle 19C OCP 1z0-083 question bank (7-12)
- Number of briquettes & Birthday Candles & building blocks
- KV database based on raft consensus protocol
- The data read by Flink Oracle CDC is always null. Do you know
- [untitled]
猜你喜欢

QT uses QSS to make a beautiful login interface (hand-in-hand teaching)

Cadence (x) wiring skills and precautions

【加密周报】加密市场有所回温?寒冬仍未解冻 盘点上周加密市场发生的重大事件

Nodejs2day(nodejs的模块化,npm下载包,模块加载机制)

【FreeSwitch开发实践】使用SIP客户端Yate连接FreeSwitch进行VoIP通话

基于C语言的内存管理-动态分区分配方式模拟

Deploy prometheus+grafana monitoring platform

OA项目之我的会议(会议排座&送审)

Super potential public chain dfinity -- the best time for DFI developers to enter

23.6 23.7 web environment web environment variable reading
随机推荐
12306 ticket system crawling - 1. Saving and reading of city code data
03异常处理,状态保持,请求钩子---04大型项目结构与蓝图
CIS 2020 - alternative skills against cloud WAF (pyn3rd)
基于C语言实现的人机交互软件
sklearn 机器学习基础(线性回归、欠拟合、过拟合、岭回归、模型加载保存)
In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience
Run file command
[untitled]
[abstract base class inheritance, DOM, event - learning summary]
Nodejs2day (modularization of nodejs, NPM download package, module loading mechanism)
2022年收益率最高的理财产品是哪个?
Flitter imitates wechat long press pop-up copy recall paste collection and other custom customization
Write common API tools swagger and redoc
Mycat2 deploy master-slave MariaDB
The full name of flitter IDFA is identity for advertisers, that is, advertising identifiers. It is used to mark users. At present, it is most widely used for advertising, personalized recommendation,
请问flink sql client 在sink表,有什么办法增大写出速率吗。通过sink表的同步时
IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
OA项目之我的会议(查询)
pl/sql之集合
The data read by Flink Oracle CDC is always null. Do you know