当前位置:网站首页>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 :
边栏推荐
- Algorithm -- continuous sequence (kotlin)
- The use of asynchronous thread pool in development
- JS download files, filesaver.js export txt and Excel files
- Parent class reference to child class (parent class reference points to child class object)
- Pytoch learning notes (II) the use of neural networks
- How to write the introduction of GIS method journals and papers?
- Pytorch学习笔记(三)模型的使用、修改、训练(CPU/GPU)及验证
- How to quickly design a set of cross end components that support rendering rich text content
- 大小端模式
- Feixin, which lasted 15 years and had 500million users, was completely dead
猜你喜欢

GDB common commands

Ten thousand words long article, talking about the blueprint of enterprise digital modeling

Explain four interesting NPM usages with charts

Frisbee, 2022 "black red" top stream

Concept and handling of exceptions

循环队列(c语言实现)

PHP uses sqlserver

Docker container MySQL enables binlog and scheduled backup

MySql的DDL和DML和DQL的基本语法

"Intermediate and advanced test questions": what is the implementation principle of mvcc?
随机推荐
循环队列(c语言实现)
Add a display horizontal line between idea methods
Latest battle report: Ten certifications and five best practices
图书下载 | 2022年《终身监督学习导论》Meta AI、CMU等学者合著,171页PDF
【Oauth2】五、OAuth2LoginAuthenticationFilter
聚力打造四个“高地”,携手合作伙伴共铸国云!
The picture moves horizontally with the phone - gyroscope. 360 degree setting conditions
ROS2学习(1)ROS2简述
Comparator (interface between comparable and comparator)
Multithreaded completable future usage
技术分享 | 需要小心配置的 gtid_mode
WPS凭什么拒绝广告?
Digital collections accelerate the breaking of the circle and help the industry find new opportunities
MySql的DDL和DML和DQL的基本语法
The shell script in Jenkins fails to execute but does not exit by itself
Book download | introduction to lifelong supervised learning in 2022, CO authored by meta AI, CMU and other scholars, 171 Pages pdf
gdb常用命令
Solve the problem that JUnit of idea console cannot be input with scanner
Frisbee, 2022 "black red" top stream
Circular queue (implemented in C language)