一、小程序首页动态加载数据
数据库准备
首先要准备数据库以及数据
在本机数据库创建oapro数据库,然后导入运行数据库文件
/*
Navicat Premium Data Transfer
Source Server : mysql273
Source Server Type : MySQL
Source Server Version : 50723
Source Host : localhost:3306
Source Schema : oapro
Target Server Type : MySQL
Target Server Version : 50723
File Encoding : 65001
Date: 02/09/2022 16:46:06
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_oa_data_dict
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_data_dict`;
CREATE TABLE `t_oa_data_dict` (
`id` bigint(20) NOT NULL,
`datasource` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`description` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_data_dict
-- ----------------------------
INSERT INTO `t_oa_data_dict` VALUES (1, 'sys_user_role', '用户角色');
INSERT INTO `t_oa_data_dict` VALUES (2, 'sys_permission_type', '权限类别');
INSERT INTO `t_oa_data_dict` VALUES (3, 'meeting_info_state', '会议状态');
INSERT INTO `t_oa_data_dict` VALUES (4, 'meeting_person_type', '会议人员类别');
INSERT INTO `t_oa_data_dict` VALUES (5, 'meeting_person_result', '会议反馈结果');
INSERT INTO `t_oa_data_dict` VALUES (6, 'meeting_equipment_type', '会议设备类别');
-- ----------------------------
-- Table structure for t_oa_data_item
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_data_item`;
CREATE TABLE `t_oa_data_item` (
`id` bigint(11) NOT NULL,
`datasource` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据源标识',
`code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '据库数存储的值',
`val` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '该值对应的文本内容'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_data_item
-- ----------------------------
INSERT INTO `t_oa_data_item` VALUES (1, 'sys_user_role', '1', '管理员');
INSERT INTO `t_oa_data_item` VALUES (2, 'sys_user_role', '2', '发起者');
INSERT INTO `t_oa_data_item` VALUES (3, 'sys_user_role', '3', '审批者');
INSERT INTO `t_oa_data_item` VALUES (4, 'sys_user_role', '4', '参与者');
INSERT INTO `t_oa_data_item` VALUES (5, 'sys_user_role', '5', '会议室管理员');
INSERT INTO `t_oa_data_item` VALUES (6, 'sys_permission_type', '1', '菜单');
INSERT INTO `t_oa_data_item` VALUES (7, 'sys_permission_type', '2', '按钮');
INSERT INTO `t_oa_data_item` VALUES (8, 'meeting_info_state', '1', '待审核');
INSERT INTO `t_oa_data_item` VALUES (9, 'meeting_info_state', '2', '驳回');
INSERT INTO `t_oa_data_item` VALUES (10, 'meeting_info_state', '3', '待开');
INSERT INTO `t_oa_data_item` VALUES (11, 'meeting_info_state', '4', '进行中');
INSERT INTO `t_oa_data_item` VALUES (12, 'meeting_info_state', '5', '开启投票');
INSERT INTO `t_oa_data_item` VALUES (13, 'meeting_info_state', '6', '结束会议');
INSERT INTO `t_oa_data_item` VALUES (14, 'meeting_info_state', '0', '取消会议');
INSERT INTO `t_oa_data_item` VALUES (15, 'meeting_person_type', '1', '参会');
INSERT INTO `t_oa_data_item` VALUES (16, 'meeting_person_type', '2', '列席');
INSERT INTO `t_oa_data_item` VALUES (17, 'meeting_person_result', '1', '参加');
INSERT INTO `t_oa_data_item` VALUES (18, 'meeting_person_result', '0', '不参加');
INSERT INTO `t_oa_data_item` VALUES (19, 'meeting_equipment_type', '1', '投影仪');
INSERT INTO `t_oa_data_item` VALUES (20, 'meeting_equipment_type', '2', '麦克风');
INSERT INTO `t_oa_data_item` VALUES (21, 'meeting_equipment_type', '3', '电子版书屏');
INSERT INTO `t_oa_data_item` VALUES (22, 'meeting_equipment_type', '4', '主持台');
INSERT INTO `t_oa_data_item` VALUES (23, 'meeting_equipment_type', '5', '音响');
-- ----------------------------
-- Table structure for t_oa_meeting_feedback
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_feedback`;
CREATE TABLE `t_oa_meeting_feedback` (
`id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`meetingId` bigint(11) NULL DEFAULT NULL COMMENT '外键:会议表主键\r\n',
`personType` int(2) NULL DEFAULT NULL COMMENT '人员类别:1参会2列席\r\n',
`personId` bigint(11) NULL DEFAULT NULL COMMENT '人员ID\r\n',
`result` int(2) NULL DEFAULT NULL COMMENT '反馈结果:1参加0不参加\r\n',
`reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '不参加的原因\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议通知反馈表\r\n' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_info
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_info`;
CREATE TABLE `t_oa_meeting_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议标题\r\n',
`content` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议内容\r\n',
`canyuze` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参会人员\r\n',
`liexize` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '列席人员\r\n',
`zhuchiren` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主持人\r\n',
`location` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议地点\r\n',
`startTime` datetime(0) NULL DEFAULT NULL COMMENT '开始时间\r\n',
`endTime` datetime(0) NULL DEFAULT NULL COMMENT '结束时间\r\n',
`fujian` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议附件\r\n',
`state` int(11) NULL DEFAULT NULL COMMENT '状态:0取消会议1待审核2驳回3待开4进行中5开启投票6结束会议,默认值为1\r\n',
`auditPerson` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核人\r\n',
`auditTime` datetime(0) NULL DEFAULT NULL COMMENT '审核时间\r\n',
`seatPic` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议排座图片地址\r\n',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_meeting_info
-- ----------------------------
INSERT INTO `t_oa_meeting_info` VALUES (1, '关于张三的人事任命', '张三工作期间表现优秀,经集团公司领导研究,最终一致同意,张三升为就业组长', '2,3,4,5,6,7,8,9,10,11', '23,24', '1', '会议室1', '2022-03-13 00:00:00', NULL, NULL, 1, '1', NULL, NULL, '/upload/qianzi/0e12bf4d-2a37-43d7-a283-9805687eb596.jpg');
INSERT INTO `t_oa_meeting_info` VALUES (2, '关于李四的开除通告', '李四工作期间无故旷工、办公室传递负能量消息,经公司商议,给予开除决定', '11,12,13,14,15,16,17', '23,24', '1', '会议室1', '2022-03-13 00:00:00', NULL, NULL, 1, '1', NULL, NULL, '');
INSERT INTO `t_oa_meeting_info` VALUES (15, '11', '11', '1', '3,2', '1', '会议室2', '2022-03-13 00:00:00', NULL, NULL, 1, NULL, NULL, NULL, NULL);
INSERT INTO `t_oa_meeting_info` VALUES (16, '22', '22', '1', '2,3', '1', '会议室122', '2022-03-13 00:00:00', NULL, NULL, 1, '1', NULL, '/uploads/ef512ab350814002b4330efe81ccbba2.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (17, '11', '22', '1', '3,4', '1', '会议室111', '2022-03-13 10:00:00', NULL, NULL, 2, NULL, NULL, '/uploads/06db5bd3b6674b599f7ade2276c03ab7.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (18, '11', '22', '1', '3,4', '1', '会议室111', '2022-03-13 11:00:00', NULL, NULL, 1, NULL, NULL, '/uploads/5b91797446a74da19cad0b921ac79ea5.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (19, '22', '22', '1', '2,3', '2', '会议室122', '2022-03-13 12:00:00', NULL, NULL, 2, NULL, NULL, '/uploads/851bda19dfaf494f9abaebe5b691e9ad.png', NULL);
INSERT INTO `t_oa_meeting_info` VALUES (20, 'ee', 'ee', '1,2', '3,4,5', '2', '会议室1111', '2022-03-15 09:00:00', '2022-03-15 11:00:00', NULL, 2, '1', NULL, '/uploads/abab715507314fbd8a9dd42e38e6693c.png', '/uploads/e403fa90455747c399b66054ee06b70e.png');
-- ----------------------------
-- Table structure for t_oa_meeting_option
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_option`;
CREATE TABLE `t_oa_meeting_option` (
`id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`meetingId` bigint(11) NULL DEFAULT NULL COMMENT '会议ID\r\n',
`optionValue` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项标识(A/B/C/D)\r\n',
`optionText` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项描述\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议投票标题选项表\r\n' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_room
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_room`;
CREATE TABLE `t_oa_meeting_room` (
`id` int(11) NOT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议室名称\r\n',
`equipment` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会议设备\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议室信息\r\n' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_vote
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_vote`;
CREATE TABLE `t_oa_meeting_vote` (
`id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`optionId` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '选项ID(投票标题选项表的主键)\r\n',
`personId` bigint(11) NULL DEFAULT NULL COMMENT '投票人员ID\r\n',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会议投票记录表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_permission`;
CREATE TABLE `t_oa_permission` (
`id` bigint(20) NOT NULL DEFAULT 0 COMMENT '权限id',
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名字',
`description` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限描述',
`url` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单路径',
`pid` bigint(20) NULL DEFAULT NULL COMMENT '父权限',
`ismenu` int(11) NULL DEFAULT 1 COMMENT '是否为菜单 1、菜单 2、按钮',
`displayno` bigint(20) NULL DEFAULT 0 COMMENT '展现顺序',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_permission
-- ----------------------------
INSERT INTO `t_oa_permission` VALUES (1, '系统管理', '系统管理', NULL, -1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (2, '用户管理', '用户管理', 'admin/user/user_list.jsp', 1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (3, '数据字典', '数据字典', 'admin/dict/dict_list.jsp', 1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (4, '会议管理', '会议管理', NULL, -1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (5, '发布会议', '发布会议', 'admin/meeting/meeting_add.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (6, '我的会议', '我的会议', 'admin/meeting/myMeeting.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (7, '我的审批', '我的审批', 'admin/meeting/myAudit.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (8, '代开会议', '代开会议', 'admin/meeting/meeting_info_list.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (10, '所有会议', '所有会议', 'admin/meeting/meeting_info_list.jsp', 4, 1, 0);
INSERT INTO `t_oa_permission` VALUES (11, '会议室管理', '会议室管理', 'admin/meeting/meeting_info_list.jsp', -1, 1, 0);
INSERT INTO `t_oa_permission` VALUES (12, '历史会议', '历史会议', '/bg/listOrder4.jsp', 4, 1, 0);
-- ----------------------------
-- Table structure for t_oa_role
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_role`;
CREATE TABLE `t_oa_role` (
`id` int(11) NOT NULL,
`name` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_role
-- ----------------------------
INSERT INTO `t_oa_role` VALUES (1, '管理员');
INSERT INTO `t_oa_role` VALUES (2, '普通用户');
-- ----------------------------
-- Table structure for t_oa_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_role_permission`;
CREATE TABLE `t_oa_role_permission` (
`rid` bigint(20) NULL DEFAULT NULL,
`pid` bigint(20) NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_role_permission
-- ----------------------------
INSERT INTO `t_oa_role_permission` VALUES (1, 0);
INSERT INTO `t_oa_role_permission` VALUES (1, 1);
INSERT INTO `t_oa_role_permission` VALUES (1, 2);
INSERT INTO `t_oa_role_permission` VALUES (1, 3);
INSERT INTO `t_oa_role_permission` VALUES (1, 4);
INSERT INTO `t_oa_role_permission` VALUES (1, 5);
INSERT INTO `t_oa_role_permission` VALUES (1, 6);
INSERT INTO `t_oa_role_permission` VALUES (1, 7);
INSERT INTO `t_oa_role_permission` VALUES (1, 8);
INSERT INTO `t_oa_role_permission` VALUES (1, 9);
INSERT INTO `t_oa_role_permission` VALUES (2, 10);
INSERT INTO `t_oa_role_permission` VALUES (2, 11);
INSERT INTO `t_oa_role_permission` VALUES (2, 12);
INSERT INTO `t_oa_role_permission` VALUES (2, 13);
INSERT INTO `t_oa_role_permission` VALUES (1, 14);
-- ----------------------------
-- Table structure for t_oa_user
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_user`;
CREATE TABLE `t_oa_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名: 唯一键 登陆时使用 禁止修改',
`pwd` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户密码:长度6~10位,MD5加密',
`rid` bigint(20) NULL DEFAULT 2 COMMENT '用户角色:1 管理员 2 发起者 3 审批者 4 参与者 5 会议室管理员',
`loginName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录名',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 65 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_user
-- ----------------------------
INSERT INTO `t_oa_user` VALUES (1, '唐某', '123', 1, 'admin');
INSERT INTO `t_oa_user` VALUES (2, '陈某', '123', 2, 'cheng');
INSERT INTO `t_oa_user` VALUES (3, '胡某', '123', 2, 'hu');
INSERT INTO `t_oa_user` VALUES (4, '王某', '123', 2, 'wang');
INSERT INTO `t_oa_user` VALUES (5, '潘某', '123', 2, 'pang');
INSERT INTO `t_oa_user` VALUES (6, '李某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (7, '易某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (8, '刘某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (9, '裴某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (10, '行政部经理王某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (11, '后勤部主管刘某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (12, '林科大内务校长文某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (13, '林科大教学部经理唐某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (14, '林科大教质部主管洪某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (15, '民族项目市场部经理李某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (16, '民族项目教质部经理熊樱', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (17, '民族项目教学部经理李某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (18, '卓景京项目市场部经理夏某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (19, '卓景京项目内务校长赵某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (20, '卓景京项目教质部主管周某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (21, '电子科技校区市场部经理姚某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (22, '电子科技校区内务校长田某', '123', 2, '');
INSERT INTO `t_oa_user` VALUES (23, '张三', '123', 2, 'zhangsan');
INSERT INTO `t_oa_user` VALUES (24, '李四', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (25, 'aa', '11', 1, 'aa');
INSERT INTO `t_oa_user` VALUES (26, 'aa', '11', 1, '11');
INSERT INTO `t_oa_user` VALUES (27, 'aa', '1', 1, 'bb');
INSERT INTO `t_oa_user` VALUES (28, 'cc', '1', 1, 'cc');
INSERT INTO `t_oa_user` VALUES (29, 'vv', '1', 1, 'vv');
INSERT INTO `t_oa_user` VALUES (30, 'dd', '1', 1, 'dd');
INSERT INTO `t_oa_user` VALUES (35, 'aa', '11', 1, 'aa');
INSERT INTO `t_oa_user` VALUES (36, 'bb', 'bb', 2, 'bb');
INSERT INTO `t_oa_user` VALUES (37, 'cc', 'cc', 2, 'cc');
INSERT INTO `t_oa_user` VALUES (38, 'dd', 'dd', 1, 'dd');
INSERT INTO `t_oa_user` VALUES (39, 'ee', 'ee', 2, 'ee');
INSERT INTO `t_oa_user` VALUES (40, 'vv', 'vv', 2, 'vv');
INSERT INTO `t_oa_user` VALUES (41, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (42, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (43, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (44, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (45, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (46, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (47, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (48, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (49, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (50, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (51, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (52, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (53, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (54, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (55, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (56, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (57, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (58, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (59, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (60, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (61, 'a1', '123', 2, 'lisi');
INSERT INTO `t_oa_user` VALUES (62, '文博', '123', NULL, 'wenbo');
INSERT INTO `t_oa_user` VALUES (63, 'cc', '123', NULL, 'cc');
INSERT INTO `t_oa_user` VALUES (64, 'vv', '123', 1, 'vv');
-- ----------------------------
-- Table structure for wx_user
-- ----------------------------
DROP TABLE IF EXISTS `wx_user`;
CREATE TABLE `wx_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名称',
`password` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户密码',
`gender` tinyint(3) NOT NULL DEFAULT 0 COMMENT '性别:0 未知, 1男, 1 女',
`birthday` date NULL DEFAULT NULL COMMENT '生日',
`last_login_time` datetime(0) NULL DEFAULT NULL COMMENT '最近一次登录时间',
`last_login_ip` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最近一次登录IP地址',
`user_level` tinyint(3) NULL DEFAULT 0 COMMENT '用户层级 0 普通用户,1 VIP用户,2 区域代理用户',
`nickname` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户昵称或网络名称',
`mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户手机号码',
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户头像图片',
`weixin_openid` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '微信登录openid',
`status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0 可用, 1 禁用, 2 注销',
`add_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '逻辑删除',
`share_user_id` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_name`(`username`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = Compact;
-- ----------------------------
-- Records of wx_user
-- ----------------------------
INSERT INTO `wx_user` VALUES (1, 'of_zY6RGwMfbacRbEngFD4dZMoJ4', 'of_zY6RGwMfbacRbEngFD4dZMoJ4', 0, NULL, '2022-09-02 11:29:55', '0:0:0:0:0:0:0:1', 1, 'donkee', '18008497070', 'https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eoQicXQBHibRUP4Ix1x5U1FZOcKgYbRrl8UiaaOMTA5J6Lmr0An4ffnAYrqOIPhz6945wNsExOnianAdg/132', 'of_zY6RGwMfbacRbEngFD4dZMoJ4', 0, NULL, NULL, 0, 1);
INSERT INTO `wx_user` VALUES (2, 'of_zY6UTYaWS7tTOfo9XJ9VyiOcc', 'of_zY6UTYaWS7tTOfo9XJ9VyiOcc', 0, NULL, '2022-08-30 21:28:37', '0:0:0:0:0:0:0:1', 2, '测试号🐷', '12066600001', 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJhF2keTvcWiaRPXYTrIkpxYhdRQaLLnQp6AJJUFcCDYNLXe3iaywwJbGIeOrD3LKZE7x6zdOl6Lchg/132', 'of_zY6UTYaWS7tTOfo9XJ9VyiOcc', 0, NULL, NULL, 0, 1);
SET FOREIGN_KEY_CHECKS = 1;
后台环境搭建
利用ider创建一个Spring Boot项目
创建好项目之后,开始导入pom依赖
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xlb</groupId>
<artifactId>minoa</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>minoa</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<fastjson.version>1.2.70</fastjson.version>
<jackson.version>2.9.8</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<dependencies>
<!--使用Mybatis-generator插件不能使用太高版本的mysql驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</build>
</project>
这边注意,应该先导入properties,然后导入dependencies,最后导入build
然后配置数据源
spring:
datasource:
#type连接池类型 DBCP,C3P0,Hikari,Druid,默认为Hikari
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/oapro?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: 123
整合mybatis
mybatis:
mapper-locations: classpath*:mapper/*.xml #指定mapper文件位置
type-aliases-package: com.xlb.minoa.model #指定自动生成别名所在包
修改启动类MinoaApplication
package com.xlb.minoa;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@MapperScan("com.xlb.minoa.mapper")
@SpringBootApplication
public class MinoaApplication {
public static void main(String[] args) {
SpringApplication.run(MinoaApplication.class, args);
}
}
然后需要把缺少的文件补上
generatorConfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration>
<!-- 引入配置文件 -->
<properties resource="jdbc.properties"/>
<!--指定数据库jdbc驱动jar包的位置-->
<classPathEntry location="D:\SoftwareInstallPath\repository\mvn_repository\mysql\mysql-connector-java\5.1.44\mysql-connector-java-5.1.44.jar"/>
<!-- 一个数据库一个context -->
<context id="infoGuardian">
<!-- 注释 -->
<commentGenerator>
<property name="suppressAllComments" value="true"/><!-- 是否取消注释 -->
<property name="suppressDate" value="true"/> <!-- 是否生成注释代时间戳 -->
</commentGenerator>
<!-- jdbc连接 -->
<jdbcConnection driverClass="${jdbc.driver}"
connectionURL="${jdbc.url}" userId="${jdbc.username}" password="${jdbc.password}"/>
<!-- 类型转换 -->
<javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 01 指定javaBean生成的位置 -->
<!-- targetPackage:指定生成的model生成所在的包名 -->
<!-- targetProject:指定在该项目下所在的路径 -->
<javaModelGenerator targetPackage="com.xlb.minoa.model"
targetProject="src/main/java">
<!-- 是否允许子包,即targetPackage.schemaName.tableName -->
<property name="enableSubPackages" value="false"/>
<!-- 是否对model添加构造函数 -->
<property name="constructorBased" value="true"/>
<!-- 是否针对string类型的字段在set的时候进行trim调用 -->
<property name="trimStrings" value="false"/>
<!-- 建立的Model对象是否 不可改变 即生成的Model对象不会有 setter方法,只有构造方法 -->
<property name="immutable" value="false"/>
</javaModelGenerator>
<!-- 02 指定sql映射文件生成的位置 om.xlb.minoa.-->
<sqlMapGenerator targetPackage="mapper"
targetProject="src/main/resources">
<!-- 是否允许子包,即targetPackage.schemaName.tableName -->
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- 03 生成XxxMapper接口 -->
<!-- type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象 -->
<!-- type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 -->
<!-- type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator targetPackage="com.xlb.minoa.mapper"
targetProject="src/main/java" type="XMLMAPPER">
<!-- 是否在当前路径下新加一层schema,false路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!-- 配置表信息 -->
<!-- schema即为数据库名 -->
<!-- tableName为对应的数据库表 -->
<!-- domainObjectName是要生成的实体类 -->
<!-- enable*ByExample是否生成 example类 -->
<!--<table schema="" tableName="t_book" domainObjectName="Book"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
<!– 忽略列,不生成bean 字段 –>
<!– <ignoreColumn column="FRED" /> –>
<!– 指定列的java数据类型 –>
<!– <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" /> –>
</table>-->
<table schema="" tableName="t_oa_data_dict" domainObjectName="Dict"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_data_item" domainObjectName="Item"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_meeting_feedback" domainObjectName="Feedback"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_meeting_info" domainObjectName="Info"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_meeting_option" domainObjectName="Option"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_meeting_room" domainObjectName="Room"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_meeting_vote" domainObjectName="Vote"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_permission" domainObjectName="Permission"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_role" domainObjectName="Role"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_role_permission" domainObjectName="RolePermission"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
<table schema="" tableName="t_oa_user" domainObjectName="User"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
</table>
</context>
</generatorConfiguration>
jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/oapro?useUnicode=true&characterEncoding=UTF-8
jdbc.username=root
jdbc.password=123
jdbc.initialSize=10
jdbc.maxTotal=100
jdbc.maxIdle=50
jdbc.minIdle=10
jdbc.maxWaitMillis=-1
因为需要跨域,所以添加跨域需要的文件
文件后期博主会分享资源
这样后台就搭建好了
实现小程序数据交互
首先把假数据清空
然后修改本机开发API地
// 以下是业务服务器API地址
// 本机开发API地址
var WxApiRoot = 'http://localhost:8080/wx/';
// 测试环境部署api地址
// var WxApiRoot = 'http://192.168.0.101:8070/demo/wx/';
// 线上平台api地址
//var WxApiRoot = 'https://www.oa-mini.com/demo/wx/';
module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口
SwiperImgs: WxApiRoot+'swiperImgs', //轮播图
MettingInfos: WxApiRoot+'meeting/list', //会议信息
};
然后在utils.js中封装微信的request请求
module.exports = {
formatTime,request
}
/**
* 封装微信的request请求
* $.post(url,)
*/
function request(url, data = {}, method = "GET") {
return new Promise(function (resolve, reject) {
wx.request({
url: url,
data: data,
method: method,
header: {
'Content-Type': 'application/json',
},
success: function (res) {
if (res.statusCode == 200) {
resolve(res.data);//会把进行中改变成已成功
} else {
reject(res.errMsg);//会把进行中改变成已失败
}
},
fail: function (err) {
reject(err)
}
})
});
}
然后在到首页.js中引用
# 导入
const util = require("../../utils/util")
# 方法
loadMeetingInfos(){
util.request(api.IndexUrl).then(res=>{
this.setData({
lists:res.data.infoList
})
}).catch(res=>{
console.log('服器没有开启,使用模拟数据!')
})
}
还要注意要把Mock关闭
还有要把验证关闭
最后结果
二、通过wxs将首页动态数据优化
可以完全参考官方文档
首先在utils中创建一个wxs文件,里面定义规则以及运用
function getState (state){
// 状态:0取消会议1待审核2驳回3待开4进行中5开启投票6结束会议,默认值为1
if(state == 0 ){
return '取消会议';
}else if(state == 1 ){
return '待审核';
}else if(state == 2 ){
return '驳回';
}else if(state == 3 ){
return '待开';
}else if(state == 4 ){
return '进行中';
}else if(state == 5 ){
return '开启投票';
}else if(state == 6 ){
return '结束会议';
}
return '其它';
}
var getNumber = function(str) {
var s = str+'';
var array = s.split(',');
var len = array.length;
return len;
}
function formatDate(ts, option) {
var date = getDate(ts)
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var week = date.getDay()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
//获取 年月日
if (option == 'YY-MM-DD') return [year, month, day].map(formatNumber).join('-')
//获取 年月
if (option == 'YY-MM') return [year, month].map(formatNumber).join('-')
//获取 年
if (option == 'YY') return [year].map(formatNumber).toString()
//获取 月
if (option == 'MM') return [mont].map(formatNumber).toString()
//获取 日
if (option == 'DD') return [day].map(formatNumber).toString()
//获取 年月日 周一 至 周日
if (option == 'YY-MM-DD Week') return [year, month, day].map(formatNumber).join('-') + ' ' + getWeek(week)
//获取 月日 周一 至 周日
if (option == 'MM-DD Week') return [month, day].map(formatNumber).join('-') + ' ' + getWeek(week)
//获取 周一 至 周日
if (option == 'Week') return getWeek(week)
//获取 时分秒
if (option == 'hh-mm-ss') return [hour, minute, second].map(formatNumber).join(':')
//获取 时分
if (option == 'hh-mm') return [hour, minute].map(formatNumber).join(':')
//获取 分秒
if (option == 'mm-dd') return [minute, second].map(formatNumber).join(':')
//获取 时
if (option == 'hh') return [hour].map(formatNumber).toString()
//获取 分
if (option == 'mm') return [minute].map(formatNumber).toString()
//获取 秒
if (option == 'ss') return [second].map(formatNumber).toString()
//默认 时分秒 年月日
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
function formatNumber(n) {
n = n.toString()
return n[1] ? n : '0' + n
}
function getWeek(n) {
switch(n) {
case 1:
return '星期一'
case 2:
return '星期二'
case 3:
return '星期三'
case 4:
return '星期四'
case 5:
return '星期五'
case 6:
return '星期六'
case 7:
return '星期日'
}
}
module.exports = {
getState: getState,
getNumber: getNumber,
formatDate:formatDate
};
随后在首页的wxml文件中引用
<!--pages/index/index.wxml-->
<!-- <text>pages/index/index.wxml</text> -->
<wxs src="/utils/page.wxs" module="tools" />
<view>
<swiper autoplay="true" indicator-dots="true" indicator-color="#fff" indicator-active-color="#00f">
<block wx:for="{{imgSrcs}}" wx:key="text">
<swiper-item>
<view>
<image src="{{item.img}}" class="swiper-item" />
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="mobi-title">
<text class="mobi-icon"></text>
<text>会议信息</text>
</view>
<block wx:for-items="{{lists}}" wx:for-item="item" wx:key="item.id">
<view class="list" data-id="{{item.id}}">
<view class="list-img">
<image class="video-img" mode="scaleToFill" src="{{item.image != null ? item.image : '/static/persons/1.jpg'}}"></image>
</view>
<view class="list-detail">
<view class="list-title"><text>{{item.title}}</text></view>
<view class="list-tag">
<view class="state">{{tools.getState(item.state)}}</view>
<view class="join"><text class="list-num">{{tools.getNumber(item.canyuze)}}</text>人报名</view>
</view>
<view class="list-info"><text>{{item.location}}</text>|<text>{{tools.formatDate(item.starttime)}}</text></view>
</view>
</view>
</block>
<view class="section bottom-line">
<text>到底啦</text>
</view>
效果