mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
jeecg-boot 1.0版本发布
This commit is contained in:
9
jeecg-boot/docs/- 项目说明
Normal file
9
jeecg-boot/docs/- 项目说明
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
一、技术文档
|
||||
http://jeecg-boot.mydoc.io
|
||||
|
||||
二、部署文档
|
||||
修改redis、数据库配置文件
|
||||
修改上传文件目录
|
||||
修改登录页面提示账号密码
|
||||
修改前端API的图片访问域名
|
||||
871
jeecg-boot/docs/db/sys-init-20190128.sql
Normal file
871
jeecg-boot/docs/db/sys-init-20190128.sql
Normal file
@ -0,0 +1,871 @@
|
||||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : mysql
|
||||
Source Server Version : 50037
|
||||
Source Host : 127.0.0.1:3306
|
||||
Source Database : jeecg-boot-new
|
||||
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 50037
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 2019-01-28 13:58:17
|
||||
*/
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for demo
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `demo`;
|
||||
CREATE TABLE `demo` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键ID',
|
||||
`name` varchar(30) default NULL COMMENT '姓名',
|
||||
`sex` varchar(2) default NULL,
|
||||
`age` int(11) default NULL COMMENT '年龄',
|
||||
`birthday` date default NULL COMMENT '生日',
|
||||
`email` varchar(50) default NULL COMMENT '邮箱',
|
||||
`content` varchar(1000) default NULL COMMENT '个人简介',
|
||||
`key_word` varchar(255) default NULL,
|
||||
`punch_time` datetime default NULL,
|
||||
`salary_money` decimal(11,2) default NULL,
|
||||
`bonus_money` double(11,0) default NULL,
|
||||
`create_time` datetime default NULL,
|
||||
`create_by` varchar(50) default NULL COMMENT '创建人',
|
||||
`update_by` varchar(50) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新日期',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of demo
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for demo2
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `demo2`;
|
||||
CREATE TABLE `demo2` (
|
||||
`id` int(30) NOT NULL auto_increment COMMENT '主键自增ID',
|
||||
`name` varchar(20) default NULL COMMENT '姓名',
|
||||
`gender` varchar(10) default NULL COMMENT '性别 1为男 0为女',
|
||||
`age` int(10) default NULL COMMENT '年龄',
|
||||
`address` varchar(200) default NULL COMMENT '住址',
|
||||
`job` varchar(40) default NULL COMMENT '职业',
|
||||
`isEmployed` varchar(10) default NULL COMMENT '1为在职,0为待业',
|
||||
`create_time` date default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of demo2
|
||||
-- ----------------------------
|
||||
INSERT INTO `demo2` VALUES ('2', 'Jack', '1', '25', '河北', '工程师', '0', null);
|
||||
INSERT INTO `demo2` VALUES ('3', 'Tom', '1', '26', '广东', '大师', '1', null);
|
||||
INSERT INTO `demo2` VALUES ('4', 'Sandy', '0', '27', '四川', '理发师', '0', null);
|
||||
INSERT INTO `demo2` VALUES ('5', 'Billie', '1', '23', '杭州', '教师', '1', null);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_blob_triggers
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_blob_triggers`;
|
||||
CREATE TABLE `qrtz_blob_triggers` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`TRIGGER_NAME` varchar(200) NOT NULL,
|
||||
`TRIGGER_GROUP` varchar(200) NOT NULL,
|
||||
`BLOB_DATA` blob,
|
||||
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
|
||||
CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_blob_triggers
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_calendars
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_calendars`;
|
||||
CREATE TABLE `qrtz_calendars` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`CALENDAR_NAME` varchar(200) NOT NULL,
|
||||
`CALENDAR` blob NOT NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_calendars
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_cron_triggers
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_cron_triggers`;
|
||||
CREATE TABLE `qrtz_cron_triggers` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`TRIGGER_NAME` varchar(200) NOT NULL,
|
||||
`TRIGGER_GROUP` varchar(200) NOT NULL,
|
||||
`CRON_EXPRESSION` varchar(200) NOT NULL,
|
||||
`TIME_ZONE_ID` varchar(80) default NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
|
||||
CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_cron_triggers
|
||||
-- ----------------------------
|
||||
INSERT INTO `qrtz_cron_triggers` VALUES ('quartzScheduler', 'org.jeecg.modules.quartz.job.SampleJob', 'DEFAULT', '0/1 * * * * ?', 'Asia/Shanghai');
|
||||
INSERT INTO `qrtz_cron_triggers` VALUES ('quartzScheduler', 'org.jeecg.modules.quartz.job.SampleParamJob', 'DEFAULT', '0/1 * * * * ?', 'Asia/Shanghai');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_fired_triggers
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_fired_triggers`;
|
||||
CREATE TABLE `qrtz_fired_triggers` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`ENTRY_ID` varchar(95) NOT NULL,
|
||||
`TRIGGER_NAME` varchar(200) NOT NULL,
|
||||
`TRIGGER_GROUP` varchar(200) NOT NULL,
|
||||
`INSTANCE_NAME` varchar(200) NOT NULL,
|
||||
`FIRED_TIME` bigint(13) NOT NULL,
|
||||
`SCHED_TIME` bigint(13) NOT NULL,
|
||||
`PRIORITY` int(11) NOT NULL,
|
||||
`STATE` varchar(16) NOT NULL,
|
||||
`JOB_NAME` varchar(200) default NULL,
|
||||
`JOB_GROUP` varchar(200) default NULL,
|
||||
`IS_NONCONCURRENT` varchar(1) default NULL,
|
||||
`REQUESTS_RECOVERY` varchar(1) default NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_fired_triggers
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_job_details
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_job_details`;
|
||||
CREATE TABLE `qrtz_job_details` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`JOB_NAME` varchar(200) NOT NULL,
|
||||
`JOB_GROUP` varchar(200) NOT NULL,
|
||||
`DESCRIPTION` varchar(250) default NULL,
|
||||
`JOB_CLASS_NAME` varchar(250) NOT NULL,
|
||||
`IS_DURABLE` varchar(1) NOT NULL,
|
||||
`IS_NONCONCURRENT` varchar(1) NOT NULL,
|
||||
`IS_UPDATE_DATA` varchar(1) NOT NULL,
|
||||
`REQUESTS_RECOVERY` varchar(1) NOT NULL,
|
||||
`JOB_DATA` blob,
|
||||
PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_job_details
|
||||
-- ----------------------------
|
||||
INSERT INTO `qrtz_job_details` VALUES ('quartzScheduler', 'org.jeecg.modules.quartz.job.SampleJob', 'DEFAULT', null, 'org.jeecg.modules.quartz.job.SampleJob', '0', '0', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C77080000001000000001740009706172616D65746572707800);
|
||||
INSERT INTO `qrtz_job_details` VALUES ('quartzScheduler', 'org.jeecg.modules.quartz.job.SampleParamJob', 'DEFAULT', null, 'org.jeecg.modules.quartz.job.SampleParamJob', '0', '0', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C77080000001000000001740009706172616D6574657274000573636F74747800);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_locks
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_locks`;
|
||||
CREATE TABLE `qrtz_locks` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`LOCK_NAME` varchar(40) NOT NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_locks
|
||||
-- ----------------------------
|
||||
INSERT INTO `qrtz_locks` VALUES ('quartzScheduler', 'TRIGGER_ACCESS');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_paused_trigger_grps
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`;
|
||||
CREATE TABLE `qrtz_paused_trigger_grps` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`TRIGGER_GROUP` varchar(200) NOT NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_paused_trigger_grps
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_scheduler_state
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_scheduler_state`;
|
||||
CREATE TABLE `qrtz_scheduler_state` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`INSTANCE_NAME` varchar(200) NOT NULL,
|
||||
`LAST_CHECKIN_TIME` bigint(13) NOT NULL,
|
||||
`CHECKIN_INTERVAL` bigint(13) NOT NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_scheduler_state
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_simple_triggers
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_simple_triggers`;
|
||||
CREATE TABLE `qrtz_simple_triggers` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`TRIGGER_NAME` varchar(200) NOT NULL,
|
||||
`TRIGGER_GROUP` varchar(200) NOT NULL,
|
||||
`REPEAT_COUNT` bigint(7) NOT NULL,
|
||||
`REPEAT_INTERVAL` bigint(12) NOT NULL,
|
||||
`TIMES_TRIGGERED` bigint(10) NOT NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
|
||||
CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_simple_triggers
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_simprop_triggers
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_simprop_triggers`;
|
||||
CREATE TABLE `qrtz_simprop_triggers` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`TRIGGER_NAME` varchar(200) NOT NULL,
|
||||
`TRIGGER_GROUP` varchar(200) NOT NULL,
|
||||
`STR_PROP_1` varchar(512) default NULL,
|
||||
`STR_PROP_2` varchar(512) default NULL,
|
||||
`STR_PROP_3` varchar(512) default NULL,
|
||||
`INT_PROP_1` int(11) default NULL,
|
||||
`INT_PROP_2` int(11) default NULL,
|
||||
`LONG_PROP_1` bigint(20) default NULL,
|
||||
`LONG_PROP_2` bigint(20) default NULL,
|
||||
`DEC_PROP_1` decimal(13,4) default NULL,
|
||||
`DEC_PROP_2` decimal(13,4) default NULL,
|
||||
`BOOL_PROP_1` varchar(1) default NULL,
|
||||
`BOOL_PROP_2` varchar(1) default NULL,
|
||||
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
|
||||
CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_simprop_triggers
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_triggers
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qrtz_triggers`;
|
||||
CREATE TABLE `qrtz_triggers` (
|
||||
`SCHED_NAME` varchar(120) NOT NULL,
|
||||
`TRIGGER_NAME` varchar(200) NOT NULL,
|
||||
`TRIGGER_GROUP` varchar(200) NOT NULL,
|
||||
`JOB_NAME` varchar(200) NOT NULL,
|
||||
`JOB_GROUP` varchar(200) NOT NULL,
|
||||
`DESCRIPTION` varchar(250) default NULL,
|
||||
`NEXT_FIRE_TIME` bigint(13) default NULL,
|
||||
`PREV_FIRE_TIME` bigint(13) default NULL,
|
||||
`PRIORITY` int(11) default NULL,
|
||||
`TRIGGER_STATE` varchar(16) NOT NULL,
|
||||
`TRIGGER_TYPE` varchar(8) NOT NULL,
|
||||
`START_TIME` bigint(13) NOT NULL,
|
||||
`END_TIME` bigint(13) default NULL,
|
||||
`CALENDAR_NAME` varchar(200) default NULL,
|
||||
`MISFIRE_INSTR` smallint(2) default NULL,
|
||||
`JOB_DATA` blob,
|
||||
PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
|
||||
KEY `SCHED_NAME` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
|
||||
CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of qrtz_triggers
|
||||
-- ----------------------------
|
||||
INSERT INTO `qrtz_triggers` VALUES ('quartzScheduler', 'org.jeecg.modules.quartz.job.SampleJob', 'DEFAULT', 'org.jeecg.modules.quartz.job.SampleJob', 'DEFAULT', null, '1548655079000', '1548655078000', '5', 'PAUSED', 'CRON', '1548655070000', '0', null, '0', '');
|
||||
INSERT INTO `qrtz_triggers` VALUES ('quartzScheduler', 'org.jeecg.modules.quartz.job.SampleParamJob', 'DEFAULT', 'org.jeecg.modules.quartz.job.SampleParamJob', 'DEFAULT', null, '1548655081000', '1548655080000', '5', 'PAUSED', 'CRON', '1548655047000', '0', null, '0', '');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_announcement
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_announcement`;
|
||||
CREATE TABLE `sys_announcement` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`titile` varchar(100) default NULL COMMENT '标题',
|
||||
`msg_content` text COMMENT '内容',
|
||||
`start_time` datetime default NULL COMMENT '开始时间',
|
||||
`end_time` datetime default NULL COMMENT '结束时间',
|
||||
`sender` varchar(100) default NULL COMMENT '发布人',
|
||||
`priority` varchar(255) default NULL COMMENT '优先级(L低,M中,H高)',
|
||||
`msg_type` varchar(10) default NULL COMMENT '通告对象类型(USER:指定用户,ALL:全体用户)',
|
||||
`send_status` varchar(10) default NULL COMMENT '发布状态(0未发布,1已发布,2已撤销)',
|
||||
`send_time` datetime default NULL COMMENT '发布时间',
|
||||
`cancel_time` datetime default NULL COMMENT '撤销时间',
|
||||
`del_flag` varchar(255) default NULL COMMENT '删除状态(0,正常,1已删除)',
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新时间',
|
||||
`user_ids` text COMMENT '指定用户',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统通告表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_announcement
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_announcement_send
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_announcement_send`;
|
||||
CREATE TABLE `sys_announcement_send` (
|
||||
`id` varchar(32) default NULL,
|
||||
`annt_id` varchar(32) default NULL COMMENT '通过id',
|
||||
`user_id` varchar(32) default NULL COMMENT '用户id',
|
||||
`read_flag` varchar(10) default NULL COMMENT '阅读状态(0未读,1已读)',
|
||||
`read_time` datetime default NULL COMMENT '阅读时间',
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新时间'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户通告阅读标记表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_announcement_send
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_depart
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_depart`;
|
||||
CREATE TABLE `sys_depart` (
|
||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||
`parent_id` varchar(32) default NULL COMMENT '父机构ID',
|
||||
`depart_name` varchar(100) NOT NULL COMMENT '机构/部门名称',
|
||||
`depart_name_en` varchar(500) default NULL COMMENT '英文名',
|
||||
`depart_name_abbr` varchar(500) default NULL COMMENT '缩写',
|
||||
`depart_order` int(11) default '0' COMMENT '排序',
|
||||
`description` text COMMENT '描述',
|
||||
`org_type` varchar(10) default NULL COMMENT '机构类型',
|
||||
`org_code` varchar(64) NOT NULL COMMENT '机构编码',
|
||||
`mobile` varchar(32) default NULL COMMENT '手机号',
|
||||
`fax` varchar(32) default NULL COMMENT '传真',
|
||||
`address` varchar(100) default NULL COMMENT '地址',
|
||||
`memo` varchar(500) default NULL COMMENT '备注',
|
||||
`status` varchar(10) default NULL COMMENT '状态(1启用,0不启用)',
|
||||
`del_flag` varchar(10) default NULL COMMENT '删除状态(0,正常,1已删除)',
|
||||
`create_by` varchar(50) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建日期',
|
||||
`update_by` varchar(50) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新日期',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='组织机构表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_depart
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_depart` VALUES ('4028608164d15ec60164d4cce4f4003e', '402880e447e99cf10147e9a03b320003', '11', null, null, null, '11', '2', 'A01A04', '', '', '', null, null, null, 'admin', '2018-07-26 12:15:55', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('4028608164d15ec60164d4cd0cf10040', '402880e447e99cf10147e9a03b320003', '22', null, null, null, '22', '2', 'A01A05', '', '', '', null, null, null, 'admin', '2018-07-26 12:16:05', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('4028608164d15ec60164d4cd99c20042', '402880e447e99cf10147e9a03b320003', '433', null, null, null, '', '2', 'A01A06', '', '', '', null, null, null, 'admin', '2018-07-26 12:16:41', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('4028608164d15ec60164d4cded7f0044', '402880e447e99cf10147e9a03b320003', '33', null, null, null, '33', '2', 'A01A07', '33', '', '', null, null, null, 'admin', '2018-07-26 12:17:02', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('4028608164d15ec60164d4ce46ca0046', '402880e447e99cf10147e9a03b320003', '55', null, null, null, '55', '2', 'A01A08', '', '', '', null, null, null, 'admin', '2018-07-26 12:17:25', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('40286081650e0f9801650e92a4a0013f', '402880e447e99cf10147e9a03b320003', '11', null, null, null, '11', '2', 'A01A09', '11', '11', '11', null, null, null, 'admin', '2018-08-06 17:30:16', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('40286081650e0f9801650e92d3f00141', '4028608164d15ec60164d4cce4f4003e', '11', null, null, null, '11', '2', 'A01A04A01', '11', '11', '', null, null, null, 'admin', '2018-08-06 17:30:28', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('40286081651283c2016513046721007d', '402880e447e9a9570147e9b677320003', '技术经理', null, null, null, '技术经理', '3', 'A01A01A01', '', '', '', null, null, null, 'admin', '2018-08-07 14:13:00', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('40286081651283c201651305b2fa007f', '40286081651283c2016513046721007d', 'T3_Java工程师', null, null, null, '高级工程师', '3', 'A01A01A01A01', '', '', '', null, null, null, 'admin', '2018-08-07 14:14:25', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f0165184abe450001', '402880e447e99cf10147e9a03b320003', '1111', null, null, null, '', '2', 'A01A10', '', '', '', null, null, null, 'admin', '2018-08-08 14:47:56', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f0165184f714b0003', '4028608164d15ec60164d4cce4f4003e', '44', null, null, null, '44', '2', 'A01A04A02', '', '', '', null, null, null, 'admin', '2018-08-08 14:53:04', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f01651850ab660005', '4028608164d15ec60164d4cce4f4003e', '55', null, null, null, '55', '2', 'A01A04A03', '', '', '', null, null, null, 'admin', '2018-08-08 14:54:24', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f01651853166f0007', '4028608164d15ec60164d4cce4f4003e', '66', null, null, null, '', '2', 'A01A04A04', '', '', '', null, null, null, 'admin', '2018-08-08 14:57:03', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f016518546bfc0009', '4028608164d15ec60164d4cce4f4003e', '77', null, null, null, '', '2', 'A01A04A05', '', '', '', null, null, null, 'admin', '2018-08-08 14:58:30', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f01651854f5ae000b', null, '12', null, null, null, '', '1', 'A04', '', '', '', null, null, null, null, null, 'admin', '2018-08-08 16:42:35');
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f0165185aa3430010', '402860816518408f01651854f5ae000b', '112', null, null, null, '', '2', 'A04A01', '', '', '', null, null, null, null, null, 'admin', '2018-08-08 15:06:18');
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f0165185bd01c0014', '402860816518408f0165185aa3430010', '11', null, null, null, '', '3', 'A04A01A01', '', '', '', null, null, null, null, null, 'admin', '2018-08-08 15:07:05');
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f016518b0a27b001a', '402880e447e99cf10147e9a03b320003', '33', null, null, null, '33', '2', 'A01A11', '', '', '', null, null, null, 'admin', '2018-08-08 16:39:13', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402860816518408f016518b3e2b5001d', '402880e447e99cf10147e9a03b320003', '11', null, null, null, '', '3', 'A01A12', '', '', '', null, null, null, 'admin', '2018-08-08 16:42:46', null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('4028608165417d1201654186d7200001', '402860816518408f0165185bd01c0014', 'dfdf', null, null, null, '', '3', 'A04A01A01A01', '', '', '', null, null, null, null, null, 'admin', '2018-08-16 14:58:08');
|
||||
INSERT INTO `sys_depart` VALUES ('402880e447e99cf10147e9a03b320003', null, '北京国炬软件', null, null, null, '', '1', 'A01', '', '', '', null, null, null, null, null, 'admin', '2018-07-26 12:15:32');
|
||||
INSERT INTO `sys_depart` VALUES ('402880e447e9a9570147e9b677320003', '402880e447e99cf10147e9a03b320003', '软件信息部', null, null, null, '', '2', 'A01A01', '', '', '', null, null, null, null, null, 'admin', '2018-07-26 12:15:28');
|
||||
INSERT INTO `sys_depart` VALUES ('402880e447e9a9570147e9b6a3be0005', '402880e447e99cf10147e9a03b320003', '销售部门', null, null, '0', '', '2', 'A01A02', null, null, null, null, null, null, null, null, null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402880e447e9a9570147e9b710d20007', '402880e447e99cf10147e9a03b320003', '人力资源部', null, null, null, '', '2', 'A01A03', '', '', '', null, null, null, null, null, 'admin', '2018-02-22 17:17:30');
|
||||
INSERT INTO `sys_depart` VALUES ('402880e447e9a9570147e9b762e30009', '402880e447e9a9570147e9b6a3be0005', '销售经理', null, null, null, '', '2', 'A01A02A01', '', '', '', null, null, null, null, null, 'admin', '2018-06-11 17:17:28');
|
||||
INSERT INTO `sys_depart` VALUES ('402880e447e9ba550147e9c53b2e0013', '8a8ab0b246dc81120146dc8180ba0017', '财务', null, null, '0', '', '2', 'A03A02', null, null, null, null, null, null, null, null, null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402880e6487e661a01487e6b504e0001', '402880e447e9a9570147e9b762e30009', '销售人员', null, null, null, '销售人员', '2', 'A01A02A01A01', '', '', '', null, null, null, null, null, null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('402880f15986303c0159864816180002', '8a8ab0b246dc81120146dc8180a20016', '部门经理', null, null, null, '', '2', 'A02A01', '', '', '', null, null, null, null, null, null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('8a8ab0b246dc81120146dc8180a20016', null, '中国人寿总公司', null, null, null, '1111', '1', 'A02', '', '', '', null, null, null, null, null, null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('8a8ab0b246dc81120146dc8180ba0017', null, 'JEECG开源社区', null, null, '2', '', '1', 'A03', '', '', '', null, null, null, null, null, null, null);
|
||||
INSERT INTO `sys_depart` VALUES ('8a8ab0b246dc81120146dc8180bd0018', '8a8ab0b246dc81120146dc8180ba0017', '软件开发部', null, null, '0', '研发技术难题', '2', 'A03A01', null, null, null, null, null, null, null, null, null, null);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dict
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_dict`;
|
||||
CREATE TABLE `sys_dict` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`dict_name` varchar(255) default NULL COMMENT '字典名称',
|
||||
`dict_code` varchar(255) default NULL COMMENT '字典编码',
|
||||
`description` varchar(255) default NULL COMMENT '描述',
|
||||
`del_flag` int(11) default NULL COMMENT '删除状态',
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_dict
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_dict` VALUES ('d3ba35be350dab9c740eb07ade088a38', '性别', 'sex', '性别', '1', null, '2019-01-08 17:38:37', null, '2019-01-11 10:50:04');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dict_item
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_dict_item`;
|
||||
CREATE TABLE `sys_dict_item` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`dict_id` varchar(255) default NULL COMMENT '字典id',
|
||||
`item_text` varchar(255) default NULL COMMENT '字典项文本',
|
||||
`item_value` varchar(255) default NULL COMMENT '字典项值',
|
||||
`description` varchar(255) default NULL COMMENT '描述',
|
||||
`sort_order` decimal(10,2) default NULL COMMENT '排序',
|
||||
`status` int(11) default NULL COMMENT '状态(1启用 0不启用)',
|
||||
`create_by` varchar(255) default NULL,
|
||||
`create_time` datetime default NULL,
|
||||
`update_by` varchar(255) default NULL,
|
||||
`update_time` datetime default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_dict_item
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_log`;
|
||||
CREATE TABLE `sys_log` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`log_type` int(11) default NULL COMMENT '日志类型(1登录日志,2操作日志)',
|
||||
`log_content` varchar(1000) default NULL COMMENT '日志内容',
|
||||
`operate_type` int(11) default NULL COMMENT '操作类型',
|
||||
`userid` varchar(255) default NULL COMMENT '操作用户账号',
|
||||
`username` varchar(255) default NULL COMMENT '操作用户名称',
|
||||
`ip` varchar(255) default NULL COMMENT 'IP',
|
||||
`method` varchar(500) default NULL COMMENT '请求java方法',
|
||||
`request_url` varchar(255) default NULL COMMENT '请求路径',
|
||||
`request_param` varchar(255) default NULL COMMENT '请求参数',
|
||||
`request_type` varchar(255) default NULL COMMENT '请求类型',
|
||||
`cost_time` bigint(20) default NULL COMMENT '耗时',
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='系统日志表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_log
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_log` VALUES ('e88dde0f78fd219b78fa62dc1e43468f', '1', '用户名: admin,登录成功!', null, null, null, '127.0.0.1', null, null, null, null, null, 'jeecg-boot', '2019-01-28 13:32:04', null, null);
|
||||
INSERT INTO `sys_log` VALUES ('22eebf6a25b3c8db0c7753f58cb9d821', '1', '用户名: admin,登录成功!', null, null, null, '127.0.0.1', null, null, null, null, null, 'jeecg-boot', '2019-01-28 13:37:09', null, null);
|
||||
INSERT INTO `sys_log` VALUES ('2dbd854c93f81302d4c53f840d8a2035', '1', '用户名: admin,登录成功!', null, null, null, '127.0.0.1', null, null, null, null, null, 'jeecg-boot', '2019-01-28 13:37:18', null, null);
|
||||
INSERT INTO `sys_log` VALUES ('8b087628098550785bb7bfdb8ec91351', '1', '用户名: admin,登录成功!', null, null, null, '127.0.0.1', null, null, null, null, null, 'jeecg-boot', '2019-01-28 13:39:19', null, null);
|
||||
INSERT INTO `sys_log` VALUES ('4e5e7485a5357ef6316d74da40ae304d', '1', '用户名: admin,登录成功!', null, null, null, '127.0.0.1', null, null, null, null, null, 'jeecg-boot', '2019-01-28 13:44:05', null, null);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_permission
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_permission`;
|
||||
CREATE TABLE `sys_permission` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键id',
|
||||
`parent_id` varchar(32) default NULL COMMENT '父id',
|
||||
`name` varchar(255) default NULL COMMENT '菜单标题',
|
||||
`url` varchar(255) default NULL COMMENT '路径',
|
||||
`component` varchar(255) default NULL COMMENT '组件',
|
||||
`redirect` varchar(255) default NULL COMMENT '一级菜单跳转地址',
|
||||
`menu_type` int(11) default NULL COMMENT '菜单类型(1:菜单 2:按钮)',
|
||||
`perms` varchar(255) default NULL COMMENT '菜单权限编码',
|
||||
`sort_no` double(3,2) default NULL COMMENT '菜单排序',
|
||||
`always_show` int(3) default NULL COMMENT '聚合子路由: 1是0否',
|
||||
`icon` varchar(255) default NULL COMMENT '菜单图标',
|
||||
`is_leaf` int(2) default NULL COMMENT '是否叶子节点: 1:是 0:不是',
|
||||
`hidden` int(2) default '0' COMMENT '是否隐藏路由: 0否,1是(默认值0)',
|
||||
`description` varchar(255) default NULL COMMENT '描述',
|
||||
`del_flag` int(11) default NULL COMMENT '删除状态 0正常 1已删除',
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='菜单权限表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_permission
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_permission` VALUES ('00a2a0ae65cdca5e93209cdbde97cbe6', '2e42e3835c2b44ec9f7bc26c146ee531', '成功', '/result/success', 'result/Success', null, '1', null, '1.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('05b3c82ddb2536a4a5ee1a4c46b5abef', '540a2936940846cb98114ffb0d145cb8', '用户列表', '/list/user-list', 'list/UserList', null, '1', null, '3.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('07acdd347152814619169844847d20d6', '2a470fc0c3954d9dbb61de6d80846549', '列表例子', '/jeecg/JeecgDemoList', 'jeecg/JeecgDemoList', null, '1', null, '1.00', '0', null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, '2019-01-22 11:00:54');
|
||||
INSERT INTO `sys_permission` VALUES ('08e6b9dc3c04489c8e1ff2ce6f105aa4', null, '仪表盘', '/dashboard2', 'layouts/RouteView', null, '1', null, '9.99', '0', 'dashboard', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:59:04');
|
||||
INSERT INTO `sys_permission` VALUES ('11e73a1d9f2678d617e44317828ed926', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '消息管理', 'system/msg', 'system/SysAnnouncementList', null, '1', null, null, '0', null, '1', '0', null, '0', 'admin', '2019-01-21 20:33:28', 'admin', '2019-01-21 20:33:42');
|
||||
INSERT INTO `sys_permission` VALUES ('13212d3416eb690c2e1d5033166ff47a', '2e42e3835c2b44ec9f7bc26c146ee531', '失败', '/result/fail', 'result/Error', null, '1', null, '2.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('1367a93f2c410b169faa7abcbad2f77c', '6e73eb3c26099c191bf03852ee1310a1', '基本设置', '/account/settings/base', 'account/settings/BaseSetting', null, '1', 'BaseSettings', null, '0', null, '1', '1', null, '0', null, '2018-12-26 18:58:35', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('277bfabef7d76e89b33062b16a9a5020', 'e3c13679c73a4f829bcff2aba8fd68b1', '基础表单', '/form/base-form', 'form/BasicForm', null, '1', null, '1.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('2a470fc0c3954d9dbb61de6d80846549', null, 'JEECG案例', '/jeecg', 'layouts/RouteView', null, '1', null, '9.99', '0', 'dashboard', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:59:31');
|
||||
INSERT INTO `sys_permission` VALUES ('2e42e3835c2b44ec9f7bc26c146ee531', null, '结果页', '/result', 'layouts/PageView', null, '1', null, '9.99', '0', 'check-circle-o', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:59:39');
|
||||
INSERT INTO `sys_permission` VALUES ('339329ed54cf255e1f9392e84f136901', '2a470fc0c3954d9dbb61de6d80846549', 'helloworld', '/jeecg/helloworld', 'jeecg/helloworld', null, '1', null, '2.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('34a10d0973052776d7a378605c904417', '9c2bede8b0f8ac9b981c54269c0d9bde', '第三方流程测试', '/sps/ThirdFlowTest', 'sps/test/ThirdFlowTest', null, '1', null, null, '0', null, '1', '0', null, '1', null, '2019-01-11 18:30:06', null, '2019-01-11 18:32:44');
|
||||
INSERT INTO `sys_permission` VALUES ('3f915b2769fc80648e92d04e84ca059d', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '用户管理', '/isystem/user', 'system/UserList', null, '1', null, '1.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('418964ba087b90a84897b62474496b93', '540a2936940846cb98114ffb0d145cb8', '查询表格', '/list/query-list', 'list/TableList', null, '1', null, '1.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('4875ebe289344e14844d8e3ea1edd73f', null, '详情页', '/profile', 'layouts/RouteView', null, '1', null, '9.99', '0', 'profile', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:59:15');
|
||||
INSERT INTO `sys_permission` VALUES ('4f66409ef3bbd69c1d80469d6e2a885e', '6e73eb3c26099c191bf03852ee1310a1', '账户绑定', '/account/settings/binding', 'account/settings/Binding', null, '1', 'BindingSettings', null, '0', null, '1', '1', null, '0', null, '2018-12-26 19:01:20', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('4f84f9400e5e92c95f05b554724c2b58', '540a2936940846cb98114ffb0d145cb8', '角色列表', '/list/role-list', 'list/RoleList', null, '1', null, '4.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('540a2936940846cb98114ffb0d145cb8', null, '列表页', '/list', 'layouts/PageView', null, '1', null, '9.99', '0', 'table', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:59:46');
|
||||
INSERT INTO `sys_permission` VALUES ('54dd5457a3190740005c1bfec55b1c34', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '菜单管理', '/isystem/permission', 'system/PermissionList', null, '1', null, '3.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('58857ff846e61794c69208e9d3a85466', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '日志管理', '/isystem/log', 'system/LogList', null, '1', null, '4.00', null, null, '1', '0', null, '0', null, '2018-12-26 10:11:18', null, '2018-12-26 15:28:06');
|
||||
INSERT INTO `sys_permission` VALUES ('6531cf3421b1265aeeeabaab5e176e6d', 'e3c13679c73a4f829bcff2aba8fd68b1', '分步表单', '/form/step-form', 'form/stepForm/StepForm', null, '1', null, '2.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('65a8f489f25a345836b7f44b1181197a', 'c65321e57b7949b7a975313220de0422', '403', '/exception/403', 'exception/403', null, '1', null, '1.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('693ce69af3432bd00be13c3971a57961', '08e6b9dc3c04489c8e1ff2ce6f105aa4', '监控页', '/dashboard/monitor', 'dashboard/Monitor', null, '1', null, '2.00', null, null, '1', '1', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('6e73eb3c26099c191bf03852ee1310a1', '717f6bee46f44a3897eca9abd6e2ec44', '个人设置', '/account/settings', 'account/settings/Index', null, '1', null, '2.00', '1', null, '0', '0', null, '0', null, '2018-12-25 20:34:38', null, '2018-12-26 19:05:26');
|
||||
INSERT INTO `sys_permission` VALUES ('717f6bee46f44a3897eca9abd6e2ec44', null, '个人页', '/account', 'layouts/RouteView', null, '1', null, '9.99', '0', 'user', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 20:00:02');
|
||||
INSERT INTO `sys_permission` VALUES ('73678f9daa45ed17a3674131b03432fb', '540a2936940846cb98114ffb0d145cb8', '权限列表', '/list/permission-list', 'list/PermissionList', null, '1', null, '5.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('7ac9eb9ccbde2f7a033cd4944272bf1e', '540a2936940846cb98114ffb0d145cb8', '卡片列表', '/list/card', 'list/CardList', null, '1', null, '7.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('882a73768cfd7f78f3a37584f7299656', '6e73eb3c26099c191bf03852ee1310a1', '个性化设置', '/account/settings/custom', 'account/settings/Custom', null, '1', 'CustomSettings', null, '0', null, '1', '1', null, '0', null, '2018-12-26 19:00:46', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('8fb8172747a78756c11916216b8b8066', '08e6b9dc3c04489c8e1ff2ce6f105aa4', '工作台', '/dashboard/workplace', 'dashboard/Workplace', null, '1', null, '3.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('9502685863ab87f0ad1134142788a385', null, '首页', '/dashboard/analysis', 'dashboard/Analysis', null, '1', null, '1.00', '0', 'dashboard', '1', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:21:01');
|
||||
INSERT INTO `sys_permission` VALUES ('ae4fed059f67086fd52a73d913cf473d', '540a2936940846cb98114ffb0d145cb8', '内联编辑表格', '/list/edit-table', 'list/TableInnerEditList', null, '1', null, '2.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('b1cb0a3fedf7ed0e4653cb5a229837ee', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '定时任务', 'system/QuartzJobList', 'system/QuartzJobList', null, '1', null, '5.00', '0', null, '1', '0', null, '0', null, '2019-01-03 09:38:52', null, '2019-01-03 09:42:07');
|
||||
INSERT INTO `sys_permission` VALUES ('b3c824fc22bd953e2eb16ae6914ac8f9', '4875ebe289344e14844d8e3ea1edd73f', '高级详情页', '/profile/advanced', 'profile/advanced/Advanced', null, '1', null, '2.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('b4dfc7d5dd9e8d5b6dd6d4579b1aa559', 'c65321e57b7949b7a975313220de0422', '500', '/exception/500', 'exception/500', null, '1', null, '3.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('be71f37d127b02d6b09b9ddaa241313d', '9c2bede8b0f8ac9b981c54269c0d9bde', '第三方流程测试', '/sps/ThirdFlow', '/sps/test/ThirdFlow', null, '1', 'ThirdFlow', null, '0', null, '1', '0', null, '1', null, '2019-01-11 18:28:54', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('c65321e57b7949b7a975313220de0422', null, '异常页', '/exception', 'layouts/RouteView', null, '1', null, '9.99', '0', 'warning', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:59:54');
|
||||
INSERT INTO `sys_permission` VALUES ('c670cd41b4156e83061d5d710d991270', '9c2bede8b0f8ac9b981c54269c0d9bde', '流程测试', '/isps/flowTest', 'sps/test/FlowTest', null, '1', 'FlowTest', null, '0', null, '1', '0', null, '1', null, '2019-01-09 18:20:51', null, '2019-01-09 20:52:17');
|
||||
INSERT INTO `sys_permission` VALUES ('c71c0623ea9c9a846a1dafb999271fcd', '66de730f242bb917264698b422ddeb09', '流程管理', '/isps/flowList', 'sps/flow/FlowList', null, '1', null, '4.00', '0', 'bars', '1', '0', null, '1', null, '2019-01-15 11:50:49', null, '2019-01-15 15:01:42');
|
||||
INSERT INTO `sys_permission` VALUES ('cc50656cf9ca528e6f2150eba4714ad2', '4875ebe289344e14844d8e3ea1edd73f', '基础详情页', '/profile/basic', 'profile/basic/Index', null, '1', null, '1.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('d2bbf9ebca5a8fa2e227af97d2da7548', 'c65321e57b7949b7a975313220de0422', '404', '/exception/404', 'exception/404', null, '1', null, '2.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('d7d6e2e4e2934f2c9385a623fd98c6f3', null, '系统管理', '/isystem', 'layouts/RouteView', null, '1', null, '8.00', '0', 'dashboard', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 20:33:42');
|
||||
INSERT INTO `sys_permission` VALUES ('d86f58e7ab516d3bc6bfb1fe10585f97', '717f6bee46f44a3897eca9abd6e2ec44', '个人中心', '/account/center', 'account/center/Index', null, '1', null, '1.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('e3c13679c73a4f829bcff2aba8fd68b1', null, '表单页', '/form', 'layouts/PageView', null, '1', null, '9.99', '0', 'form', '0', '0', null, '0', null, '2018-12-25 20:34:38', 'admin', '2019-01-21 19:59:22');
|
||||
INSERT INTO `sys_permission` VALUES ('e5973686ed495c379d829ea8b2881fc6', 'e3c13679c73a4f829bcff2aba8fd68b1', '高级表单', '/form/advanced-form', 'form/advancedForm/AdvancedForm', null, '1', null, '3.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('e8af452d8948ea49d37c934f5100ae6a', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '角色管理', '/isystem/role', 'system/RoleList', null, '1', null, '2.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('ec8d607d0156e198b11853760319c646', '6e73eb3c26099c191bf03852ee1310a1', '安全设置', '/account/settings/security', 'account/settings/Security', null, '1', 'SecuritySettings', null, '0', null, '1', '1', null, '0', null, '2018-12-26 18:59:52', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('f1cb187abf927c88b89470d08615f5ac', 'd7d6e2e4e2934f2c9385a623fd98c6f3', '数据字典', '/isystem/dict', 'system/DictList', null, '1', null, '5.00', '0', null, '1', '0', null, '0', null, '2018-12-28 13:54:43', null, '2018-12-28 15:37:54');
|
||||
INSERT INTO `sys_permission` VALUES ('f23d9bfff4d9aa6b68569ba2cff38415', '540a2936940846cb98114ffb0d145cb8', '标准列表', '/list/basic-list', 'list/StandardList', null, '1', null, '6.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('fb07ca05a3e13674dbf6d3245956da2e', '540a2936940846cb98114ffb0d145cb8', '搜索列表', '/list/search', 'list/search/SearchLayout', null, '1', null, '8.00', null, null, '1', '0', null, '0', null, '2018-12-25 20:34:38', null, null);
|
||||
INSERT INTO `sys_permission` VALUES ('fedfbf4420536cacc0218557d263dfea', '6e73eb3c26099c191bf03852ee1310a1', '新消息通知', '/account/settings/notification', 'account/settings/Notification', null, '1', 'NotificationSettings', null, '0', '', '1', '1', null, '0', null, '2018-12-26 19:02:05', null, null);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_quartz_job
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_quartz_job`;
|
||||
CREATE TABLE `sys_quartz_job` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`del_flag` int(11) default NULL COMMENT '删除状态',
|
||||
`update_by` varchar(255) default NULL COMMENT '修改人',
|
||||
`update_time` datetime default NULL COMMENT '修改时间',
|
||||
`job_class_name` varchar(255) default NULL COMMENT '任务类名',
|
||||
`cron_expression` varchar(255) default NULL COMMENT 'cron表达式',
|
||||
`parameter` varchar(255) default NULL COMMENT '参数',
|
||||
`description` varchar(255) default NULL COMMENT '描述',
|
||||
`status` int(11) default NULL COMMENT '状态 0正常 -1停止',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_quartz_job
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_quartz_job` VALUES ('df26ecacf0f75d219d746750fe84bbee', null, null, '0', 'admin', '2019-01-28 13:57:22', 'org.jeecg.modules.quartz.job.SampleParamJob', '0/1 * * * * ?', 'scott', '带参测试 后台将每隔1秒执行输出日志', '-1');
|
||||
INSERT INTO `sys_quartz_job` VALUES ('58180f2a7c8cd36a121fd0fff3f02a36', null, null, '0', 'admin', '2019-01-28 13:57:45', 'org.jeecg.modules.quartz.job.SampleJob', '0/1 * * * * ?', null, null, '-1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_role`;
|
||||
CREATE TABLE `sys_role` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键id',
|
||||
`role_name` varchar(255) default NULL COMMENT '角色名称',
|
||||
`role_code` varchar(255) default NULL COMMENT '角色编码',
|
||||
`description` varchar(255) default NULL COMMENT '描述',
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_role
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_role` VALUES ('f6817f48af4fb3af11b9e8bf182f618b', '管理员', 'gly', '管理员', null, '2018-12-21 18:03:39', null, '2019-01-10 16:20:04');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_role_permission
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_role_permission`;
|
||||
CREATE TABLE `sys_role_permission` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`role_id` varchar(32) default NULL COMMENT '角色id',
|
||||
`permission_id` varchar(32) default NULL COMMENT '权限id',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色权限表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_role_permission
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_role_permission` VALUES ('026351916c841e114468e941627a787b', 'f6817f48af4fb3af11b9e8bf182f618b', '58857ff846e61794c69208e9d3a85466');
|
||||
INSERT INTO `sys_role_permission` VALUES ('064e67f62aea92462a0875ce294ab5d6', 'f6817f48af4fb3af11b9e8bf182f618b', '6e73eb3c26099c191bf03852ee1310a1');
|
||||
INSERT INTO `sys_role_permission` VALUES ('0ca8b65b108dd0ab3d9eb90f554f71ba', 'f6817f48af4fb3af11b9e8bf182f618b', '8f486c17bf7016301432019fdba7aed8');
|
||||
INSERT INTO `sys_role_permission` VALUES ('118fa3d45d246d50a3c5d9fa92c2a400', 'f6817f48af4fb3af11b9e8bf182f618b', 'e8af452d8948ea49d37c934f5100ae6a');
|
||||
INSERT INTO `sys_role_permission` VALUES ('11b4fd5d11b50afdc9a0dc7676037ba2', 'f6817f48af4fb3af11b9e8bf182f618b', 'c65321e57b7949b7a975313220de0422');
|
||||
INSERT INTO `sys_role_permission` VALUES ('127ae6e13af03f07180f7ffff41ec7bb', 'f6817f48af4fb3af11b9e8bf182f618b', 'd2bbf9ebca5a8fa2e227af97d2da7548');
|
||||
INSERT INTO `sys_role_permission` VALUES ('164a6f118aa15138d6c8bdc667892ba3', 'f6817f48af4fb3af11b9e8bf182f618b', '3f915b2769fc80648e92d04e84ca059d');
|
||||
INSERT INTO `sys_role_permission` VALUES ('171ba1c7306b2cb38c980b29801ba37d', 'f6817f48af4fb3af11b9e8bf182f618b', 'ddf29a50766ebf228a76d676f34d1121');
|
||||
INSERT INTO `sys_role_permission` VALUES ('2658494328be1ebc035134c05fc2f11e', 'f6817f48af4fb3af11b9e8bf182f618b', '54dd5457a3190740005c1bfec55b1c34');
|
||||
INSERT INTO `sys_role_permission` VALUES ('26c98a73fac3c79dfdd16016356a9faa', 'f6817f48af4fb3af11b9e8bf182f618b', '4875ebe289344e14844d8e3ea1edd73f');
|
||||
INSERT INTO `sys_role_permission` VALUES ('27db84db281961e840b596c49346ef7e', 'f6817f48af4fb3af11b9e8bf182f618b', '1367a93f2c410b169faa7abcbad2f77c');
|
||||
INSERT INTO `sys_role_permission` VALUES ('287594a1ec30caa90810ef7a58178bd0', 'f6817f48af4fb3af11b9e8bf182f618b', 'f1cb187abf927c88b89470d08615f5ac');
|
||||
INSERT INTO `sys_role_permission` VALUES ('2be31e6e281acf08578a2e5b4f73f815', 'f6817f48af4fb3af11b9e8bf182f618b', 'e5973686ed495c379d829ea8b2881fc6');
|
||||
INSERT INTO `sys_role_permission` VALUES ('2c4bb54630e60fe2660da36b11bcf12e', 'f6817f48af4fb3af11b9e8bf182f618b', 'b4dfc7d5dd9e8d5b6dd6d4579b1aa559');
|
||||
INSERT INTO `sys_role_permission` VALUES ('2df3ab2b5214cc1d034507e152771a41', 'f6817f48af4fb3af11b9e8bf182f618b', '717f6bee46f44a3897eca9abd6e2ec44');
|
||||
INSERT INTO `sys_role_permission` VALUES ('2e3f1ec4c21885ce061b61e2519e79c8', 'f6817f48af4fb3af11b9e8bf182f618b', 'c71c0623ea9c9a846a1dafb999271fcd');
|
||||
INSERT INTO `sys_role_permission` VALUES ('2f0aa12fafe792f6c786780fdd5cfeeb', 'f6817f48af4fb3af11b9e8bf182f618b', 'a68e9113be42055075189de4f77853e0');
|
||||
INSERT INTO `sys_role_permission` VALUES ('37608598f14cfe94e4ccc288ce1ea336', 'f6817f48af4fb3af11b9e8bf182f618b', 'd7d6e2e4e2934f2c9385a623fd98c6f3');
|
||||
INSERT INTO `sys_role_permission` VALUES ('3a23f807225746ceff686953e9544859', 'f6817f48af4fb3af11b9e8bf182f618b', '418964ba087b90a84897b62474496b93');
|
||||
INSERT INTO `sys_role_permission` VALUES ('40d2734e7379ef44a6b6d42070e3ff16', 'f6817f48af4fb3af11b9e8bf182f618b', '37236b347227b5d3f5cd9e463099f91c');
|
||||
INSERT INTO `sys_role_permission` VALUES ('45ad5bc317e6cf9fd98fce84b8500205', 'f6817f48af4fb3af11b9e8bf182f618b', '2a470fc0c3954d9dbb61de6d80846549');
|
||||
INSERT INTO `sys_role_permission` VALUES ('48117105a2234463ffd9fe82e033b26b', 'f6817f48af4fb3af11b9e8bf182f618b', '00a2a0ae65cdca5e93209cdbde97cbe6');
|
||||
INSERT INTO `sys_role_permission` VALUES ('496108f88375b90ee7ee50909ff6a049', 'f6817f48af4fb3af11b9e8bf182f618b', 'a8d3ffd0c52950023291834e370ec3e2');
|
||||
INSERT INTO `sys_role_permission` VALUES ('4c84fa4daab1b4d7c109d7cab49e9743', 'f6817f48af4fb3af11b9e8bf182f618b', '08e6b9dc3c04489c8e1ff2ce6f105aa4');
|
||||
INSERT INTO `sys_role_permission` VALUES ('4e122c75b51533ec51e1e80a2c240658', 'f6817f48af4fb3af11b9e8bf182f618b', 'fedfbf4420536cacc0218557d263dfea');
|
||||
INSERT INTO `sys_role_permission` VALUES ('4e5cf9a9adec9cddece86e86d6f31278', 'f6817f48af4fb3af11b9e8bf182f618b', '693ce69af3432bd00be13c3971a57961');
|
||||
INSERT INTO `sys_role_permission` VALUES ('4f28ab1dbfbc4219a352191329c51842', 'f6817f48af4fb3af11b9e8bf182f618b', '8e8517f135e55f1ef9340a558c9367f1');
|
||||
INSERT INTO `sys_role_permission` VALUES ('5a99079ca98546c838a225b0e6012cb9', 'ee8626f80f7c2619917b6236f3a7f02b', 'fedfbf4420536cacc0218557d263dfea');
|
||||
INSERT INTO `sys_role_permission` VALUES ('5b32a4a35f8aa6ffc94c93847ea1940f', 'ee8626f80f7c2619917b6236f3a7f02b', '4f66409ef3bbd69c1d80469d6e2a885e');
|
||||
INSERT INTO `sys_role_permission` VALUES ('5e1aa00e6434a749109523d2a4693b80', 'f6817f48af4fb3af11b9e8bf182f618b', '34a10d0973052776d7a378605c904417');
|
||||
INSERT INTO `sys_role_permission` VALUES ('64390c46bff797016556fbe1ac88fb8c', 'f6817f48af4fb3af11b9e8bf182f618b', '05b3c82ddb2536a4a5ee1a4c46b5abef');
|
||||
INSERT INTO `sys_role_permission` VALUES ('6b98c1bbc3ff966ca8f88b7192b38ae6', 'f6817f48af4fb3af11b9e8bf182f618b', '73678f9daa45ed17a3674131b03432fb');
|
||||
INSERT INTO `sys_role_permission` VALUES ('6fa242fce7ba2c5d71cd16602f007a4d', 'f6817f48af4fb3af11b9e8bf182f618b', '5efbf11a764db7759c36c669a263f292');
|
||||
INSERT INTO `sys_role_permission` VALUES ('714b9b0bd92212ba86bafe7bbc902d6e', 'f6817f48af4fb3af11b9e8bf182f618b', 'c670cd41b4156e83061d5d710d991270');
|
||||
INSERT INTO `sys_role_permission` VALUES ('75002588591820806', '16457350655250432', '5129710648430592');
|
||||
INSERT INTO `sys_role_permission` VALUES ('75002588604403712', '16457350655250432', '5129710648430593');
|
||||
INSERT INTO `sys_role_permission` VALUES ('75002588612792320', '16457350655250432', '40238597734928384');
|
||||
INSERT INTO `sys_role_permission` VALUES ('75002588625375232', '16457350655250432', '57009744761589760');
|
||||
INSERT INTO `sys_role_permission` VALUES ('75002588633763840', '16457350655250432', '16392452747300864');
|
||||
INSERT INTO `sys_role_permission` VALUES ('75002588637958144', '16457350655250432', '16392767785668608');
|
||||
INSERT INTO `sys_role_permission` VALUES ('75002588650541056', '16457350655250432', '16439068543946752');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277779875336192', '496138616573952', '5129710648430592');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780043108352', '496138616573952', '5129710648430593');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780055691264', '496138616573952', '15701400130424832');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780064079872', '496138616573952', '16678126574637056');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780072468480', '496138616573952', '15701915807518720');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780076662784', '496138616573952', '15708892205944832');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780085051392', '496138616573952', '16678447719911424');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780089245696', '496138616573952', '25014528525733888');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780097634304', '496138616573952', '56898976661639168');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780135383040', '496138616573952', '40238597734928384');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780139577344', '496138616573952', '45235621697949696');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780147965952', '496138616573952', '45235787867885568');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780156354560', '496138616573952', '45235939278065664');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780164743168', '496138616573952', '43117268627886080');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780168937472', '496138616573952', '45236734832676864');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780181520384', '496138616573952', '45237010692050944');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780189908992', '496138616573952', '45237170029465600');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780198297600', '496138616573952', '57009544286441472');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780206686208', '496138616573952', '57009744761589760');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780215074816', '496138616573952', '57009981228060672');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780219269120', '496138616573952', '56309618086776832');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780227657728', '496138616573952', '57212882168844288');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780236046336', '496138616573952', '61560041605435392');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780244434944', '496138616573952', '61560275261722624');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780257017856', '496138616573952', '61560480518377472');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780265406464', '496138616573952', '44986029924421632');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780324126720', '496138616573952', '45235228800716800');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780332515328', '496138616573952', '45069342940860416');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780340903937', '496138616573952', '5129710648430594');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780349292544', '496138616573952', '16687383932047360');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780357681152', '496138616573952', '16689632049631232');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780366069760', '496138616573952', '16689745006432256');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780370264064', '496138616573952', '16689883993083904');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780374458369', '496138616573952', '16690313745666048');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780387041280', '496138616573952', '5129710648430595');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780395429888', '496138616573952', '16694861252005888');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780403818496', '496138616573952', '16695107491205120');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780412207104', '496138616573952', '16695243126607872');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780420595712', '496138616573952', '75002207560273920');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780428984320', '496138616573952', '76215889006956544');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780433178624', '496138616573952', '76216071333351424');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780441567232', '496138616573952', '76216264070008832');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780449955840', '496138616573952', '76216459709124608');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780458344448', '496138616573952', '76216594207870976');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780466733056', '496138616573952', '76216702639017984');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780475121664', '496138616573952', '58480609315524608');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780483510272', '496138616573952', '61394706252173312');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780491898880', '496138616573952', '61417744146370560');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780496093184', '496138616573952', '76606430504816640');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780504481792', '496138616573952', '76914082455752704');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780508676097', '496138616573952', '76607201262702592');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780517064704', '496138616573952', '39915540965232640');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780525453312', '496138616573952', '41370251991977984');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780538036224', '496138616573952', '45264987354042368');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780546424832', '496138616573952', '45265487029866496');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780554813440', '496138616573952', '45265762415284224');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780559007744', '496138616573952', '45265886315024384');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780567396352', '496138616573952', '45266070000373760');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780571590656', '496138616573952', '41363147411427328');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780579979264', '496138616573952', '41363537456533504');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780588367872', '496138616573952', '41364927394353152');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780596756480', '496138616573952', '41371711400054784');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780605145088', '496138616573952', '41469219249852416');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780613533696', '496138616573952', '39916171171991552');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780621922304', '496138616573952', '39918482854252544');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780630310912', '496138616573952', '41373430515240960');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780718391296', '496138616573952', '41375330996326400');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780722585600', '496138616573952', '63741744973352960');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780730974208', '496138616573952', '42082442672082944');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780739362816', '496138616573952', '41376192166629376');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780747751424', '496138616573952', '41377034236071936');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780756140032', '496138616573952', '56911328312299520');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780764528640', '496138616573952', '41378916912336896');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780768722944', '496138616573952', '63482475359244288');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780772917249', '496138616573952', '64290663792906240');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780785500160', '496138616573952', '66790433014943744');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780789694464', '496138616573952', '42087054753927168');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780798083072', '496138616573952', '67027338952445952');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780806471680', '496138616573952', '67027909637836800');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780810665985', '496138616573952', '67042515441684480');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780823248896', '496138616573952', '67082402312228864');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780827443200', '496138616573952', '16392452747300864');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780835831808', '496138616573952', '16392767785668608');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780840026112', '496138616573952', '16438800255291392');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780844220417', '496138616573952', '16438962738434048');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277780852609024', '496138616573952', '16439068543946752');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860062040064', '496138616573953', '5129710648430592');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860070428672', '496138616573953', '5129710648430593');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860078817280', '496138616573953', '40238597734928384');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860091400192', '496138616573953', '43117268627886080');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860099788800', '496138616573953', '57009744761589760');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860112371712', '496138616573953', '56309618086776832');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860120760320', '496138616573953', '44986029924421632');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860129148928', '496138616573953', '5129710648430594');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860141731840', '496138616573953', '5129710648430595');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860150120448', '496138616573953', '75002207560273920');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860158509056', '496138616573953', '58480609315524608');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860162703360', '496138616573953', '76606430504816640');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860171091968', '496138616573953', '76914082455752704');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860179480576', '496138616573953', '76607201262702592');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860187869184', '496138616573953', '39915540965232640');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860196257792', '496138616573953', '41370251991977984');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860204646400', '496138616573953', '41363147411427328');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860208840704', '496138616573953', '41371711400054784');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860213035009', '496138616573953', '39916171171991552');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860221423616', '496138616573953', '39918482854252544');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860225617920', '496138616573953', '41373430515240960');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860234006528', '496138616573953', '41375330996326400');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860242395136', '496138616573953', '63741744973352960');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860250783744', '496138616573953', '42082442672082944');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860254978048', '496138616573953', '41376192166629376');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860263366656', '496138616573953', '41377034236071936');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860271755264', '496138616573953', '56911328312299520');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860313698304', '496138616573953', '41378916912336896');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860322086912', '496138616573953', '63482475359244288');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860326281216', '496138616573953', '64290663792906240');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860334669824', '496138616573953', '66790433014943744');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860343058432', '496138616573953', '42087054753927168');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860347252736', '496138616573953', '67027338952445952');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860351447041', '496138616573953', '67027909637836800');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860359835648', '496138616573953', '67042515441684480');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860364029952', '496138616573953', '67082402312228864');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860368224256', '496138616573953', '16392452747300864');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860372418560', '496138616573953', '16392767785668608');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860376612865', '496138616573953', '16438800255291392');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860385001472', '496138616573953', '16438962738434048');
|
||||
INSERT INTO `sys_role_permission` VALUES ('77277860389195776', '496138616573953', '16439068543946752');
|
||||
INSERT INTO `sys_role_permission` VALUES ('7be61b677280c540159c769557b26f2b', 'f6817f48af4fb3af11b9e8bf182f618b', '4f84f9400e5e92c95f05b554724c2b58');
|
||||
INSERT INTO `sys_role_permission` VALUES ('7ef49dbe94ca5bbd675b70b7dcde595c', 'f6817f48af4fb3af11b9e8bf182f618b', 'f23d9bfff4d9aa6b68569ba2cff38415');
|
||||
INSERT INTO `sys_role_permission` VALUES ('7f089d0c2d9740c7824a26d0b05b7a7c', 'f6817f48af4fb3af11b9e8bf182f618b', '9502685863ab87f0ad1134142788a385');
|
||||
INSERT INTO `sys_role_permission` VALUES ('86ac4619a3ef549b75926b6756a8f64d', 'f6817f48af4fb3af11b9e8bf182f618b', '0b6debda2d5a214aa81540971575a6b2');
|
||||
INSERT INTO `sys_role_permission` VALUES ('89f45a7ec6f9b69443d222267ac58713', 'f6817f48af4fb3af11b9e8bf182f618b', 'fb07ca05a3e13674dbf6d3245956da2e');
|
||||
INSERT INTO `sys_role_permission` VALUES ('912068609b28ee52603494f814881dd4', 'f6817f48af4fb3af11b9e8bf182f618b', '540a2936940846cb98114ffb0d145cb8');
|
||||
INSERT INTO `sys_role_permission` VALUES ('95528c4a7eb49790e58415c6ec6e3611', 'f6817f48af4fb3af11b9e8bf182f618b', 'ec8d607d0156e198b11853760319c646');
|
||||
INSERT INTO `sys_role_permission` VALUES ('9c9e3ea9159cb505b857f7f19819041b', 'f6817f48af4fb3af11b9e8bf182f618b', '7ac9eb9ccbde2f7a033cd4944272bf1e');
|
||||
INSERT INTO `sys_role_permission` VALUES ('a043544bf8b3f53dbca0ccc5847aff9f', 'f6817f48af4fb3af11b9e8bf182f618b', '37fc0af6d161dc6f73b7d4b875e35a93');
|
||||
INSERT INTO `sys_role_permission` VALUES ('a3bfe5ca069c1c96f14a5b0e4cee07e0', 'f6817f48af4fb3af11b9e8bf182f618b', 'cc50656cf9ca528e6f2150eba4714ad2');
|
||||
INSERT INTO `sys_role_permission` VALUES ('a4fe0c33261a78b5302be163e89bc276', 'f6817f48af4fb3af11b9e8bf182f618b', 'b3c824fc22bd953e2eb16ae6914ac8f9');
|
||||
INSERT INTO `sys_role_permission` VALUES ('a5a2155cc655121f5d16d04b50beaaf2', 'f6817f48af4fb3af11b9e8bf182f618b', 'd86f58e7ab516d3bc6bfb1fe10585f97');
|
||||
INSERT INTO `sys_role_permission` VALUES ('a7731e047246e321629e2ad9346054fd', 'f6817f48af4fb3af11b9e8bf182f618b', '882a73768cfd7f78f3a37584f7299656');
|
||||
INSERT INTO `sys_role_permission` VALUES ('abc60b9977934277aacdb60c3ad06ebf', 'ee8626f80f7c2619917b6236f3a7f02b', 'ec8d607d0156e198b11853760319c646');
|
||||
INSERT INTO `sys_role_permission` VALUES ('aefcfc55ae66e975d92798fc5431fe82', 'f6817f48af4fb3af11b9e8bf182f618b', '11e73a1d9f2678d617e44317828ed926');
|
||||
INSERT INTO `sys_role_permission` VALUES ('af19013fed4af1a6cdb2f54054119d0b', 'ee8626f80f7c2619917b6236f3a7f02b', '882a73768cfd7f78f3a37584f7299656');
|
||||
INSERT INTO `sys_role_permission` VALUES ('b01aab380957b42a3e43838292da9f54', 'f6817f48af4fb3af11b9e8bf182f618b', '339329ed54cf255e1f9392e84f136901');
|
||||
INSERT INTO `sys_role_permission` VALUES ('b1fe8ab8c91963aa031b1dfda310e1f9', 'f6817f48af4fb3af11b9e8bf182f618b', '8fb8172747a78756c11916216b8b8066');
|
||||
INSERT INTO `sys_role_permission` VALUES ('b402c7c5e8dad60e236edc5bcffdb6df', 'f6817f48af4fb3af11b9e8bf182f618b', '2e42e3835c2b44ec9f7bc26c146ee531');
|
||||
INSERT INTO `sys_role_permission` VALUES ('b9cdd4b5f397b0ec67bd0b8b4a75328e', 'f6817f48af4fb3af11b9e8bf182f618b', '131edfc0a0c6d89647eb4a89f85a1125');
|
||||
INSERT INTO `sys_role_permission` VALUES ('b9e2f8d4ce01d61b58ea35253ba16388', 'f6817f48af4fb3af11b9e8bf182f618b', '13212d3416eb690c2e1d5033166ff47a');
|
||||
INSERT INTO `sys_role_permission` VALUES ('ba393ff6e8832dffdf8bed9e388cf19a', 'f6817f48af4fb3af11b9e8bf182f618b', '83741ee67fd3ba1d981744244dd74462');
|
||||
INSERT INTO `sys_role_permission` VALUES ('bdf7aea996a57122c789a302bd30d328', 'f6817f48af4fb3af11b9e8bf182f618b', '07acdd347152814619169844847d20d6');
|
||||
INSERT INTO `sys_role_permission` VALUES ('c1419439350fc381d980c43f17246861', 'f6817f48af4fb3af11b9e8bf182f618b', '6531cf3421b1265aeeeabaab5e176e6d');
|
||||
INSERT INTO `sys_role_permission` VALUES ('cb36b119fa0df98b7c5420ea9ab80300', 'f6817f48af4fb3af11b9e8bf182f618b', '3eb07a99bd7dcea6d9bef40e37735c7f');
|
||||
INSERT INTO `sys_role_permission` VALUES ('cd55c2ebba2124c51dcd1c5e14987c40', 'f6817f48af4fb3af11b9e8bf182f618b', '4f66409ef3bbd69c1d80469d6e2a885e');
|
||||
INSERT INTO `sys_role_permission` VALUES ('cf9e06d4b6ffd1fb40aefb164f613598', 'f6817f48af4fb3af11b9e8bf182f618b', '65a8f489f25a345836b7f44b1181197a');
|
||||
INSERT INTO `sys_role_permission` VALUES ('d1914e1fea6d398f053e5971340448bc', 'f6817f48af4fb3af11b9e8bf182f618b', 'be71f37d127b02d6b09b9ddaa241313d');
|
||||
INSERT INTO `sys_role_permission` VALUES ('d90fe0542d327d90e1817a0427c17f1b', 'f6817f48af4fb3af11b9e8bf182f618b', '277bfabef7d76e89b33062b16a9a5020');
|
||||
INSERT INTO `sys_role_permission` VALUES ('e06b6637ed1c90ebe1e396e56ce034c2', 'f6817f48af4fb3af11b9e8bf182f618b', 'cf02da6d64ff41229ed81f5dfcd898fa');
|
||||
INSERT INTO `sys_role_permission` VALUES ('e2d1ce200e0161866ccb47505dc5dc34', 'ee8626f80f7c2619917b6236f3a7f02b', '1367a93f2c410b169faa7abcbad2f77c');
|
||||
INSERT INTO `sys_role_permission` VALUES ('e82315c63da6f2c659b458f6e1377716', 'f6817f48af4fb3af11b9e8bf182f618b', '9271af487e0184387c326383d655ca37');
|
||||
INSERT INTO `sys_role_permission` VALUES ('f349c4a1151b4d5db1873b7abf508281', 'f6817f48af4fb3af11b9e8bf182f618b', 'b1cb0a3fedf7ed0e4653cb5a229837ee');
|
||||
INSERT INTO `sys_role_permission` VALUES ('f73e005160a9d146e8eb1b6241e87aba', 'f6817f48af4fb3af11b9e8bf182f618b', '89d70d3c72ad5cc778f511f8ac9f3242');
|
||||
INSERT INTO `sys_role_permission` VALUES ('fc0902a26aa69dab30603c19b9a41f44', 'f6817f48af4fb3af11b9e8bf182f618b', 'ae4fed059f67086fd52a73d913cf473d');
|
||||
INSERT INTO `sys_role_permission` VALUES ('fd0eb799bb38fe939b486e12a2db338f', 'f6817f48af4fb3af11b9e8bf182f618b', 'e3c13679c73a4f829bcff2aba8fd68b1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_user`;
|
||||
CREATE TABLE `sys_user` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键id',
|
||||
`username` varchar(100) default NULL COMMENT '登录账号',
|
||||
`realname` varchar(255) default NULL COMMENT '真实姓名',
|
||||
`password` varchar(255) default NULL COMMENT '密码',
|
||||
`salt` varchar(45) default NULL COMMENT 'md5密码盐',
|
||||
`avatar` varchar(255) default NULL COMMENT '头像',
|
||||
`birthday` datetime default NULL COMMENT '生日',
|
||||
`sex` int(11) default NULL COMMENT '性别(1:男 2:女)',
|
||||
`email` varchar(45) default NULL COMMENT '电子邮件',
|
||||
`phone` varchar(45) default NULL COMMENT '电话',
|
||||
`status` int(11) default NULL COMMENT '状态(1:正常 2:冻结 )',
|
||||
`del_flag` varchar(255) default NULL COMMENT '删除状态(0,正常,1已删除)',
|
||||
`create_by` varchar(255) default NULL COMMENT '创建人',
|
||||
`create_time` datetime default NULL COMMENT '创建时间',
|
||||
`update_by` varchar(255) default NULL COMMENT '更新人',
|
||||
`update_time` datetime default NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_user
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_user` VALUES ('e9ca23d68d884d4ebb19d07889727dae', 'admin', '管理员', 'a5fcaadb846aaedc', '6MTVvy1z', 'user/20181226/favicon_1545796089238.ico', '2018-12-05 00:00:00', '1', '11@qq.com', '18566666666', '1', '0', null, '2018-12-21 17:54:10', null, '2019-01-19 10:59:46');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user_role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_user_role`;
|
||||
CREATE TABLE `sys_user_role` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键id',
|
||||
`user_id` varchar(32) default NULL COMMENT '用户id',
|
||||
`role_id` varchar(32) default NULL COMMENT '角色id',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_user_role
|
||||
-- ----------------------------
|
||||
INSERT INTO `sys_user_role` VALUES ('6d096d48ce7281b50c5f224aab2ff87e', 'e9ca23d68d884d4ebb19d07889727dae', 'f6817f48af4fb3af11b9e8bf182f618b');
|
||||
193
jeecg-boot/pom.xml
Normal file
193
jeecg-boot/pom.xml
Normal file
@ -0,0 +1,193 @@
|
||||
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot</artifactId>
|
||||
<version>1.0.1</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.3.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyun</id>
|
||||
<name>aliyun Repository</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jeecg</id>
|
||||
<name>jeecg Repository</name>
|
||||
<url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mybatis-plus.version>3.0.6</mybatis-plus.version>
|
||||
<druid.version>1.1.10</druid.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--集成springmvc框架并实现自动配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok get set 构造方法 toString logger 自动生成工具-->
|
||||
<!--注意:需要IDE也安装对应插件,可直接在plugins里面搜,不安装,语法报错但不影响编译和运行-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<!-- mybatis-plus -->
|
||||
|
||||
<!-- druid阿里巴巴数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.10</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 动态数据源 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- json -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.35</version>
|
||||
</dependency>
|
||||
|
||||
<!--mysql-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Quartz定时任务 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--JWT-->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--shiro-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring-boot-starter</artifactId>
|
||||
<version>1.4.0-RC2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger API文档 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<!-- redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<!-- jeecg-boot 代码生成器 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>codegenerate</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<!-- 指定JDK编译版本 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.json</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
17
jeecg-boot/src/main/java/org/jeecg/JeecgApplication.java
Normal file
17
jeecg-boot/src/main/java/org/jeecg/JeecgApplication.java
Normal file
@ -0,0 +1,17 @@
|
||||
package org.jeecg;
|
||||
|
||||
import org.activiti.spring.boot.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@EnableSwagger2
|
||||
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
|
||||
public class JeecgApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("spring.devtools.restart.enabled", "true");
|
||||
SpringApplication.run(JeecgApplication.class, args);
|
||||
}
|
||||
}
|
||||
46
jeecg-boot/src/main/java/org/jeecg/JeecgCodeGenerator.java
Normal file
46
jeecg-boot/src/main/java/org/jeecg/JeecgCodeGenerator.java
Normal file
@ -0,0 +1,46 @@
|
||||
package org.jeecg;
|
||||
|
||||
import org.jeecgframework.codegenerate.generate.impl.CodeGenerateOne;
|
||||
import org.jeecgframework.codegenerate.generate.pojo.TableVo;
|
||||
|
||||
/**
|
||||
* jeecg-boot代码生成器
|
||||
* 功能说明: 一键生成增删改查所有代码(包括:controller、service、dao、mapper、entity、vue)
|
||||
* 自定义模板: 模板位置在/src/main/resources/jeecg/code-template
|
||||
* @author scott
|
||||
*
|
||||
*/
|
||||
public class JeecgCodeGenerator {
|
||||
|
||||
/**
|
||||
* 代码生成器使用说明(单表模型)
|
||||
*
|
||||
* [1]、全局配置文件
|
||||
* src/main/resources/jeecg/jeecg_config.properties : 代码生成器基础配置文件(项目路径、根业务包路径)
|
||||
* src/main/resources/jeecg/jeecg_database.properties :代码生成器数据库配置文件(独立的数据源配置)
|
||||
*
|
||||
* [3]、页面使用说明:
|
||||
* 1. 页面生成路径: src/main/java/{业务包根路径}/{子业务包}/vue/
|
||||
* 2. 使用方法,手工复制到webstorm项目下面
|
||||
* 3. 配置访问菜单
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("----jeecg--------- Code------------- Generation -----[单表模型]------- 生成中。。。");
|
||||
|
||||
/**[2]、表配置参数 */
|
||||
TableVo table = new TableVo();
|
||||
//表名
|
||||
table.setTableName("jeecg_order_main");
|
||||
//表主键策略(目前只支持UUID)
|
||||
table.setPrimaryKeyPolicy("uuid");
|
||||
//子业务包名
|
||||
table.setEntityPackage("test2");
|
||||
//实体类名
|
||||
table.setEntityName("JeecgOrderMain");
|
||||
//功能描述
|
||||
table.setFtlDescription("订单");
|
||||
new CodeGenerateOne(table).generateCodeFile();
|
||||
System.out.println("----jeecg--------- Code------------- Generation -----[单表模型]------- 生成完成。。。");
|
||||
}
|
||||
|
||||
}
|
||||
84
jeecg-boot/src/main/java/org/jeecg/common/api/vo/Result.java
Normal file
84
jeecg-boot/src/main/java/org/jeecg/common/api/vo/Result.java
Normal file
@ -0,0 +1,84 @@
|
||||
package org.jeecg.common.api.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 接口返回数据格式
|
||||
* @author scott
|
||||
* @email jeecgos@163.com
|
||||
* @date 2019年1月19日
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
private boolean success;
|
||||
|
||||
/**
|
||||
* 返回处理消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 返回代码
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 返回数据对象 data
|
||||
*/
|
||||
private T result;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private long timestamp = System.currentTimeMillis();
|
||||
|
||||
public void error500(String message) {
|
||||
this.message = message;
|
||||
this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
|
||||
this.success = false;
|
||||
}
|
||||
|
||||
public void success(String message) {
|
||||
this.message = message;
|
||||
this.code = CommonConstant.SC_OK_200;
|
||||
this.success = true;
|
||||
}
|
||||
|
||||
public static Result<Object> error(String msg) {
|
||||
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
|
||||
}
|
||||
|
||||
public static Result<Object> error(int code, String msg) {
|
||||
Result<Object> r = new Result<Object>();
|
||||
r.setCode(code);
|
||||
r.setMessage(msg);
|
||||
r.setSuccess(false);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static Result<Object> ok(String msg) {
|
||||
Result<Object> r = new Result<Object>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage(msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static Result<Object> ok(Object obj) {
|
||||
Result<Object> r = new Result<Object>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(obj);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package org.jeecg.common.aspect;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.util.IPUtils;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.system.entity.SysLog;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.service.ISysLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 系统日志,切面处理类
|
||||
*
|
||||
* @author scott
|
||||
* @email jeecgos@163.com
|
||||
* @date 2018年1月14日
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class AutoLogAspect {
|
||||
@Autowired
|
||||
private ISysLogService sysLogService;
|
||||
|
||||
@Pointcut("@annotation(org.jeecg.common.aspect.annotation.AutoLog)")
|
||||
public void logPointCut() {
|
||||
|
||||
}
|
||||
|
||||
@Around("logPointCut()")
|
||||
public Object around(ProceedingJoinPoint point) throws Throwable {
|
||||
long beginTime = System.currentTimeMillis();
|
||||
//执行方法
|
||||
Object result = point.proceed();
|
||||
//执行时长(毫秒)
|
||||
long time = System.currentTimeMillis() - beginTime;
|
||||
|
||||
//保存日志
|
||||
saveSysLog(point, time);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
|
||||
SysLog sysLog = new SysLog();
|
||||
AutoLog syslog = method.getAnnotation(AutoLog.class);
|
||||
if(syslog != null){
|
||||
//注解上的描述,操作日志内容
|
||||
sysLog.setLogContent(syslog.value());
|
||||
sysLog.setLogType(syslog.logType());
|
||||
}
|
||||
|
||||
//请求的方法名
|
||||
String className = joinPoint.getTarget().getClass().getName();
|
||||
String methodName = signature.getName();
|
||||
sysLog.setMethod(className + "." + methodName + "()");
|
||||
|
||||
//请求的参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
try{
|
||||
String params = JSONObject.toJSONString(args);
|
||||
sysLog.setRequestParam(params);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
//设置IP地址
|
||||
sysLog.setIp(IPUtils.getIpAddr(request));
|
||||
|
||||
//获取登录用户信息
|
||||
SysUser sysUser = (SysUser)SecurityUtils.getSubject().getPrincipal();
|
||||
if(sysUser!=null){
|
||||
sysLog.setUserid(sysUser.getUsername());
|
||||
sysLog.setUsername(sysUser.getRealname());
|
||||
|
||||
}
|
||||
//耗时
|
||||
sysLog.setCostTime(time);
|
||||
sysLog.setCreateTime(new Date());
|
||||
//保存系统日志
|
||||
sysLogService.save(sysLog);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package org.jeecg.common.aspect.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
||||
/**
|
||||
* 系统日志注解
|
||||
*
|
||||
* @author scott
|
||||
* @email jeecgos@163.com
|
||||
* @date 2019年1月14日
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface AutoLog {
|
||||
|
||||
/**
|
||||
* 日志内容
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* 日志类型
|
||||
*
|
||||
* @return 0:操作日志;1:登录日志;2:定时任务;
|
||||
*/
|
||||
int logType() default CommonConstant.LOG_TYPE_2;
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package org.jeecg.common.constant;
|
||||
|
||||
public interface CommonConstant {
|
||||
|
||||
/**
|
||||
* 正常状态
|
||||
*/
|
||||
Integer STATUS_NORMAL = 0;
|
||||
|
||||
/**
|
||||
* 禁用状态
|
||||
*/
|
||||
Integer STATUS_DISABLE = -1;
|
||||
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
Integer DEL_FLAG_1 = 1;
|
||||
|
||||
/**
|
||||
* 未删除
|
||||
*/
|
||||
Integer DEL_FLAG_0 = 0;
|
||||
|
||||
/**
|
||||
* 系统日志类型: 登录
|
||||
*/
|
||||
int LOG_TYPE_1 = 1;
|
||||
|
||||
/**
|
||||
* 系统日志类型: 操作
|
||||
*/
|
||||
int LOG_TYPE_2 = 2;
|
||||
|
||||
|
||||
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
|
||||
public static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
|
||||
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
|
||||
public static final Integer SC_OK_200 = 200;
|
||||
|
||||
|
||||
public static String PREFIX_USER_ROLE = "PREFIX_USER_ROLE";
|
||||
public static String PREFIX_USER_PERMISSION = "PREFIX_USER_PERMISSION ";
|
||||
public static int TOKEN_EXPIRE_TIME = 3600;
|
||||
|
||||
public static String PREFIX_USER_TOKEN = "PREFIX_USER_TOKEN ";
|
||||
|
||||
/**
|
||||
* 0:一级菜单
|
||||
*/
|
||||
public static Integer MENU_TYPE_0 = 0;
|
||||
/**
|
||||
* 1:子菜单
|
||||
*/
|
||||
public static Integer MENU_TYPE_1 = 1;
|
||||
/**
|
||||
* 2:按钮权限
|
||||
*/
|
||||
public static Integer MENU_TYPE_2 = 2;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.jeecg.common.constant;
|
||||
|
||||
/**
|
||||
* 系统通告 - 发布状态
|
||||
* @author LeeShaoQing
|
||||
*
|
||||
*/
|
||||
public interface CommonSendStatus {
|
||||
|
||||
String UNPUBLISHED_STATUS_0 = "0"; //未发布
|
||||
|
||||
String PUBLISHED_STATUS_1 = "1"; //已发布
|
||||
|
||||
String REVOKE_STATUS_2 = "2"; //撤销
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package org.jeecg.common.exception;
|
||||
|
||||
public class JeecgBootException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JeecgBootException(String message){
|
||||
super(message);
|
||||
}
|
||||
|
||||
public JeecgBootException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public JeecgBootException(String message,Throwable cause)
|
||||
{
|
||||
super(message,cause);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package org.jeecg.common.exception;
|
||||
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 异常处理器
|
||||
*
|
||||
* @author chenshun
|
||||
* @email sunlightcs@gmail.com
|
||||
* @date 2016年10月27日 下午10:16:19
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
public class JeecgBootExceptionHandler {
|
||||
|
||||
/**
|
||||
* 处理自定义异常
|
||||
*/
|
||||
@ExceptionHandler(JeecgBootException.class)
|
||||
public Result<?> handleRRException(JeecgBootException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoHandlerFoundException.class)
|
||||
public Result<?> handlerNoFoundException(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(404, "路径不存在,请检查路径是否正确");
|
||||
}
|
||||
|
||||
@ExceptionHandler(DuplicateKeyException.class)
|
||||
public Result<?> handleDuplicateKeyException(DuplicateKeyException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("数据库中已存在该记录");
|
||||
}
|
||||
|
||||
@ExceptionHandler(AuthorizationException.class)
|
||||
public Result<?> handleAuthorizationException(AuthorizationException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result<?> handleException(Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package org.jeecg.common.system.api;
|
||||
|
||||
public interface ISysBaseAPI {
|
||||
|
||||
/**
|
||||
* 日志添加
|
||||
* @param LogContent 内容
|
||||
* @param logType 日志类型(0:操作日志;1:登录日志;2:定时任务)
|
||||
* @param operatetype 操作类型(1:添加;2:修改;3:删除;)
|
||||
*/
|
||||
void addLog(String LogContent, Integer logType, Integer operatetype);
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
package org.jeecg.common.system.controller;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author scott
|
||||
* @since 2018-12-20
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/common")
|
||||
public class CommonController {
|
||||
|
||||
@Value(value = "${uploadpath}")
|
||||
private String uploadpath;
|
||||
|
||||
@PostMapping(value = "/upload")
|
||||
public Result<SysUser> upload(HttpServletRequest request, HttpServletResponse response) {
|
||||
Result<SysUser> result = new Result<>();
|
||||
try {
|
||||
String ctxPath = uploadpath;
|
||||
String fileName = null;
|
||||
String bizPath = "user";
|
||||
String nowday = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
File file = new File(ctxPath + File.separator + bizPath + File.separator + nowday);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();// 创建文件根目录
|
||||
}
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
MultipartFile mf = multipartRequest.getFile("file");// 获取上传文件对象
|
||||
String orgName = mf.getOriginalFilename();// 获取文件名
|
||||
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
|
||||
String savePath = file.getPath() + File.separator + fileName;
|
||||
File savefile = new File(savePath);
|
||||
FileCopyUtils.copy(mf.getBytes(), savefile);
|
||||
String dbpath = bizPath + File.separator + nowday + File.separator + fileName;
|
||||
if (dbpath.contains("\\")) {
|
||||
dbpath = dbpath.replace("\\", "/");
|
||||
}
|
||||
result.setMessage(dbpath);
|
||||
result.setSuccess(true);
|
||||
} catch (IOException e) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
* 请求地址:http://localhost:8080/common/view/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg}
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping(value = "/view/**")
|
||||
public void view(HttpServletRequest request, HttpServletResponse response) {
|
||||
// ISO-8859-1 ==> UTF-8 进行编码转换
|
||||
String imgPath = extractPathFromPattern(request);
|
||||
// 其余处理略
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
imgPath = imgPath.replace("..", "");
|
||||
if (imgPath.endsWith(",")) {
|
||||
imgPath = imgPath.substring(0, imgPath.length() - 1);
|
||||
}
|
||||
response.setContentType("image/jpeg;charset=utf-8");
|
||||
String localPath = uploadpath;
|
||||
String imgurl = localPath + File.separator + imgPath;
|
||||
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
response.flushBuffer();
|
||||
} catch (IOException e) {
|
||||
log.info("预览图片失败" + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (outputStream != null) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 把指定URL后的字符串全部截断当成参数
|
||||
* 这么做是为了防止URL中包含中文或者特殊字符(/等)时,匹配不了的问题
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private static String extractPathFromPattern(final HttpServletRequest request) {
|
||||
String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
|
||||
String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
|
||||
return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path);
|
||||
}
|
||||
|
||||
}
|
||||
620
jeecg-boot/src/main/java/org/jeecg/common/util/DateUtils.java
Normal file
620
jeecg-boot/src/main/java/org/jeecg/common/util/DateUtils.java
Normal file
@ -0,0 +1,620 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* 类描述:时间操作定义类
|
||||
*
|
||||
* @author: 张代浩 @date: 日期:2012-12-8 时间:下午12:15:03
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DateUtils extends PropertyEditorSupport {
|
||||
// 各种时间格式
|
||||
public static final SimpleDateFormat date_sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// 各种时间格式
|
||||
public static final SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
|
||||
// 各种时间格式
|
||||
public static final SimpleDateFormat date_sdf_wz = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
public static final SimpleDateFormat time_sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
public static final SimpleDateFormat yyyymmddhhmmss = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
public static final SimpleDateFormat short_time_sdf = new SimpleDateFormat("HH:mm");
|
||||
public static final SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// 以毫秒表示的时间
|
||||
private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
|
||||
private static final long HOUR_IN_MILLIS = 3600 * 1000;
|
||||
private static final long MINUTE_IN_MILLIS = 60 * 1000;
|
||||
private static final long SECOND_IN_MILLIS = 1000;
|
||||
|
||||
// 指定模式的时间格式
|
||||
private static SimpleDateFormat getSDFormat(String pattern) {
|
||||
return new SimpleDateFormat(pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前日历,这里用中国时间表示
|
||||
*
|
||||
* @return 以当地时区表示的系统当前日历
|
||||
*/
|
||||
public static Calendar getCalendar() {
|
||||
return Calendar.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示的日历
|
||||
*
|
||||
* @param millis 毫秒数
|
||||
* @return 指定毫秒数表示的日历
|
||||
*/
|
||||
public static Calendar getCalendar(long millis) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
// --------------------cal.setTimeInMillis(millis);
|
||||
cal.setTime(new Date(millis));
|
||||
return cal;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// getDate
|
||||
// 各种方式获取的Date
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 当前日期
|
||||
*
|
||||
* @return 系统当前时间
|
||||
*/
|
||||
public static Date getDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示的日期
|
||||
*
|
||||
* @param millis 毫秒数
|
||||
* @return 指定毫秒数表示的日期
|
||||
*/
|
||||
public static Date getDate(long millis) {
|
||||
return new Date(millis);
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间戳转换为字符串
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static String timestamptoStr(Timestamp time) {
|
||||
Date date = null;
|
||||
if (null != time) {
|
||||
date = new Date(time.getTime());
|
||||
}
|
||||
return date2Str(date_sdf);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转换时间戳
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static Timestamp str2Timestamp(String str) {
|
||||
Date date = str2Date(str, date_sdf);
|
||||
return new Timestamp(date.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转换成日期
|
||||
*
|
||||
* @param str
|
||||
* @param sdf
|
||||
* @return
|
||||
*/
|
||||
public static Date str2Date(String str, SimpleDateFormat sdf) {
|
||||
if (null == str || "".equals(str)) {
|
||||
return null;
|
||||
}
|
||||
Date date = null;
|
||||
try {
|
||||
date = sdf.parse(str);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为字符串
|
||||
*
|
||||
* @param date 日期
|
||||
* @param format 日期格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String date2Str(SimpleDateFormat date_sdf) {
|
||||
Date date = getDate();
|
||||
if (null == date) {
|
||||
return null;
|
||||
}
|
||||
return date_sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间
|
||||
*
|
||||
* @param date
|
||||
* @param format
|
||||
* @return
|
||||
*/
|
||||
public static String dateformat(String date, String format) {
|
||||
SimpleDateFormat sformat = new SimpleDateFormat(format);
|
||||
Date _date = null;
|
||||
try {
|
||||
_date = sformat.parse(date);
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sformat.format(_date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为字符串
|
||||
*
|
||||
* @param date 日期
|
||||
* @param format 日期格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String date2Str(Date date, SimpleDateFormat date_sdf) {
|
||||
if (null == date) {
|
||||
return null;
|
||||
}
|
||||
return date_sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为字符串
|
||||
*
|
||||
* @param date 日期
|
||||
* @param format 日期格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String getDate(String format) {
|
||||
Date date = new Date();
|
||||
if (null == date) {
|
||||
return null;
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数的时间戳
|
||||
*
|
||||
* @param millis 毫秒数
|
||||
* @return 指定毫秒数的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp(long millis) {
|
||||
return new Timestamp(millis);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字符形式表示的时间戳
|
||||
*
|
||||
* @param time 毫秒数
|
||||
* @return 以字符形式表示的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp(String time) {
|
||||
return new Timestamp(Long.parseLong(time));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统当前的时间戳
|
||||
*
|
||||
* @return 系统当前的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp() {
|
||||
return new Timestamp(new Date().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前时间,格式 yyyy-MM-dd HH:mm:ss
|
||||
*
|
||||
* @return 当前时间的标准形式字符串
|
||||
*/
|
||||
public static String now() {
|
||||
return datetimeFormat.format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的时间戳
|
||||
*
|
||||
* @param date 指定日期
|
||||
* @return 指定日期的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp(Date date) {
|
||||
return new Timestamp(date.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日历的时间戳
|
||||
*
|
||||
* @param cal 指定日历
|
||||
* @return 指定日历的时间戳
|
||||
*/
|
||||
public static Timestamp getCalendarTimestamp(Calendar cal) {
|
||||
// ---------------------return new Timestamp(cal.getTimeInMillis());
|
||||
return new Timestamp(cal.getTime().getTime());
|
||||
}
|
||||
|
||||
public static Timestamp gettimestamp() {
|
||||
Date dt = new Date();
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String nowTime = df.format(dt);
|
||||
java.sql.Timestamp buydate = java.sql.Timestamp.valueOf(nowTime);
|
||||
return buydate;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// getMillis
|
||||
// 各种方式获取的Millis
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 系统时间的毫秒数
|
||||
*
|
||||
* @return 系统时间的毫秒数
|
||||
*/
|
||||
public static long getMillis() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日历的毫秒数
|
||||
*
|
||||
* @param cal 指定日历
|
||||
* @return 指定日历的毫秒数
|
||||
*/
|
||||
public static long getMillis(Calendar cal) {
|
||||
// --------------------return cal.getTimeInMillis();
|
||||
return cal.getTime().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的毫秒数
|
||||
*
|
||||
* @param date 指定日期
|
||||
* @return 指定日期的毫秒数
|
||||
*/
|
||||
public static long getMillis(Date date) {
|
||||
return date.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定时间戳的毫秒数
|
||||
*
|
||||
* @param ts 指定时间戳
|
||||
* @return 指定时间戳的毫秒数
|
||||
*/
|
||||
public static long getMillis(Timestamp ts) {
|
||||
return ts.getTime();
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// formatDate
|
||||
// 将日期按照一定的格式转化为字符串
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:年-月-日
|
||||
*
|
||||
* @return 默认日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate() {
|
||||
return date_sdf.format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:yyyy-MM-dd HH:mm:ss
|
||||
*
|
||||
* @return 默认日期按“yyyy-MM-dd HH:mm:ss“格式显示
|
||||
*/
|
||||
public static String formatDateTime() {
|
||||
return datetimeFormat.format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时间字符串
|
||||
*/
|
||||
public static String getDataString(SimpleDateFormat formatstr) {
|
||||
return formatstr.format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @return 指定日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate(Calendar cal) {
|
||||
return date_sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @return 指定日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate(Date date) {
|
||||
return date_sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示日期的默认显示,具体格式:年-月-日
|
||||
*
|
||||
* @param millis 指定的毫秒数
|
||||
* @return 指定毫秒数表示日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate(long millis) {
|
||||
return date_sdf.format(new Date(millis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认日期按指定格式显示
|
||||
*
|
||||
* @param pattern 指定的格式
|
||||
* @return 默认日期按指定格式显示
|
||||
*/
|
||||
public static String formatDate(String pattern) {
|
||||
return getSDFormat(pattern).format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期按指定格式显示
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @param pattern 指定的格式
|
||||
* @return 指定日期按指定格式显示
|
||||
*/
|
||||
public static String formatDate(Calendar cal, String pattern) {
|
||||
return getSDFormat(pattern).format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期按指定格式显示
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @param pattern 指定的格式
|
||||
* @return 指定日期按指定格式显示
|
||||
*/
|
||||
public static String formatDate(Date date, String pattern) {
|
||||
return getSDFormat(pattern).format(date);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// formatTime
|
||||
// 将日期按照一定的格式转化为字符串
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @return 默认日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime() {
|
||||
return time_sdf.format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示日期的默认显示,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @param millis 指定的毫秒数
|
||||
* @return 指定毫秒数表示日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime(long millis) {
|
||||
return time_sdf.format(new Date(millis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @return 指定日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime(Calendar cal) {
|
||||
return time_sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @return 指定日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime(Date date) {
|
||||
return time_sdf.format(date);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// formatShortTime
|
||||
// 将日期按照一定的格式转化为字符串
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:时:分
|
||||
*
|
||||
* @return 默认日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime() {
|
||||
return short_time_sdf.format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示日期的默认显示,具体格式:时:分
|
||||
*
|
||||
* @param millis 指定的毫秒数
|
||||
* @return 指定毫秒数表示日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime(long millis) {
|
||||
return short_time_sdf.format(new Date(millis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:时:分
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @return 指定日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime(Calendar cal) {
|
||||
return short_time_sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:时:分
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @return 指定日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime(Date date) {
|
||||
return short_time_sdf.format(date);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// parseDate
|
||||
// parseCalendar
|
||||
// parseTimestamp
|
||||
// 将字符串按照一定的格式转化为日期或时间
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
|
||||
*
|
||||
* @param src 将要转换的原始字符窜
|
||||
* @param pattern 转换的匹配格式
|
||||
* @return 如果转换成功则返回转换后的日期
|
||||
* @throws ParseException
|
||||
* @throws AIDateFormatException
|
||||
*/
|
||||
public static Date parseDate(String src, String pattern) throws ParseException {
|
||||
return getSDFormat(pattern).parse(src);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
|
||||
*
|
||||
* @param src 将要转换的原始字符窜
|
||||
* @param pattern 转换的匹配格式
|
||||
* @return 如果转换成功则返回转换后的日期
|
||||
* @throws ParseException
|
||||
* @throws AIDateFormatException
|
||||
*/
|
||||
public static Calendar parseCalendar(String src, String pattern) throws ParseException {
|
||||
|
||||
Date date = parseDate(src, pattern);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
return cal;
|
||||
}
|
||||
|
||||
public static String formatAddDate(String src, String pattern, int amount) throws ParseException {
|
||||
Calendar cal;
|
||||
cal = parseCalendar(src, pattern);
|
||||
cal.add(Calendar.DATE, amount);
|
||||
return formatDate(cal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
|
||||
*
|
||||
* @param src 将要转换的原始字符窜
|
||||
* @param pattern 转换的匹配格式
|
||||
* @return 如果转换成功则返回转换后的时间戳
|
||||
* @throws ParseException
|
||||
* @throws AIDateFormatException
|
||||
*/
|
||||
public static Timestamp parseTimestamp(String src, String pattern) throws ParseException {
|
||||
Date date = parseDate(src, pattern);
|
||||
return new Timestamp(date.getTime());
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// dateDiff
|
||||
// 计算两个日期之间的差值
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 计算两个时间之间的差值,根据标志的不同而不同
|
||||
*
|
||||
* @param flag 计算标志,表示按照年/月/日/时/分/秒等计算
|
||||
* @param calSrc 减数
|
||||
* @param calDes 被减数
|
||||
* @return 两个日期之间的差值
|
||||
*/
|
||||
public static int dateDiff(char flag, Calendar calSrc, Calendar calDes) {
|
||||
|
||||
long millisDiff = getMillis(calSrc) - getMillis(calDes);
|
||||
|
||||
if (flag == 'y') {
|
||||
return (calSrc.get(calSrc.YEAR) - calDes.get(calDes.YEAR));
|
||||
}
|
||||
|
||||
if (flag == 'd') {
|
||||
return (int) (millisDiff / DAY_IN_MILLIS);
|
||||
}
|
||||
|
||||
if (flag == 'h') {
|
||||
return (int) (millisDiff / HOUR_IN_MILLIS);
|
||||
}
|
||||
|
||||
if (flag == 'm') {
|
||||
return (int) (millisDiff / MINUTE_IN_MILLIS);
|
||||
}
|
||||
|
||||
if (flag == 's') {
|
||||
return (int) (millisDiff / SECOND_IN_MILLIS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
|
||||
* HH:mm:ss“ * @param text String类型的时间值
|
||||
*/
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
if (StringUtils.hasText(text)) {
|
||||
try {
|
||||
if (text.indexOf(":") == -1 && text.length() == 10) {
|
||||
setValue(this.date_sdf.parse(text));
|
||||
} else if (text.indexOf(":") > 0 && text.length() == 19) {
|
||||
setValue(this.datetimeFormat.parse(text));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Could not parse date, date format is error ");
|
||||
}
|
||||
} catch (ParseException ex) {
|
||||
IllegalArgumentException iae = new IllegalArgumentException("Could not parse date: " + ex.getMessage());
|
||||
iae.initCause(ex);
|
||||
throw iae;
|
||||
}
|
||||
} else {
|
||||
setValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getYear() {
|
||||
GregorianCalendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(getDate());
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
}
|
||||
58
jeecg-boot/src/main/java/org/jeecg/common/util/IPUtils.java
Normal file
58
jeecg-boot/src/main/java/org/jeecg/common/util/IPUtils.java
Normal file
@ -0,0 +1,58 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*
|
||||
* @author scott
|
||||
* @email jeecgos@163.com
|
||||
* @date 2019年01月14日
|
||||
*/
|
||||
public class IPUtils {
|
||||
private static Logger logger = LoggerFactory.getLogger(IPUtils.class);
|
||||
|
||||
/**
|
||||
* 获取IP地址
|
||||
*
|
||||
* 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址
|
||||
* 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址
|
||||
*/
|
||||
public static String getIpAddr(HttpServletRequest request) {
|
||||
String ip = null;
|
||||
try {
|
||||
ip = request.getHeader("x-forwarded-for");
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_CLIENT_IP");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("IPUtils ERROR ", e);
|
||||
}
|
||||
|
||||
// //使用代理,则获取第一个IP地址
|
||||
// if(StringUtils.isEmpty(ip) && ip.length() > 15) {
|
||||
// if(ip.indexOf(",") > 0) {
|
||||
// ip = ip.substring(0, ip.indexOf(","));
|
||||
// }
|
||||
// }
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
}
|
||||
41
jeecg-boot/src/main/java/org/jeecg/common/util/MD5Util.java
Normal file
41
jeecg-boot/src/main/java/org/jeecg/common/util/MD5Util.java
Normal file
@ -0,0 +1,41 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
public class MD5Util {
|
||||
|
||||
public static String byteArrayToHexString(byte b[]) {
|
||||
StringBuffer resultSb = new StringBuffer();
|
||||
for (int i = 0; i < b.length; i++)
|
||||
resultSb.append(byteToHexString(b[i]));
|
||||
|
||||
return resultSb.toString();
|
||||
}
|
||||
|
||||
private static String byteToHexString(byte b) {
|
||||
int n = b;
|
||||
if (n < 0)
|
||||
n += 256;
|
||||
int d1 = n / 16;
|
||||
int d2 = n % 16;
|
||||
return hexDigits[d1] + hexDigits[d2];
|
||||
}
|
||||
|
||||
public static String MD5Encode(String origin, String charsetname) {
|
||||
String resultString = null;
|
||||
try {
|
||||
resultString = new String(origin);
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
if (charsetname == null || "".equals(charsetname))
|
||||
resultString = byteArrayToHexString(md.digest(resultString.getBytes()));
|
||||
else
|
||||
resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname)));
|
||||
} catch (Exception exception) {
|
||||
}
|
||||
return resultString;
|
||||
}
|
||||
|
||||
private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5",
|
||||
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
|
||||
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
/**
|
||||
* @author 张代浩
|
||||
*/
|
||||
public class MyClassLoader extends ClassLoader {
|
||||
public static Class getClassByScn(String className) {
|
||||
Class myclass = null;
|
||||
try {
|
||||
myclass = Class.forName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(className+" not found!");
|
||||
}
|
||||
return myclass;
|
||||
}
|
||||
|
||||
// 获得类的全名,包括包名
|
||||
public static String getPackPath(Object object) {
|
||||
// 检查用户传入的参数是否为空
|
||||
if (object == null)
|
||||
throw new java.lang.IllegalArgumentException("参数不能为空!");
|
||||
// 获得类的全名,包括包名
|
||||
String clsName = object.getClass().getName();
|
||||
return clsName;
|
||||
}
|
||||
|
||||
public static String getAppPath(Class cls) {
|
||||
// 检查用户传入的参数是否为空
|
||||
if (cls == null)
|
||||
throw new java.lang.IllegalArgumentException("参数不能为空!");
|
||||
ClassLoader loader = cls.getClassLoader();
|
||||
// 获得类的全名,包括包名
|
||||
String clsName = cls.getName() + ".class";
|
||||
// 获得传入参数所在的包
|
||||
Package pack = cls.getPackage();
|
||||
String path = "";
|
||||
// 如果不是匿名包,将包名转化为路径
|
||||
if (pack != null) {
|
||||
String packName = pack.getName();
|
||||
// 此处简单判定是否是Java基础类库,防止用户传入JDK内置的类库
|
||||
if (packName.startsWith("java.") || packName.startsWith("javax."))
|
||||
throw new java.lang.IllegalArgumentException("不要传送系统类!");
|
||||
// 在类的名称中,去掉包名的部分,获得类的文件名
|
||||
clsName = clsName.substring(packName.length() + 1);
|
||||
// 判定包名是否是简单包名,如果是,则直接将包名转换为路径,
|
||||
if (packName.indexOf(".") < 0)
|
||||
path = packName + "/";
|
||||
else {// 否则按照包名的组成部分,将包名转换为路径
|
||||
int start = 0, end = 0;
|
||||
end = packName.indexOf(".");
|
||||
while (end != -1) {
|
||||
path = path + packName.substring(start, end) + "/";
|
||||
start = end + 1;
|
||||
end = packName.indexOf(".", start);
|
||||
}
|
||||
path = path + packName.substring(start) + "/";
|
||||
}
|
||||
}
|
||||
// 调用ClassLoader的getResource方法,传入包含路径信息的类文件名
|
||||
java.net.URL url = loader.getResource(path + clsName);
|
||||
// 从URL对象中获取路径信息
|
||||
String realPath = url.getPath();
|
||||
// 去掉路径信息中的协议名"file:"
|
||||
int pos = realPath.indexOf("file:");
|
||||
if (pos > -1)
|
||||
realPath = realPath.substring(pos + 5);
|
||||
// 去掉路径信息最后包含类文件信息的部分,得到类所在的路径
|
||||
pos = realPath.indexOf(path + clsName);
|
||||
realPath = realPath.substring(0, pos - 1);
|
||||
// 如果类文件被打包到JAR等文件中时,去掉对应的JAR等打包文件名
|
||||
if (realPath.endsWith("!"))
|
||||
realPath = realPath.substring(0, realPath.lastIndexOf("/"));
|
||||
/*------------------------------------------------------------
|
||||
ClassLoader的getResource方法使用了utf-8对路径信息进行了编码,当路径
|
||||
中存在中文和空格时,他会对这些字符进行转换,这样,得到的往往不是我们想要
|
||||
的真实路径,在此,调用了URLDecoder的decode方法进行解码,以便得到原始的
|
||||
中文及空格路径
|
||||
-------------------------------------------------------------*/
|
||||
try {
|
||||
realPath = java.net.URLDecoder.decode(realPath, "utf-8");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return realPath;
|
||||
}// getAppPath定义结束
|
||||
}
|
||||
179
jeecg-boot/src/main/java/org/jeecg/common/util/PasswordUtil.java
Normal file
179
jeecg-boot/src/main/java/org/jeecg/common/util/PasswordUtil.java
Normal file
@ -0,0 +1,179 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import java.security.Key;
|
||||
import java.security.SecureRandom;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.PBEParameterSpec;
|
||||
public class PasswordUtil {
|
||||
|
||||
/**
|
||||
* JAVA6支持以下任意一种算法 PBEWITHMD5ANDDES PBEWITHMD5ANDTRIPLEDES
|
||||
* PBEWITHSHAANDDESEDE PBEWITHSHA1ANDRC2_40 PBKDF2WITHHMACSHA1
|
||||
* */
|
||||
|
||||
/**
|
||||
* 定义使用的算法为:PBEWITHMD5andDES算法
|
||||
*/
|
||||
public static final String ALGORITHM = "PBEWithMD5AndDES";//加密算法
|
||||
public static final String Salt = "63293188";//密钥
|
||||
|
||||
/**
|
||||
* 定义迭代次数为1000次
|
||||
*/
|
||||
private static final int ITERATIONCOUNT = 1000;
|
||||
|
||||
/**
|
||||
* 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作. 盐长度必须为8字节
|
||||
*
|
||||
* @return byte[] 盐值
|
||||
* */
|
||||
public static byte[] getSalt() throws Exception {
|
||||
// 实例化安全随机数
|
||||
SecureRandom random = new SecureRandom();
|
||||
// 产出盐
|
||||
return random.generateSeed(8);
|
||||
}
|
||||
|
||||
public static byte[] getStaticSalt() {
|
||||
// 产出盐
|
||||
return Salt.getBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据PBE密码生成一把密钥
|
||||
*
|
||||
* @param password
|
||||
* 生成密钥时所使用的密码
|
||||
* @return Key PBE算法密钥
|
||||
* */
|
||||
private static Key getPBEKey(String password) {
|
||||
// 实例化使用的算法
|
||||
SecretKeyFactory keyFactory;
|
||||
SecretKey secretKey = null;
|
||||
try {
|
||||
keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
|
||||
// 设置PBE密钥参数
|
||||
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
|
||||
// 生成密钥
|
||||
secretKey = keyFactory.generateSecret(keySpec);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密明文字符串
|
||||
*
|
||||
* @param plaintext
|
||||
* 待加密的明文字符串
|
||||
* @param password
|
||||
* 生成密钥时所使用的密码
|
||||
* @param salt
|
||||
* 盐值
|
||||
* @return 加密后的密文字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encrypt(String plaintext, String password, String salt) {
|
||||
|
||||
Key key = getPBEKey(password);
|
||||
byte[] encipheredData = null;
|
||||
PBEParameterSpec parameterSpec = new PBEParameterSpec(salt.getBytes(), ITERATIONCOUNT);
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key, parameterSpec);
|
||||
|
||||
encipheredData = cipher.doFinal(plaintext.getBytes());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return bytesToHexString(encipheredData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密密文字符串
|
||||
*
|
||||
* @param ciphertext
|
||||
* 待解密的密文字符串
|
||||
* @param password
|
||||
* 生成密钥时所使用的密码(如需解密,该参数需要与加密时使用的一致)
|
||||
* @param salt
|
||||
* 盐值(如需解密,该参数需要与加密时使用的一致)
|
||||
* @return 解密后的明文字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decrypt(String ciphertext, String password, String salt) {
|
||||
|
||||
Key key = getPBEKey(password);
|
||||
byte[] passDec = null;
|
||||
PBEParameterSpec parameterSpec = new PBEParameterSpec(salt.getBytes(), ITERATIONCOUNT);
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
|
||||
cipher.init(Cipher.DECRYPT_MODE, key, parameterSpec);
|
||||
|
||||
passDec = cipher.doFinal(hexStringToBytes(ciphertext));
|
||||
}
|
||||
|
||||
catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return new String(passDec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字节数组转换为十六进制字符串
|
||||
*
|
||||
* @param src
|
||||
* 字节数组
|
||||
* @return
|
||||
*/
|
||||
public static String bytesToHexString(byte[] src) {
|
||||
StringBuilder stringBuilder = new StringBuilder("");
|
||||
if (src == null || src.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < src.length; i++) {
|
||||
int v = src[i] & 0xFF;
|
||||
String hv = Integer.toHexString(v);
|
||||
if (hv.length() < 2) {
|
||||
stringBuilder.append(0);
|
||||
}
|
||||
stringBuilder.append(hv);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将十六进制字符串转换为字节数组
|
||||
*
|
||||
* @param hexString
|
||||
* 十六进制字符串
|
||||
* @return
|
||||
*/
|
||||
public static byte[] hexStringToBytes(String hexString) {
|
||||
if (hexString == null || hexString.equals("")) {
|
||||
return null;
|
||||
}
|
||||
hexString = hexString.toUpperCase();
|
||||
int length = hexString.length() / 2;
|
||||
char[] hexChars = hexString.toCharArray();
|
||||
byte[] d = new byte[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
int pos = i * 2;
|
||||
d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
private static byte charToByte(char c) {
|
||||
return (byte) "0123456789ABCDEF".indexOf(c);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
571
jeecg-boot/src/main/java/org/jeecg/common/util/RedisUtil.java
Normal file
571
jeecg-boot/src/main/java/org/jeecg/common/util/RedisUtil.java
Normal file
@ -0,0 +1,571 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* redis 工具类
|
||||
* @author Scott
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class RedisUtil {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
/**
|
||||
* 指定缓存失效时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean expire(String key, long time) {
|
||||
try {
|
||||
if (time > 0) {
|
||||
redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key 获取过期时间
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @return 时间(秒) 返回0代表为永久有效
|
||||
*/
|
||||
public long getExpire(String key) {
|
||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断key是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hasKey(String key) {
|
||||
try {
|
||||
return redisTemplate.hasKey(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
*
|
||||
* @param key 可以传一个值 或多个
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void del(String... key) {
|
||||
if (key != null && key.length > 0) {
|
||||
if (key.length == 1) {
|
||||
redisTemplate.delete(key[0]);
|
||||
} else {
|
||||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================String=============================
|
||||
/**
|
||||
* 普通缓存获取
|
||||
*
|
||||
* @param key 键
|
||||
* @return 值
|
||||
*/
|
||||
public Object get(String key) {
|
||||
return key == null ? null : redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通缓存放入
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return true成功 false失败
|
||||
*/
|
||||
public boolean set(String key, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通缓存放入并设置时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
|
||||
* @return true成功 false 失败
|
||||
*/
|
||||
public boolean set(String key, Object value, long time) {
|
||||
try {
|
||||
if (time > 0) {
|
||||
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
||||
} else {
|
||||
set(key, value);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递增
|
||||
*
|
||||
* @param key 键
|
||||
* @param by 要增加几(大于0)
|
||||
* @return
|
||||
*/
|
||||
public long incr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递增因子必须大于0");
|
||||
}
|
||||
return redisTemplate.opsForValue().increment(key, delta);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递减
|
||||
*
|
||||
* @param key 键
|
||||
* @param by 要减少几(小于0)
|
||||
* @return
|
||||
*/
|
||||
public long decr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递减因子必须大于0");
|
||||
}
|
||||
return redisTemplate.opsForValue().increment(key, -delta);
|
||||
}
|
||||
|
||||
// ================================Map=================================
|
||||
/**
|
||||
* HashGet
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 不能为null
|
||||
* @return 值
|
||||
*/
|
||||
public Object hget(String key, String item) {
|
||||
return redisTemplate.opsForHash().get(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取hashKey对应的所有键值
|
||||
*
|
||||
* @param key 键
|
||||
* @return 对应的多个键值
|
||||
*/
|
||||
public Map<Object, Object> hmget(String key) {
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* HashSet
|
||||
*
|
||||
* @param key 键
|
||||
* @param map 对应多个键值
|
||||
* @return true 成功 false 失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HashSet 并设置时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param map 对应多个键值
|
||||
* @param time 时间(秒)
|
||||
* @return true成功 false失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向一张hash表中放入数据,如果不存在将创建
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param value 值
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向一张hash表中放入数据,如果不存在将创建
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param value 值
|
||||
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除hash表中的值
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 可以使多个 不能为null
|
||||
*/
|
||||
public void hdel(String key, Object... item) {
|
||||
redisTemplate.opsForHash().delete(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断hash表中是否有该项的值
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 不能为null
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hHasKey(String key, String item) {
|
||||
return redisTemplate.opsForHash().hasKey(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param by 要增加几(大于0)
|
||||
* @return
|
||||
*/
|
||||
public double hincr(String key, String item, double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, by);
|
||||
}
|
||||
|
||||
/**
|
||||
* hash递减
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param by 要减少记(小于0)
|
||||
* @return
|
||||
*/
|
||||
public double hdecr(String key, String item, double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
||||
}
|
||||
|
||||
// ============================set=============================
|
||||
/**
|
||||
* 根据key获取Set中的所有值
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public Set<Object> sGet(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据value从一个set中查询,是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean sHasKey(String key, Object value) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().isMember(key, value);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据放入set缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param values 值 可以是多个
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSet(String key, Object... values) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().add(key, values);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将set数据放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param time 时间(秒)
|
||||
* @param values 值 可以是多个
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSetAndTime(String key, long time, Object... values) {
|
||||
try {
|
||||
Long count = redisTemplate.opsForSet().add(key, values);
|
||||
if (time > 0)
|
||||
expire(key, time);
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取set缓存的长度
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long sGetSetSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().size(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除值为value的
|
||||
*
|
||||
* @param key 键
|
||||
* @param values 值 可以是多个
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long setRemove(String key, Object... values) {
|
||||
try {
|
||||
Long count = redisTemplate.opsForSet().remove(key, values);
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// ===============================list=================================
|
||||
|
||||
/**
|
||||
* 获取list缓存的内容
|
||||
*
|
||||
* @param key 键
|
||||
* @param start 开始
|
||||
* @param end 结束 0 到 -1代表所有值
|
||||
* @return
|
||||
*/
|
||||
public List<Object> lGet(String key, long start, long end) {
|
||||
try {
|
||||
return redisTemplate.opsForList().range(key, start, end);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取list缓存的长度
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long lGetListSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForList().size(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过索引 获取list中的值
|
||||
*
|
||||
* @param key 键
|
||||
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
|
||||
* @return
|
||||
*/
|
||||
public Object lGetIndex(String key, long index) {
|
||||
try {
|
||||
return redisTemplate.opsForList().index(key, index);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
if (time > 0)
|
||||
expire(key, time);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, List<Object> value) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPushAll(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, List<Object> value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPushAll(key, value);
|
||||
if (time > 0)
|
||||
expire(key, time);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据索引修改list中的某条数据
|
||||
*
|
||||
* @param key 键
|
||||
* @param index 索引
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public boolean lUpdateIndex(String key, long index, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForList().set(key, index, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除N个值为value
|
||||
*
|
||||
* @param key 键
|
||||
* @param count 移除多少个
|
||||
* @param value 值
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long lRemove(String key, long count, Object value) {
|
||||
try {
|
||||
Long remove = redisTemplate.opsForList().remove(key, count, value);
|
||||
return remove;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
@Component
|
||||
public class SpringContextUtils implements ApplicationContextAware {
|
||||
|
||||
/**
|
||||
* 上下文对象实例
|
||||
*/
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取applicationContext
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取HttpServletRequest
|
||||
*/
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
}
|
||||
|
||||
public static String getDomain(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
|
||||
}
|
||||
|
||||
public static String getOrigin(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
return request.getHeader("Origin");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过name获取 Bean.
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Object getBean(String name) {
|
||||
return getApplicationContext().getBean(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过class获取Bean.
|
||||
*
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return getApplicationContext().getBean(clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过name,以及Clazz返回指定的Bean
|
||||
*
|
||||
* @param name
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> T getBean(String name, Class<T> clazz) {
|
||||
return getApplicationContext().getBean(name, clazz);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,173 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import io.netty.util.internal.StringUtil;
|
||||
|
||||
/**
|
||||
* 流水号生成规则(按默认规则递增,数字从1-99开始递增,数字到99,递增字母;位数不够增加位数)
|
||||
* A001
|
||||
* A001A002
|
||||
* @author zhangdaihao
|
||||
*
|
||||
*/
|
||||
public class YouBianCodeUtil {
|
||||
|
||||
// 数字位数(默认生成3位的数字)
|
||||
|
||||
private static final int numLength = 2;//代表数字位数
|
||||
|
||||
public static final int zhanweiLength = 1+numLength;
|
||||
|
||||
/**
|
||||
* 根据前一个code,获取同级下一个code
|
||||
* 例如:当前最大code为D01A04,下一个code为:D01A05
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String getNextYouBianCode(String code) {
|
||||
String newcode = "";
|
||||
if (code == null || code =="") {
|
||||
String zimu = "A";
|
||||
String num = getStrNum(1);
|
||||
newcode = zimu + num;
|
||||
} else {
|
||||
String before_code = code.substring(0, code.length() - 1- numLength);
|
||||
String after_code = code.substring(code.length() - 1 - numLength,code.length());
|
||||
char after_code_zimu = after_code.substring(0, 1).charAt(0);
|
||||
Integer after_code_num = Integer.parseInt(after_code.substring(1));
|
||||
// org.jeecgframework.core.util.LogUtil.info(after_code);
|
||||
// org.jeecgframework.core.util.LogUtil.info(after_code_zimu);
|
||||
// org.jeecgframework.core.util.LogUtil.info(after_code_num);
|
||||
|
||||
String nextNum = "";
|
||||
char nextZimu = 'A';
|
||||
// 先判断数字等于999*,则计数从1重新开始,递增
|
||||
if (after_code_num == getMaxNumByLength(numLength)) {
|
||||
nextNum = getNextStrNum(0);
|
||||
} else {
|
||||
nextNum = getNextStrNum(after_code_num);
|
||||
}
|
||||
// 先判断数字等于999*,则字母从A重新开始,递增
|
||||
if(after_code_num == getMaxNumByLength(numLength)) {
|
||||
nextZimu = getNextZiMu(after_code_zimu);
|
||||
}else{
|
||||
nextZimu = after_code_zimu;
|
||||
}
|
||||
|
||||
// 例如Z99,下一个code就是Z99A01
|
||||
if ('Z' == after_code_zimu && getMaxNumByLength(numLength) == after_code_num) {
|
||||
newcode = code + (nextZimu + nextNum);
|
||||
} else {
|
||||
newcode = before_code + (nextZimu + nextNum);
|
||||
}
|
||||
}
|
||||
return newcode;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父亲code,获取下级的下一个code
|
||||
*
|
||||
* 例如:父亲CODE:A01
|
||||
* 当前CODE:A01B03
|
||||
* 获取的code:A01B04
|
||||
*
|
||||
* @param parentCode 上级code
|
||||
* @param localCode 同级code
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String getSubYouBianCode(String parentCode,String localCode) {
|
||||
if(localCode!=null && localCode!=""){
|
||||
|
||||
// return parentCode + getNextYouBianCode(localCode);
|
||||
return getNextYouBianCode(localCode);
|
||||
|
||||
}else{
|
||||
parentCode = parentCode + "A"+ getNextStrNum(0);
|
||||
}
|
||||
return parentCode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将数字前面位数补零
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static String getNextStrNum(int num) {
|
||||
return getStrNum(getNextNum(num));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数字前面位数补零
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static String getStrNum(int num) {
|
||||
String s = String.format("%0" + numLength + "d", num);
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递增获取下个数字
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static int getNextNum(int num) {
|
||||
num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递增获取下个字母
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private static char getNextZiMu(char zimu) {
|
||||
if (zimu == 'Z') {
|
||||
return 'A';
|
||||
}
|
||||
zimu++;
|
||||
return zimu;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数字位数获取最大值
|
||||
* @param length
|
||||
* @return
|
||||
*/
|
||||
private static int getMaxNumByLength(int length){
|
||||
if(length==0){
|
||||
return 0;
|
||||
}
|
||||
String max_num = "";
|
||||
for (int i=0;i<length;i++){
|
||||
max_num = max_num + "9";
|
||||
}
|
||||
return Integer.parseInt(max_num);
|
||||
}
|
||||
public static String[] cutYouBianCode(String code){
|
||||
if(code==null || StringUtil.isNullOrEmpty(code)){
|
||||
return null;
|
||||
}else{
|
||||
//获取标准长度为numLength+1,截取的数量为code.length/numLength+1
|
||||
int c = code.length()/(numLength+1);
|
||||
String[] cutcode = new String[c];
|
||||
for(int i =0 ; i <c;i++){
|
||||
cutcode[i] = code.substring(0,(i+1)*(numLength+1));
|
||||
}
|
||||
return cutcode;
|
||||
}
|
||||
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
// org.jeecgframework.core.util.LogUtil.info(getNextZiMu('C'));
|
||||
// org.jeecgframework.core.util.LogUtil.info(getNextNum(8));
|
||||
// org.jeecgframework.core.util.LogUtil.info(cutYouBianCode("C99A01B01")[2]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,535 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.sql.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 张代浩
|
||||
*
|
||||
*/
|
||||
public class oConvertUtils {
|
||||
public static boolean isEmpty(Object object) {
|
||||
if (object == null) {
|
||||
return (true);
|
||||
}
|
||||
if (object.equals("")) {
|
||||
return (true);
|
||||
}
|
||||
if (object.equals("null")) {
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
public static boolean isNotEmpty(Object object) {
|
||||
if (object != null && !object.equals("") && !object.equals("null")) {
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
public static String decode(String strIn, String sourceCode, String targetCode) {
|
||||
String temp = code2code(strIn, sourceCode, targetCode);
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static String StrToUTF(String strIn, String sourceCode, String targetCode) {
|
||||
strIn = "";
|
||||
try {
|
||||
strIn = new String(strIn.getBytes("ISO-8859-1"), "GBK");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return strIn;
|
||||
|
||||
}
|
||||
|
||||
private static String code2code(String strIn, String sourceCode, String targetCode) {
|
||||
String strOut = null;
|
||||
if (strIn == null || (strIn.trim()).equals(""))
|
||||
return strIn;
|
||||
try {
|
||||
byte[] b = strIn.getBytes(sourceCode);
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
System.out.print(b[i] + " ");
|
||||
}
|
||||
strOut = new String(b, targetCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return strOut;
|
||||
}
|
||||
|
||||
public static int getInt(String s, int defval) {
|
||||
if (s == null || s == "") {
|
||||
return (defval);
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return (defval);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(String s) {
|
||||
if (s == null || s == "") {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(String s, Integer df) {
|
||||
if (s == null || s == "") {
|
||||
return df;
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer[] getInts(String[] s) {
|
||||
Integer[] integer = new Integer[s.length];
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
integer[i] = Integer.parseInt(s[i]);
|
||||
}
|
||||
return integer;
|
||||
|
||||
}
|
||||
|
||||
public static double getDouble(String s, double defval) {
|
||||
if (s == null || s == "") {
|
||||
return (defval);
|
||||
}
|
||||
try {
|
||||
return (Double.parseDouble(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return (defval);
|
||||
}
|
||||
}
|
||||
|
||||
public static double getDou(Double s, double defval) {
|
||||
if (s == null) {
|
||||
return (defval);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/*public static Short getShort(String s) {
|
||||
if (StringUtil.isNotEmpty(s)) {
|
||||
return (Short.parseShort(s));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static int getInt(Object object, int defval) {
|
||||
if (isEmpty(object)) {
|
||||
return (defval);
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(object.toString()));
|
||||
} catch (NumberFormatException e) {
|
||||
return (defval);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(BigDecimal s, int defval) {
|
||||
if (s == null) {
|
||||
return (defval);
|
||||
}
|
||||
return s.intValue();
|
||||
}
|
||||
|
||||
public static Integer[] getIntegerArry(String[] object) {
|
||||
int len = object.length;
|
||||
Integer[] result = new Integer[len];
|
||||
try {
|
||||
for (int i = 0; i < len; i++) {
|
||||
result[i] = new Integer(object[i].trim());
|
||||
}
|
||||
return result;
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getString(String s) {
|
||||
return (getString(s, ""));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转义成Unicode编码
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
/*public static String escapeJava(Object s) {
|
||||
return StringEscapeUtils.escapeJava(getString(s));
|
||||
}*/
|
||||
|
||||
public static String getString(Object object) {
|
||||
if (isEmpty(object)) {
|
||||
return "";
|
||||
}
|
||||
return (object.toString().trim());
|
||||
}
|
||||
|
||||
public static String getString(int i) {
|
||||
return (String.valueOf(i));
|
||||
}
|
||||
|
||||
public static String getString(float i) {
|
||||
return (String.valueOf(i));
|
||||
}
|
||||
|
||||
public static String getString(String s, String defval) {
|
||||
if (isEmpty(s)) {
|
||||
return (defval);
|
||||
}
|
||||
return (s.trim());
|
||||
}
|
||||
|
||||
public static String getString(Object s, String defval) {
|
||||
if (isEmpty(s)) {
|
||||
return (defval);
|
||||
}
|
||||
return (s.toString().trim());
|
||||
}
|
||||
|
||||
public static long stringToLong(String str) {
|
||||
Long test = new Long(0);
|
||||
try {
|
||||
test = Long.valueOf(str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return test.longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本机IP
|
||||
*/
|
||||
public static String getIp() {
|
||||
String ip = null;
|
||||
try {
|
||||
InetAddress address = InetAddress.getLocalHost();
|
||||
ip = address.getHostAddress();
|
||||
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个类是否为基本数据类型。
|
||||
*
|
||||
* @param clazz
|
||||
* 要判断的类。
|
||||
* @return true 表示为基本数据类型。
|
||||
*/
|
||||
private static boolean isBaseDataType(Class clazz) throws Exception {
|
||||
return (clazz.equals(String.class) || clazz.equals(Integer.class) || clazz.equals(Byte.class) || clazz.equals(Long.class) || clazz.equals(Double.class) || clazz.equals(Float.class) || clazz.equals(Character.class) || clazz.equals(Short.class) || clazz.equals(BigDecimal.class) || clazz.equals(BigInteger.class) || clazz.equals(Boolean.class) || clazz.equals(Date.class) || clazz.isPrimitive());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param request
|
||||
* IP
|
||||
* @return IP Address
|
||||
*/
|
||||
public static String getIpAddrByRequest(HttpServletRequest request) {
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 本机IP
|
||||
* @throws SocketException
|
||||
*/
|
||||
public static String getRealIp() throws SocketException {
|
||||
String localip = null;// 本地IP,如果没有配置外网IP则返回它
|
||||
String netip = null;// 外网IP
|
||||
|
||||
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
InetAddress ip = null;
|
||||
boolean finded = false;// 是否找到外网IP
|
||||
while (netInterfaces.hasMoreElements() && !finded) {
|
||||
NetworkInterface ni = netInterfaces.nextElement();
|
||||
Enumeration<InetAddress> address = ni.getInetAddresses();
|
||||
while (address.hasMoreElements()) {
|
||||
ip = address.nextElement();
|
||||
if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 外网IP
|
||||
netip = ip.getHostAddress();
|
||||
finded = true;
|
||||
break;
|
||||
} else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 内网IP
|
||||
localip = ip.getHostAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (netip != null && !"".equals(netip)) {
|
||||
return netip;
|
||||
} else {
|
||||
return localip;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* java去除字符串中的空格、回车、换行符、制表符
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String replaceBlank(String str) {
|
||||
String dest = "";
|
||||
if (str != null) {
|
||||
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
|
||||
Matcher m = p.matcher(str);
|
||||
dest = m.replaceAll("");
|
||||
}
|
||||
return dest;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断元素是否在数组内
|
||||
*
|
||||
* @param substring
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static boolean isIn(String substring, String[] source) {
|
||||
if (source == null || source.length == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
String aSource = source[i];
|
||||
if (aSource.equals(substring)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Map对象
|
||||
*/
|
||||
public static Map<Object, Object> getHashMap() {
|
||||
return new HashMap<Object, Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* SET转换MAP
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static Map<Object, Object> SetToMap(Set<Object> setobj) {
|
||||
Map<Object, Object> map = getHashMap();
|
||||
for (Iterator iterator = setobj.iterator(); iterator.hasNext();) {
|
||||
Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) iterator.next();
|
||||
map.put(entry.getKey().toString(), entry.getValue() == null ? "" : entry.getValue().toString().trim());
|
||||
}
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isInnerIP(String ipAddress) {
|
||||
boolean isInnerIp = false;
|
||||
long ipNum = getIpNum(ipAddress);
|
||||
/**
|
||||
* 私有IP:A类 10.0.0.0-10.255.255.255 B类 172.16.0.0-172.31.255.255 C类 192.168.0.0-192.168.255.255 当然,还有127这个网段是环回地址
|
||||
**/
|
||||
long aBegin = getIpNum("10.0.0.0");
|
||||
long aEnd = getIpNum("10.255.255.255");
|
||||
long bBegin = getIpNum("172.16.0.0");
|
||||
long bEnd = getIpNum("172.31.255.255");
|
||||
long cBegin = getIpNum("192.168.0.0");
|
||||
long cEnd = getIpNum("192.168.255.255");
|
||||
isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals("127.0.0.1");
|
||||
return isInnerIp;
|
||||
}
|
||||
|
||||
private static long getIpNum(String ipAddress) {
|
||||
String[] ip = ipAddress.split("\\.");
|
||||
long a = Integer.parseInt(ip[0]);
|
||||
long b = Integer.parseInt(ip[1]);
|
||||
long c = Integer.parseInt(ip[2]);
|
||||
long d = Integer.parseInt(ip[3]);
|
||||
|
||||
long ipNum = a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
|
||||
return ipNum;
|
||||
}
|
||||
|
||||
private static boolean isInner(long userIp, long begin, long end) {
|
||||
return (userIp >= begin) && (userIp <= end);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。
|
||||
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
|
||||
* 例如:hello_world->helloWorld
|
||||
*
|
||||
* @param name
|
||||
* 转换前的下划线大写方式命名的字符串
|
||||
* @return 转换后的驼峰式命名的字符串
|
||||
*/
|
||||
public static String camelName(String name) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
// 快速检查
|
||||
if (name == null || name.isEmpty()) {
|
||||
// 没必要转换
|
||||
return "";
|
||||
} else if (!name.contains("_")) {
|
||||
// 不含下划线,仅将首字母小写
|
||||
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
return name.substring(0, 1).toLowerCase() + name.substring(1).toLowerCase();
|
||||
//update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
}
|
||||
// 用下划线将原始字符串分割
|
||||
String camels[] = name.split("_");
|
||||
for (String camel : camels) {
|
||||
// 跳过原始字符串中开头、结尾的下换线或双重下划线
|
||||
if (camel.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// 处理真正的驼峰片段
|
||||
if (result.length() == 0) {
|
||||
// 第一个驼峰片段,全部字母都小写
|
||||
result.append(camel.toLowerCase());
|
||||
} else {
|
||||
// 其他的驼峰片段,首字母大写
|
||||
result.append(camel.substring(0, 1).toUpperCase());
|
||||
result.append(camel.substring(1).toLowerCase());
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。
|
||||
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
|
||||
* 例如:hello_world,test_id->helloWorld,testId
|
||||
*
|
||||
* @param name
|
||||
* 转换前的下划线大写方式命名的字符串
|
||||
* @return 转换后的驼峰式命名的字符串
|
||||
*/
|
||||
public static String camelNames(String names) {
|
||||
if(names==null||names.equals("")){
|
||||
return null;
|
||||
}
|
||||
StringBuffer sf = new StringBuffer();
|
||||
String[] fs = names.split(",");
|
||||
for (String field : fs) {
|
||||
field = camelName(field);
|
||||
sf.append(field + ",");
|
||||
}
|
||||
String result = sf.toString();
|
||||
return result.substring(0, result.length() - 1);
|
||||
}
|
||||
|
||||
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。(首字母写)
|
||||
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
|
||||
* 例如:hello_world->HelloWorld
|
||||
*
|
||||
* @param name
|
||||
* 转换前的下划线大写方式命名的字符串
|
||||
* @return 转换后的驼峰式命名的字符串
|
||||
*/
|
||||
public static String camelNameCapFirst(String name) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
// 快速检查
|
||||
if (name == null || name.isEmpty()) {
|
||||
// 没必要转换
|
||||
return "";
|
||||
} else if (!name.contains("_")) {
|
||||
// 不含下划线,仅将首字母小写
|
||||
return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
|
||||
}
|
||||
// 用下划线将原始字符串分割
|
||||
String camels[] = name.split("_");
|
||||
for (String camel : camels) {
|
||||
// 跳过原始字符串中开头、结尾的下换线或双重下划线
|
||||
if (camel.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// 其他的驼峰片段,首字母大写
|
||||
result.append(camel.substring(0, 1).toUpperCase());
|
||||
result.append(camel.substring(1).toLowerCase());
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
//update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
|
||||
/**
|
||||
* 将驼峰命名转化成下划线
|
||||
* @param para
|
||||
* @return
|
||||
*/
|
||||
public static String camelToUnderline(String para){
|
||||
StringBuilder sb=new StringBuilder(para);
|
||||
int temp=0;//定位
|
||||
for(int i=0;i<para.length();i++){
|
||||
if(Character.isUpperCase(para.charAt(i))){
|
||||
sb.insert(i+temp, "_");
|
||||
temp+=1;
|
||||
}
|
||||
}
|
||||
return sb.toString().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机数
|
||||
* @param place 定义随机数的位数
|
||||
*/
|
||||
public static String randomGen(int place) {
|
||||
String base = "qwertyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKLOP0123456789";
|
||||
StringBuffer sb = new StringBuffer();
|
||||
Random rd = new Random();
|
||||
for(int i=0;i<place;i++) {
|
||||
sb.append(base.charAt(rd.nextInt(base.length())));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package org.jeecg.common.util.superSearch;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
/**
|
||||
* 判断类型,追加查询规则
|
||||
*
|
||||
* @author Scott
|
||||
* @date 2019年02月14日
|
||||
*/
|
||||
public class ObjectParseUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param queryWrapper QueryWrapper
|
||||
* @param name 字段名字
|
||||
* @param rule 查询规则
|
||||
* @param value 查询条件值
|
||||
*/
|
||||
public static void addCriteria(QueryWrapper<?> queryWrapper, String name, QueryRuleEnum rule, Object value) {
|
||||
if (value == null || rule == null) {
|
||||
return;
|
||||
}
|
||||
switch (rule) {
|
||||
case GT:
|
||||
queryWrapper.gt(name, value);
|
||||
break;
|
||||
case GE:
|
||||
queryWrapper.ge(name, value);
|
||||
break;
|
||||
case LT:
|
||||
queryWrapper.lt(name, value);
|
||||
break;
|
||||
case LE:
|
||||
queryWrapper.le(name, value);
|
||||
break;
|
||||
case EQ:
|
||||
queryWrapper.eq(name, value);
|
||||
break;
|
||||
case NE:
|
||||
queryWrapper.ne(name, value);
|
||||
break;
|
||||
case IN:
|
||||
queryWrapper.in(name, (Object[]) value);
|
||||
break;
|
||||
case LIKE:
|
||||
queryWrapper.like(name, value);
|
||||
break;
|
||||
case LEFT_LIKE:
|
||||
queryWrapper.likeLeft(name, value);
|
||||
break;
|
||||
case RIGHT_LIKE:
|
||||
queryWrapper.likeRight(name, value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package org.jeecg.common.util.superSearch;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
* Query 规则 常量
|
||||
* @author Scott
|
||||
* @date 2019年02月14日
|
||||
*/
|
||||
public enum QueryRuleEnum {
|
||||
|
||||
GT(">","大于"),
|
||||
GE(">=","大于等于"),
|
||||
LT("<","小于"),
|
||||
LE("<=","小于等于"),
|
||||
EQ("=","等于"),
|
||||
NE("!=","不等于"),
|
||||
IN("IN","包含"),
|
||||
LIKE("LIKE","全模糊"),
|
||||
LEFT_LIKE("LEFT_LIKE","左模糊"),
|
||||
RIGHT_LIKE("RIGHT_LIKE","右模糊"),
|
||||
SQL_RULES("EXTEND_SQL","自定义SQL片段");
|
||||
|
||||
private String value;
|
||||
|
||||
private String msg;
|
||||
|
||||
QueryRuleEnum(String value, String msg){
|
||||
this.value = value;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static QueryRuleEnum getByValue(String value){
|
||||
if(oConvertUtils.isEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
for(QueryRuleEnum val :values()){
|
||||
if (val.getValue().equals(value)){
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package org.jeecg.common.util.superSearch;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QueryRuleVo {
|
||||
|
||||
private String field;
|
||||
private String rule;
|
||||
private String val;
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
||||
|
||||
/**
|
||||
* 单数据源配置(jeecg.datasource.open = false时生效)
|
||||
* @author zhoujf
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(value={"org.jeecg.modules.**.mapper*"})
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * mybatis-plus SQL执行效率插件【生产环境可以关闭】
|
||||
// */
|
||||
// @Bean
|
||||
// public PerformanceInterceptor performanceInterceptor() {
|
||||
// return new PerformanceInterceptor();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
80
jeecg-boot/src/main/java/org/jeecg/config/RedisConfig.java
Normal file
80
jeecg-boot/src/main/java/org/jeecg/config/RedisConfig.java
Normal file
@ -0,0 +1,80 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
|
||||
|
||||
@Configuration
|
||||
@EnableCaching // 开启缓存支持
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
|
||||
@Resource
|
||||
private LettuceConnectionFactory lettuceConnectionFactory;
|
||||
|
||||
/**
|
||||
* @description 自定义的缓存key的生成策略 若想使用这个key
|
||||
* 只需要讲注解上keyGenerator的值设置为keyGenerator即可</br>
|
||||
* @return 自定义策略生成的key
|
||||
*/
|
||||
@Bean
|
||||
public KeyGenerator keyGenerator() {
|
||||
return new KeyGenerator() {
|
||||
@Override
|
||||
public Object generate(Object target, Method method, Object... params) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(target.getClass().getName());
|
||||
sb.append(method.getName());
|
||||
for (Object obj : params) {
|
||||
sb.append(obj.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 这个注释不能放开,发现自定义缓存管理器,会导致实体解析失败
|
||||
//TODO
|
||||
// @Bean
|
||||
// public CacheManager cacheManager() {
|
||||
// RedisCacheManager.RedisCacheManagerBuilder builder = RedisCacheManager.RedisCacheManagerBuilder.fromConnectionFactory(lettuceConnectionFactory);
|
||||
// return builder.build();
|
||||
// }
|
||||
|
||||
/**
|
||||
* RedisTemplate配置
|
||||
*/
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) {
|
||||
// 设置序列化
|
||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibility(PropertyAccessor.ALL, Visibility.ANY);
|
||||
om.enableDefaultTyping(DefaultTyping.NON_FINAL);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||
// 配置redisTemplate
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>();
|
||||
redisTemplate.setConnectionFactory(lettuceConnectionFactory);
|
||||
RedisSerializer<?> stringSerializer = new StringRedisSerializer();
|
||||
redisTemplate.setKeySerializer(stringSerializer);// key序列化
|
||||
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);// value序列化
|
||||
redisTemplate.setHashKeySerializer(stringSerializer);// Hash key序列化
|
||||
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);// Hash value序列化
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
134
jeecg-boot/src/main/java/org/jeecg/config/ShiroConfig.java
Normal file
134
jeecg-boot/src/main/java/org/jeecg/config/ShiroConfig.java
Normal file
@ -0,0 +1,134 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.Filter;
|
||||
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
|
||||
import org.apache.shiro.mgt.DefaultSubjectDAO;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.jeecg.modules.shiro.authc.MyRealm;
|
||||
import org.jeecg.modules.shiro.authc.aop.JwtFilter;
|
||||
import org.jeecg.modules.shiro.authc.aop.ResourceCheckFilter;
|
||||
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
|
||||
/**
|
||||
* @author: Scott
|
||||
* @date: 2018/2/7
|
||||
* @description: shiro 配置类
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class ShiroConfig {
|
||||
|
||||
/**
|
||||
* Filter Chain定义说明
|
||||
*
|
||||
* 1、一个URL可以配置多个Filter,使用逗号分隔
|
||||
* 2、当设置多个过滤器时,全部验证通过,才视为通过
|
||||
* 3、部分过滤器可指定参数,如perms,roles
|
||||
*/
|
||||
@Bean("shiroFilter")
|
||||
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
|
||||
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
|
||||
shiroFilterFactoryBean.setSecurityManager(securityManager);
|
||||
// 拦截器
|
||||
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
|
||||
// 配置不会被拦截的链接 顺序判断
|
||||
filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除
|
||||
filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
|
||||
filterChainDefinitionMap.put("/api/auth/logout", "anon");//退出登录
|
||||
filterChainDefinitionMap.put("/auth/2step-code", "anon");//退出登录
|
||||
|
||||
filterChainDefinitionMap.put("/**.js", "anon");
|
||||
filterChainDefinitionMap.put("/**.css", "anon");
|
||||
filterChainDefinitionMap.put("/druid/**", "anon");
|
||||
filterChainDefinitionMap.put("/swagger-ui.html", "anon");
|
||||
filterChainDefinitionMap.put("/swagger**/**", "anon");
|
||||
filterChainDefinitionMap.put("/webjars/**", "anon");
|
||||
filterChainDefinitionMap.put("/v2/**", "anon");
|
||||
|
||||
|
||||
filterChainDefinitionMap.put("/processInstance/**", "anon");
|
||||
filterChainDefinitionMap.put("/task/**", "anon");
|
||||
|
||||
|
||||
//TODO 排除Online请求
|
||||
filterChainDefinitionMap.put("/auto/cgform/**", "anon");
|
||||
//filterChainDefinitionMap.put("/cgAutoListController?list&id=**", "anon");
|
||||
//filterChainDefinitionMap.put("/cgFormBuildController/**", "anon");
|
||||
//TODO 排除FineReport请求
|
||||
//filterChainDefinitionMap.put("/ReportServer?reportlet=**", "anon");
|
||||
|
||||
|
||||
//用户,需要角色权限 “user”
|
||||
//filterChainDefinitionMap.put("/test/**", "roles[test]");
|
||||
//管理员,需要角色权限 “admin”
|
||||
//filterChainDefinitionMap.put("/sys/**", "roles[admin]");
|
||||
|
||||
// 添加自己的过滤器并且取名为jwt
|
||||
Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
|
||||
filterMap.put("jwt", new JwtFilter());
|
||||
filterMap.put("resourceCheckFilter", new ResourceCheckFilter());
|
||||
shiroFilterFactoryBean.setFilters(filterMap);
|
||||
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边
|
||||
filterChainDefinitionMap.put("/**", "jwt");
|
||||
//filterChainDefinitionMap.put("/**", "resourceCheckFilter");
|
||||
|
||||
// 未授权界面;
|
||||
shiroFilterFactoryBean.setUnauthorizedUrl("/403");
|
||||
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
|
||||
return shiroFilterFactoryBean;
|
||||
}
|
||||
|
||||
@Bean("securityManager")
|
||||
public DefaultWebSecurityManager securityManager(MyRealm myRealm) {
|
||||
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
|
||||
securityManager.setRealm(myRealm);
|
||||
|
||||
/*
|
||||
* 关闭shiro自带的session,详情见文档
|
||||
* http://shiro.apache.org/session-management.html#SessionManagement-
|
||||
* StatelessApplications%28Sessionless%29
|
||||
*/
|
||||
DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
|
||||
DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
|
||||
defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
|
||||
subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
|
||||
securityManager.setSubjectDAO(subjectDAO);
|
||||
|
||||
return securityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下面的代码是添加注解支持
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@DependsOn("lifecycleBeanPostProcessor")
|
||||
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
|
||||
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
|
||||
defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
|
||||
return defaultAdvisorAutoProxyCreator;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
|
||||
return new LifecycleBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
|
||||
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
|
||||
advisor.setSecurityManager(securityManager);
|
||||
return advisor;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.shiro.vo.DefContants;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* @author scott
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class Swagger2Config implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
*
|
||||
* 显示swagger-ui.html文档展示页,还必须注入swagger资源:
|
||||
*
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
|
||||
/**
|
||||
* swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等
|
||||
*
|
||||
* @return Docket
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
//此包路径下的类,才生成接口文档
|
||||
.apis(RequestHandlerSelectors.basePackage("org.jeecg.modules"))
|
||||
//加了ApiOperation注解的类,才生成接口文档
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.globalOperationParameters(setHeaderToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* JWT token
|
||||
* @return
|
||||
*/
|
||||
private List<Parameter> setHeaderToken() {
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
tokenPar.name(DefContants.X_ACCESS_TOKEN).description("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
||||
pars.add(tokenPar.build());
|
||||
return pars;
|
||||
}
|
||||
|
||||
/**
|
||||
* api文档的详细信息函数,注意这里的注解引用的是哪个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
// //大标题
|
||||
.title("Jeecg-Boot 后台服务API接口文档")
|
||||
// 版本号
|
||||
.version("1.0")
|
||||
// .termsOfServiceUrl("NO terms of service")
|
||||
// 描述
|
||||
.description("restful 风格接口")
|
||||
// 作者
|
||||
// .contact(new Contact("scott", "http://jeecg.org", "jeecgos@163.com"))
|
||||
// .license("The Apache License, Version 2.0")
|
||||
// .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* Spring Boot 2.0 解决跨域问题
|
||||
* @author qinfeng
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
|
||||
final CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
/*是否允许请求带有验证信息*/
|
||||
corsConfiguration.setAllowCredentials(true);
|
||||
/*允许访问的客户端域名*/
|
||||
corsConfiguration.addAllowedOrigin("*");
|
||||
/*允许服务端访问的客户端请求头*/
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
/*允许访问的方法名,GET POST等*/
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
|
||||
return new CorsFilter(urlBasedCorsConfigurationSource);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,144 @@
|
||||
package org.jeecg.config.mybatis;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.ibatis.binding.MapperMethod.ParamMap;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.Intercepts;
|
||||
import org.apache.ibatis.plugin.Invocation;
|
||||
import org.apache.ibatis.plugin.Plugin;
|
||||
import org.apache.ibatis.plugin.Signature;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* mybatis拦截器,自动注入创建人、创建时间、修改人、修改时间
|
||||
* @author scott
|
||||
* @date 2019-01-19
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) })
|
||||
public class MybatisInterceptor implements Interceptor {
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||
String sqlId = mappedStatement.getId();
|
||||
log.debug("------sqlId------" + sqlId);
|
||||
SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
|
||||
Object parameter = invocation.getArgs()[1];
|
||||
log.info("------sqlCommandType------" + sqlCommandType);
|
||||
|
||||
if (parameter == null) {
|
||||
return invocation.proceed();
|
||||
}
|
||||
if (SqlCommandType.INSERT == sqlCommandType) {
|
||||
Field[] fields = parameter.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
log.debug("------field.name------" + field.getName());
|
||||
try {
|
||||
if ("createBy".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_createBy = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_createBy == null || local_createBy.equals("")) {
|
||||
String createBy = "jeecg-boot";
|
||||
// 获取登录用户信息
|
||||
SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
createBy = sysUser.getUsername();
|
||||
}
|
||||
if (!oConvertUtils.isEmpty(createBy)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, createBy);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 注入创建时间
|
||||
if ("createTime".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_createDate = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_createDate == null || local_createDate.equals("")) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SqlCommandType.UPDATE == sqlCommandType) {
|
||||
Field[] fields = null;
|
||||
if (parameter instanceof ParamMap) {
|
||||
ParamMap<?> p = (ParamMap<?>) parameter;
|
||||
parameter = p.get("param1");
|
||||
fields = parameter.getClass().getDeclaredFields();
|
||||
} else {
|
||||
fields = parameter.getClass().getDeclaredFields();
|
||||
}
|
||||
|
||||
for (Field field : fields) {
|
||||
log.debug("------field.name------" + field.getName());
|
||||
try {
|
||||
if ("updateBy".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_updateBy = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_updateBy == null || local_updateBy.equals("")) {
|
||||
String updateBy = "jeecg-boot";
|
||||
// 获取登录用户信息
|
||||
SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
updateBy = sysUser.getUsername();
|
||||
}
|
||||
if (!oConvertUtils.isEmpty(updateBy)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, updateBy);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("updateTime".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_updateDate = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_updateDate == null || local_updateDate.equals("")) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
return Plugin.wrap(target, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package org.jeecg.modules.demo.mock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class MockController {
|
||||
|
||||
@GetMapping(value = "/user")
|
||||
public String user() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/user.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/role")
|
||||
public String role() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/role.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/service")
|
||||
public String service() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/service.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/permission")
|
||||
public String permission() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/permission.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/permission/no-pager")
|
||||
public String permission_no_page() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/permission_no_page.json");
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 工作台首页的数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list/search/projects")
|
||||
public String projects() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_projects.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/workplace/activity")
|
||||
public String activity() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_activity.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/workplace/teams")
|
||||
public String teams() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_teams.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/workplace/radar")
|
||||
public String radar() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_radar.json");
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 读取json格式文件
|
||||
* @param jsonSrc
|
||||
* @return
|
||||
*/
|
||||
private String readJson(String jsonSrc) {
|
||||
String json = "";
|
||||
try {
|
||||
//File jsonFile = ResourceUtils.getFile(jsonSrc);
|
||||
//json = FileUtils.re.readFileToString(jsonFile);
|
||||
//换个写法,解决springboot读取jar包中文件的问题
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream(jsonSrc.replace("classpath:", ""));
|
||||
json = IOUtils.toString(stream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,156 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"data": [
|
||||
{
|
||||
"id": "marketing",
|
||||
"name": "营销管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": null,
|
||||
"parents": null,
|
||||
"type": null,
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "member",
|
||||
"name": "会员管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "menu",
|
||||
"name": "菜单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"import",
|
||||
"get",
|
||||
"update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "order",
|
||||
"name": "订单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "permission",
|
||||
"name": "权限管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "role",
|
||||
"name": "角色管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "test",
|
||||
"name": "测试权限",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "user",
|
||||
"name": "用户管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"查询\",\"defaultCheck\":false}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
}
|
||||
],
|
||||
"pageSize": 10,
|
||||
"pageNo": 0,
|
||||
"totalPage": 1,
|
||||
"totalCount": 5
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1537082021471
|
||||
}
|
||||
@ -0,0 +1,150 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"id": "marketing",
|
||||
"name": "营销管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": null,
|
||||
"parents": null,
|
||||
"type": null,
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "member",
|
||||
"name": "会员管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "menu",
|
||||
"name": "菜单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"import",
|
||||
"get",
|
||||
"update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "order",
|
||||
"name": "订单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "permission",
|
||||
"name": "权限管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "role",
|
||||
"name": "角色管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "test",
|
||||
"name": "测试权限",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "user",
|
||||
"name": "用户管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"export\",\"defaultCheck\":false,\"describe\":\"导出\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 1537082021471
|
||||
}
|
||||
@ -0,0 +1,608 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"data": [
|
||||
{
|
||||
"id": "admin",
|
||||
"name": "管理员",
|
||||
"describe": "拥有所有权限",
|
||||
"status": 1,
|
||||
"creatorId": "system",
|
||||
"createTime": 1497160610259,
|
||||
"deleted": 0,
|
||||
"permissions": [
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "comment",
|
||||
"permissionName": "评论管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "member",
|
||||
"permissionName": "会员管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "menu",
|
||||
"permissionName": "菜单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "order",
|
||||
"permissionName": "订单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "permission",
|
||||
"permissionName": "权限管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "role",
|
||||
"permissionName": "角色管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "test",
|
||||
"permissionName": "测试权限",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "user",
|
||||
"permissionName": "用户管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"},{\"action\":\"export\",\"defaultCheck\":false,\"describe\":\"导出\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "export",
|
||||
"describe": "导出",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "svip",
|
||||
"name": "SVIP",
|
||||
"describe": "超级会员",
|
||||
"status": 1,
|
||||
"creatorId": "system",
|
||||
"createTime": 1532417744846,
|
||||
"deleted": 0,
|
||||
"permissions": [
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "comment",
|
||||
"permissionName": "评论管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "member",
|
||||
"permissionName": "会员管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "menu",
|
||||
"permissionName": "菜单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "order",
|
||||
"permissionName": "订单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "permission",
|
||||
"permissionName": "权限管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "role",
|
||||
"permissionName": "角色管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "test",
|
||||
"permissionName": "测试权限",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "user",
|
||||
"permissionName": "用户管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"},{\"action\":\"export\",\"defaultCheck\":false,\"describe\":\"导出\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "user",
|
||||
"name": "普通会员",
|
||||
"describe": "普通用户,只能查询",
|
||||
"status": 1,
|
||||
"creatorId": "system",
|
||||
"createTime": 1497160610259,
|
||||
"deleted": 0,
|
||||
"permissions": [
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "comment",
|
||||
"permissionName": "评论管理",
|
||||
"actions": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "marketing",
|
||||
"permissionName": "营销管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "member",
|
||||
"permissionName": "会员管理",
|
||||
"actions": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "menu",
|
||||
"permissionName": "菜单管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "order",
|
||||
"permissionName": "订单管理",
|
||||
"actions": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "permission",
|
||||
"permissionName": "权限管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "role",
|
||||
"permissionName": "角色管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "test",
|
||||
"permissionName": "测试权限",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "user",
|
||||
"permissionName": "用户管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"pageSize": 10,
|
||||
"pageNo": 0,
|
||||
"totalPage": 1,
|
||||
"totalCount": 5
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1537079497645
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"pageSize": 10,
|
||||
"pageNo": 0,
|
||||
"totalCount": 57,
|
||||
"totalPage": 6,
|
||||
"data": [
|
||||
{
|
||||
"key": 1,
|
||||
"no": "No 1",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 127,
|
||||
"status": 2,
|
||||
"updatedAt": "1970-06-24 11:51:20",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 2,
|
||||
"no": "No 2",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 573,
|
||||
"status": 2,
|
||||
"updatedAt": "1994-12-11 00:37:35",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 3,
|
||||
"no": "No 3",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 869,
|
||||
"status": 2,
|
||||
"updatedAt": "2013-11-11 08:04:03",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 4,
|
||||
"no": "No 4",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 26,
|
||||
"status": 2,
|
||||
"updatedAt": "1990-11-04 15:41:42",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 5,
|
||||
"no": "No 5",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 20,
|
||||
"status": 2,
|
||||
"updatedAt": "1970-01-05 11:04:56",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 6,
|
||||
"no": "No 6",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 675,
|
||||
"status": 2,
|
||||
"updatedAt": "1983-06-06 04:09:04",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 7,
|
||||
"no": "No 7",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 512,
|
||||
"status": 3,
|
||||
"updatedAt": "1996-08-26 21:47:44",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 8,
|
||||
"no": "No 8",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 962,
|
||||
"status": 2,
|
||||
"updatedAt": "2004-08-15 23:15:22",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 9,
|
||||
"no": "No 9",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 318,
|
||||
"status": 3,
|
||||
"updatedAt": "1988-08-10 14:36:35",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 10,
|
||||
"no": "No 10",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 789,
|
||||
"status": 0,
|
||||
"updatedAt": "1988-12-27 23:39:41",
|
||||
"editable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1534955098193
|
||||
}
|
||||
2388
jeecg-boot/src/main/java/org/jeecg/modules/demo/mock/json/user.json
Normal file
2388
jeecg-boot/src/main/java/org/jeecg/modules/demo/mock/json/user.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,85 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "Barbara Lee",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
},
|
||||
"project": {
|
||||
"name": "白鹭酱油开发组",
|
||||
"action": "更新",
|
||||
"event": "番组计划"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "蓝莓酱",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png"
|
||||
},
|
||||
"project": {
|
||||
"name": "白鹭酱油开发组",
|
||||
"action": "更新",
|
||||
"event": "番组计划"
|
||||
},
|
||||
"time": "2018-08-23 09:35:37"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "Brian Young",
|
||||
"avatar": "http://dummyimage.com/64x64"
|
||||
},
|
||||
"project": {
|
||||
"name": "白鹭酱油开发组",
|
||||
"action": "创建",
|
||||
"event": "番组计划"
|
||||
},
|
||||
"time": "2017-05-27 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "曲丽丽",
|
||||
"avatar": "http://dummyimage.com/64x64"
|
||||
},
|
||||
"project": {
|
||||
"name": "高逼格设计天团",
|
||||
"action": "更新",
|
||||
"event": "六月迭代"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "Dorothy Thompson",
|
||||
"avatar": "http://dummyimage.com/64x64"
|
||||
},
|
||||
"project": {
|
||||
"name": "高逼格设计天团",
|
||||
"action": "created",
|
||||
"event": "六月迭代"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "曲丽丽",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
},
|
||||
"project": {
|
||||
"name": "高逼格设计天团",
|
||||
"action": "created",
|
||||
"event": "六月迭代"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 0
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"data": [
|
||||
{
|
||||
"id": 1,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png",
|
||||
"title": "Alipay",
|
||||
"description": "那是一种内在的东西, 他们到达不了,也无法触及的",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png",
|
||||
"title": "Angular",
|
||||
"description": "希望是一个好东西,也许是最好的,好东西是不会消亡的",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png",
|
||||
"title": "Ant Design",
|
||||
"description": "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png",
|
||||
"title": "Ant Design Pro",
|
||||
"description": "那时候我只会想自己想要什么,从不想自己拥有什么",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png",
|
||||
"title": "Bootstrap",
|
||||
"description": "凛冬将至",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png",
|
||||
"title": "Vue",
|
||||
"description": "生命就像一盒巧克力,结果往往出人意料",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
}
|
||||
],
|
||||
"pageSize": 10,
|
||||
"pageNo": 1,
|
||||
"totalPage": 6,
|
||||
"totalCount": 57
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1534955098193
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"item": "引用",
|
||||
"个人": 70,
|
||||
"团队": 30,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "口碑",
|
||||
"个人": 60,
|
||||
"团队": 70,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "产量",
|
||||
"个人": 50,
|
||||
"团队": 60,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "贡献",
|
||||
"个人": 40,
|
||||
"团队": 50,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "热度",
|
||||
"个人": 60,
|
||||
"团队": 70,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "引用",
|
||||
"个人": 70,
|
||||
"团队": 50,
|
||||
"部门": 40
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 1534955098193
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "科学搬砖组",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "程序员日常",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "设计天团",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "中二少女团",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "骗你学计算机",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png"
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 0
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Description: auto/cgform
|
||||
* @author: scott
|
||||
* @date: 2019-01-30
|
||||
* @version:V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auto/cgform")
|
||||
@Slf4j
|
||||
public class AutoController {
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
public ModelAndView list(HttpServletRequest request, HttpServletResponse response,ModelAndView modelAndView) {
|
||||
HttpSession session = request.getSession();
|
||||
log.info(" session id = " + session.getId());
|
||||
|
||||
modelAndView.setViewName("demo3");
|
||||
List<String> userList = new ArrayList<String>();
|
||||
userList.add("admin");
|
||||
userList.add("user1");
|
||||
userList.add("user2");
|
||||
log.info("--------------test--------------");
|
||||
modelAndView.addObject("userList", userList);
|
||||
modelAndView.addObject("sessionid", session.getId());
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,296 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.util.superSearch.ObjectParseUtil;
|
||||
import org.jeecg.common.util.superSearch.QueryRuleEnum;
|
||||
import org.jeecg.common.util.superSearch.QueryRuleVo;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 测试demo
|
||||
* @author: jeecg-boot
|
||||
* @date: 2018-12-29
|
||||
* @version:V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/jeecgDemo")
|
||||
@Slf4j
|
||||
public class JeecgDemoController {
|
||||
@Autowired
|
||||
private IJeecgDemoService jeecgDemoService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param jeecgDemo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表", produces = "application/json")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<JeecgDemo>> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<JeecgDemo>> result = new Result<IPage<JeecgDemo>>();
|
||||
QueryWrapper<JeecgDemo> queryWrapper = null;
|
||||
//================================================================================
|
||||
//高级组合查询
|
||||
try {
|
||||
String superQueryParams = req.getParameter("superQueryParams");
|
||||
if(oConvertUtils.isNotEmpty(superQueryParams)) {
|
||||
// 解码
|
||||
superQueryParams = URLDecoder.decode(superQueryParams, "UTF-8");
|
||||
List<QueryRuleVo> userList = JSON.parseArray(superQueryParams, QueryRuleVo.class);
|
||||
log.info(superQueryParams);
|
||||
queryWrapper = new QueryWrapper<JeecgDemo>();
|
||||
for (QueryRuleVo rule : userList) {
|
||||
if(oConvertUtils.isNotEmpty(rule.getField()) && oConvertUtils.isNotEmpty(rule.getRule()) && oConvertUtils.isNotEmpty(rule.getVal())){
|
||||
ObjectParseUtil.addCriteria(queryWrapper, rule.getField(), QueryRuleEnum.getByValue(rule.getRule()), rule.getVal());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//================================================================================
|
||||
|
||||
// 手工转换实体驼峰字段为下划线分隔表字段
|
||||
queryWrapper = queryWrapper==null?new QueryWrapper<JeecgDemo>(jeecgDemo):queryWrapper;
|
||||
Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);
|
||||
|
||||
// 排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if ("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
} else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
|
||||
IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
|
||||
// log.info("查询当前页:" + pageList.getCurrent());
|
||||
// log.info("查询当前页数量:" + pageList.getSize());
|
||||
// log.info("查询结果数量:" + pageList.getRecords().size());
|
||||
// log.info("数据总数:" + pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param jeecgDemo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
@AutoLog(value = "添加测试DEMO")
|
||||
public Result<JeecgDemo> add(@RequestBody JeecgDemo jeecgDemo) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
try {
|
||||
jeecgDemoService.save(jeecgDemo);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param jeecgDemo
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<JeecgDemo> eidt(@RequestBody JeecgDemo jeecgDemo) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
JeecgDemo jeecgDemoEntity = jeecgDemoService.getById(jeecgDemo.getId());
|
||||
if (jeecgDemoEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = jeecgDemoService.updateById(jeecgDemo);
|
||||
// TODO 返回false说明什么?
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "删除测试DEMO")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<JeecgDemo> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
JeecgDemo jeecgDemo = jeecgDemoService.getById(id);
|
||||
if (jeecgDemo == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = jeecgDemoService.removeById(id);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<JeecgDemo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.jeecgDemoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取Demo信息", tags = { "获取Demo信息" }, notes = "注意问题点")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JeecgDemo> queryById(@ApiParam(name = "id", value = "示例id", required = true) @RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
JeecgDemo jeecgDemo = jeecgDemoService.getById(id);
|
||||
if (jeecgDemo == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(jeecgDemo);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// ================================================================================================================
|
||||
/**
|
||||
* redis操作 -- set
|
||||
*/
|
||||
@GetMapping(value = "/redisSet")
|
||||
public void redisSet() {
|
||||
redisUtil.set("name", "张三" + DateUtils.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- get
|
||||
*/
|
||||
@GetMapping(value = "/redisGet")
|
||||
public String redisGet() {
|
||||
return (String) redisUtil.get("name");
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- setObj
|
||||
*/
|
||||
@GetMapping(value = "/redisSetObj")
|
||||
public void redisSetObj() {
|
||||
JeecgDemo p = new JeecgDemo();
|
||||
p.setAge(10);
|
||||
p.setBirthday(new Date());
|
||||
p.setContent("hello");
|
||||
p.setName("张三");
|
||||
p.setSex("男");
|
||||
redisUtil.set("user-zdh", p);
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- setObj
|
||||
*/
|
||||
@GetMapping(value = "/redisGetObj")
|
||||
public Object redisGetObj() {
|
||||
return redisUtil.get("user-zdh");
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- get
|
||||
*/
|
||||
@GetMapping(value = "/redisDemo/{id}")
|
||||
public JeecgDemo redisGetJeecgDemo(@PathVariable("id") String id) {
|
||||
JeecgDemo t = jeecgDemoService.getByIdCacheable(id);
|
||||
System.out.println(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* freemaker方式 【页面路径: src/main/resources/templates】
|
||||
*
|
||||
* @param modelAndView
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/demo3")
|
||||
public ModelAndView demo3(ModelAndView modelAndView) {
|
||||
modelAndView.setViewName("demo3");
|
||||
List<String> userList = new ArrayList<String>();
|
||||
userList.add("admin");
|
||||
userList.add("user1");
|
||||
userList.add("user2");
|
||||
log.info("--------------test--------------");
|
||||
modelAndView.addObject("userList", userList);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
// ================================================================================================================
|
||||
|
||||
}
|
||||
@ -0,0 +1,404 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderCustomerService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderMainService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderTicketService;
|
||||
import org.jeecg.modules.demo.test.vo.JeecgOrderMainPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 订单模拟
|
||||
* @author: ZhiLin
|
||||
* @Date: 2019-02-20
|
||||
* @version: v1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/test/order")
|
||||
public class JeecgOrderDMainController {
|
||||
@Autowired
|
||||
private IJeecgOrderMainService jeecgOrderMainService;
|
||||
@Autowired
|
||||
private IJeecgOrderCustomerService jeecgOrderCustomerService;
|
||||
@Autowired
|
||||
private IJeecgOrderTicketService jeecgOrderTicketService;
|
||||
@Autowired
|
||||
private IJeecgOrderCustomerService customerService;
|
||||
@Autowired
|
||||
private IJeecgOrderTicketService ticketService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param jeecgOrderMain
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/orderList")
|
||||
public Result<IPage<JeecgOrderMain>> respondePagedData(JeecgOrderMain jeecgOrderMain,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req){
|
||||
Result<IPage<JeecgOrderMain>> result = new Result<IPage<JeecgOrderMain>>();
|
||||
QueryWrapper<JeecgOrderMain> queryWrapper = new QueryWrapper<JeecgOrderMain>(jeecgOrderMain);
|
||||
Page<JeecgOrderMain> page = new Page<JeecgOrderMain>(pageNo,pageSize);
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
IPage<JeecgOrderMain> pageList = jeecgOrderMainService.page(page, queryWrapper);
|
||||
//log.debug("查询当前页:"+pageList.getCurrent());
|
||||
//log.debug("查询当前页数量:"+pageList.getSize());
|
||||
//log.debug("查询结果数量:"+pageList.getRecords().size());
|
||||
//log.debug("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param jeecgOrderMainPage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<JeecgOrderMain> add(@RequestBody JeecgOrderMainPage jeecgOrderMainPage){
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
try {
|
||||
jeecgOrderMainService.saveMain(jeecgOrderMainPage.getJeecgOrderMain(), jeecgOrderMainPage.getJeecgOrderCustomerList(), jeecgOrderMainPage.getJeecgOrderTicketList());;
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param jeecgOrderMainPage
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/edit")
|
||||
public Result<JeecgOrderMain> edit(@RequestBody JeecgOrderMainPage jeecgOrderMainPage){
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainPage.getJeecgOrderMain();
|
||||
JeecgOrderMain jeecgOrderMainEntity = jeecgOrderMainService.getById(jeecgOrderMain.getId());
|
||||
if(jeecgOrderMainEntity==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
jeecgOrderMainService.updateMain(jeecgOrderMain, jeecgOrderMainPage.getJeecgOrderCustomerList(), jeecgOrderMainPage.getJeecgOrderTicketList());
|
||||
result.success("修改成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<JeecgOrderMain> delete(@RequestParam(name = "id",required = true) String id){
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if(jeecgOrderMain==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
jeecgOrderMainService.delMain(id);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<JeecgOrderMain> deleteBatch(@RequestParam(name = "ids", required = true) String ids){
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.jeecgOrderMainService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JeecgOrderMain> queryById(@RequestParam(name = "id", required = true) String id){
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if(jeecgOrderMain==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
result.setResult(jeecgOrderMain);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderCustomerListByMainId")
|
||||
public Result<List<JeecgOrderCustomer>> queryOrderCustomerListByMainId(@RequestParam(name="id",required=true) String id){
|
||||
Result<List<JeecgOrderCustomer>> result = new Result<List<JeecgOrderCustomer>>();
|
||||
List<JeecgOrderCustomer> jeecgOrderCustomerList = jeecgOrderCustomerService.selectCustomersByMainId(id);
|
||||
result.setResult(jeecgOrderCustomerList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderTicketListByMainId")
|
||||
public Result<List<JeecgOrderTicket>> queryOrderTicketListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
Result<List<JeecgOrderTicket>> result = new Result<List<JeecgOrderTicket>>();
|
||||
List<JeecgOrderTicket> jeecgOrderTicketList = jeecgOrderTicketService.selectTicketsByMainId(id);
|
||||
result.setResult(jeecgOrderTicketList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// ================================以下是客户信息相关的API=================================
|
||||
/**
|
||||
* 添加
|
||||
* @param jeecgOrderCustomer
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addCustomer")
|
||||
public Result<JeecgOrderCustomer> addCustomer(@RequestBody JeecgOrderCustomer jeecgOrderCustomer){
|
||||
Result<JeecgOrderCustomer> result = new Result<>();
|
||||
try {
|
||||
boolean ok = customerService.save(jeecgOrderCustomer);
|
||||
if(ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("添加数据成功");
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("添加数据失败");
|
||||
}
|
||||
return result;
|
||||
}catch(Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(false);
|
||||
result.setMessage("遇到问题了!");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param jeecgOrderCustomer
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/editCustomer")
|
||||
public Result<JeecgOrderCustomer> editCustomer(@RequestBody JeecgOrderCustomer jeecgOrderCustomer){
|
||||
Result<JeecgOrderCustomer> result = new Result<>();
|
||||
try {
|
||||
boolean ok = customerService.updateById(jeecgOrderCustomer);
|
||||
if(ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("更新成功");
|
||||
}else{
|
||||
result.setSuccess(false);
|
||||
result.setMessage("更新失败");
|
||||
}
|
||||
return result;
|
||||
}catch(Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(true);
|
||||
result.setMessage("更新中碰到异常了");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteCustomer")
|
||||
public Result<JeecgOrderCustomer> deleteCustomer(@RequestParam(name = "id",required = true) String id){
|
||||
Result<JeecgOrderCustomer> result = new Result<>();
|
||||
try {
|
||||
boolean ok = customerService.removeById(id);
|
||||
if(ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("删除成功");
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除失败");
|
||||
}
|
||||
return result;
|
||||
}catch(Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除过程中碰到异常了");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatchCustomer")
|
||||
public Result<JeecgOrderCustomer> deleteBatchCustomer(@RequestParam(name = "ids", required = true) String ids){
|
||||
Result<JeecgOrderCustomer> result = new Result<JeecgOrderCustomer>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.customerService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//===========================以下是机票的相关API====================================
|
||||
/**
|
||||
* 添加
|
||||
* @param jeecgOrderTicket
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addTicket")
|
||||
public Result<JeecgOrderTicket> addTicket(@RequestBody JeecgOrderTicket jeecgOrderTicket){
|
||||
Result<JeecgOrderTicket> result = new Result<>();
|
||||
try {
|
||||
boolean ok = ticketService.save(jeecgOrderTicket);
|
||||
if(ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("添加机票信息成功.");
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("添加机票信息失败!");
|
||||
}
|
||||
return result;
|
||||
}catch(Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(false);
|
||||
result.setMessage("添加机票信息过程中出现了异常: "+e.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param jeecgOrderTicket
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/editTicket")
|
||||
public Result<JeecgOrderTicket> editTicket(@RequestBody JeecgOrderTicket jeecgOrderTicket){
|
||||
Result<JeecgOrderTicket> result = new Result<>();
|
||||
try {
|
||||
boolean ok = ticketService.updateById(jeecgOrderTicket);
|
||||
if(ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("更新数据成功.");
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("更新机票 信息失败!");
|
||||
}
|
||||
return result;
|
||||
}catch(Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("更新数据过程中出现异常啦: " + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteTicket")
|
||||
public Result<JeecgOrderTicket> deleteTicket(@RequestParam(name = "id",required = true) String id){
|
||||
Result<JeecgOrderTicket> result = new Result<>();
|
||||
try {
|
||||
boolean ok = ticketService.removeById(id);
|
||||
if(ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("删除机票信息成功.");
|
||||
}else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除机票信息失败!");
|
||||
}
|
||||
return result;
|
||||
}catch(Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除机票信息过程中出现异常啦: " + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatchTicket")
|
||||
public Result<JeecgOrderTicket> deleteBatchTicket(@RequestParam(name = "ids", required = true) String ids){
|
||||
Result<JeecgOrderTicket> result = new Result<JeecgOrderTicket>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.ticketService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,205 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderCustomerService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderMainService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderTicketService;
|
||||
import org.jeecg.modules.demo.test.vo.JeecgOrderMainPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 订单
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/jeecgOrderMain")
|
||||
@Slf4j
|
||||
public class JeecgOrderMainController {
|
||||
@Autowired
|
||||
private IJeecgOrderMainService jeecgOrderMainService;
|
||||
@Autowired
|
||||
private IJeecgOrderCustomerService jeecgOrderCustomerService;
|
||||
@Autowired
|
||||
private IJeecgOrderTicketService jeecgOrderTicketService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param jeecgOrderMain
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<JeecgOrderMain>> queryPageList(JeecgOrderMain jeecgOrderMain,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<JeecgOrderMain>> result = new Result<IPage<JeecgOrderMain>>();
|
||||
QueryWrapper<JeecgOrderMain> queryWrapper = new QueryWrapper<JeecgOrderMain>(jeecgOrderMain);
|
||||
Page<JeecgOrderMain> page = new Page<JeecgOrderMain>(pageNo,pageSize);
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
IPage<JeecgOrderMain> pageList = jeecgOrderMainService.page(page, queryWrapper);
|
||||
//log.debug("查询当前页:"+pageList.getCurrent());
|
||||
//log.debug("查询当前页数量:"+pageList.getSize());
|
||||
//log.debug("查询结果数量:"+pageList.getRecords().size());
|
||||
//log.debug("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param jeecgOrderMain
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<JeecgOrderMain> add(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
try {
|
||||
jeecgOrderMainService.saveMain(jeecgOrderMainPage.getJeecgOrderMain(), jeecgOrderMainPage.getJeecgOrderCustomerList(), jeecgOrderMainPage.getJeecgOrderTicketList());;
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param jeecgOrderMain
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<JeecgOrderMain> eidt(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainPage.getJeecgOrderMain();
|
||||
JeecgOrderMain jeecgOrderMainEntity = jeecgOrderMainService.getById(jeecgOrderMain.getId());
|
||||
if(jeecgOrderMainEntity==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
jeecgOrderMainService.updateMain(jeecgOrderMain, jeecgOrderMainPage.getJeecgOrderCustomerList(), jeecgOrderMainPage.getJeecgOrderTicketList());
|
||||
result.success("修改成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<JeecgOrderMain> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if(jeecgOrderMain==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
jeecgOrderMainService.delMain(id);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<JeecgOrderMain> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.jeecgOrderMainService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JeecgOrderMain> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if(jeecgOrderMain==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
result.setResult(jeecgOrderMain);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderCustomerListByMainId")
|
||||
public Result<List<JeecgOrderCustomer>> queryOrderCustomerListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
Result<List<JeecgOrderCustomer>> result = new Result<List<JeecgOrderCustomer>>();
|
||||
List<JeecgOrderCustomer> jeecgOrderCustomerList = jeecgOrderCustomerService.selectCustomersByMainId(id);
|
||||
result.setResult(jeecgOrderCustomerList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderTicketListByMainId")
|
||||
public Result<List<JeecgOrderTicket>> queryOrderTicketListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
Result<List<JeecgOrderTicket>> result = new Result<List<JeecgOrderTicket>>();
|
||||
List<JeecgOrderTicket> jeecgOrderTicketList = jeecgOrderTicketService.selectTicketsByMainId(id);
|
||||
result.setResult(jeecgOrderTicketList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @author: jeecg-boot
|
||||
* @date: 2018-12-29
|
||||
* @version:V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("demo")
|
||||
public class JeecgDemo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/** 姓名 */
|
||||
private java.lang.String name;
|
||||
/** 关键词 */
|
||||
private java.lang.String keyWord;
|
||||
/** 打卡时间 */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date punchTime;
|
||||
/** 工资 */
|
||||
private java.math.BigDecimal salaryMoney;
|
||||
/** 奖金 */
|
||||
private java.lang.Double bonusMoney;
|
||||
/** 性别 {男:1,女:2} */
|
||||
private java.lang.String sex;
|
||||
/** 年龄 */
|
||||
private java.lang.Integer age;
|
||||
/** 生日 */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private java.util.Date birthday;
|
||||
/** 邮箱 */
|
||||
private java.lang.String email;
|
||||
/** 个人简介 */
|
||||
private java.lang.String content;
|
||||
/** createTime */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/** 创建人 */
|
||||
private String createBy;
|
||||
/** 更新人 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("jeecg_order_customer")
|
||||
public class JeecgOrderCustomer implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**客户名*/
|
||||
private java.lang.String name;
|
||||
/**性别*/
|
||||
private java.lang.String sex;
|
||||
/**身份证号码*/
|
||||
private java.lang.String idcard;
|
||||
/**身份证扫描件*/
|
||||
private java.lang.String idcardPic;
|
||||
/**电话1*/
|
||||
private java.lang.String telphone;
|
||||
/**外键*/
|
||||
private java.lang.String orderId;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("jeecg_order_main")
|
||||
public class JeecgOrderMain implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**订单号*/
|
||||
private java.lang.String orderCode;
|
||||
/**订单类型*/
|
||||
private java.lang.String ctype;
|
||||
/**订单日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date orderDate;
|
||||
/**订单金额*/
|
||||
private java.lang.Double orderMoney;
|
||||
/**订单备注*/
|
||||
private java.lang.String content;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("jeecg_order_ticket")
|
||||
public class JeecgOrderTicket implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**航班号*/
|
||||
private java.lang.String ticketCode;
|
||||
/**航班时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date tickectDate;
|
||||
/**外键*/
|
||||
private java.lang.String orderId;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @author: jeecg-boot
|
||||
* @date: 2018-12-29
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface JeecgDemoMapper extends BaseMapper<JeecgDemo> {
|
||||
|
||||
public List<JeecgDemo> getDemoByName(@Param("name") String name);
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface JeecgOrderCustomerMapper extends BaseMapper<JeecgOrderCustomer> {
|
||||
|
||||
/**
|
||||
* 通过主表外键批量删除客户
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE FROM JEECG_ORDER_CUSTOMER WHERE ORDER_ID = #{mainId}")
|
||||
public boolean deleteCustomersByMainId(String mainId);
|
||||
|
||||
@Select("SELECT * FROM JEECG_ORDER_CUSTOMER WHERE ORDER_ID = #{mainId}")
|
||||
public List<JeecgOrderCustomer> selectCustomersByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface JeecgOrderMainMapper extends BaseMapper<JeecgOrderMain> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface JeecgOrderTicketMapper extends BaseMapper<JeecgOrderTicket> {
|
||||
|
||||
/**
|
||||
* 通过主表外键批量删除客户
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE FROM JEECG_ORDER_TICKET WHERE ORDER_ID = #{mainId}")
|
||||
public boolean deleteTicketsByMainId(String mainId);
|
||||
|
||||
|
||||
@Select("SELECT * FROM JEECG_ORDER_TICKET WHERE ORDER_ID = #{mainId}")
|
||||
public List<JeecgOrderTicket> selectTicketsByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgDemoMapper">
|
||||
|
||||
<!-- 根据用户名查询 -->
|
||||
<select id="getDemoByName" resultType="org.jeecg.modules.demo.test.entity.JeecgDemo">
|
||||
select * from demo where name = #{name}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgOrderCustomerMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgOrderMainMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgOrderTicketMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @author: jeecg-boot
|
||||
* @date: 2018-12-29
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IJeecgDemoService extends IService<JeecgDemo> {
|
||||
public void testTran();
|
||||
|
||||
public JeecgDemo getByIdCacheable(String id);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IJeecgOrderCustomerService extends IService<JeecgOrderCustomer> {
|
||||
|
||||
public List<JeecgOrderCustomer> selectCustomersByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IJeecgOrderMainService extends IService<JeecgOrderMain> {
|
||||
|
||||
/**
|
||||
* 添加一对多
|
||||
*
|
||||
*/
|
||||
public void saveMain(JeecgOrderMain jeecgOrderMain,List<JeecgOrderCustomer> jeecgOrderCustomerList,List<JeecgOrderTicket> jeecgOrderTicketList) ;
|
||||
|
||||
/**
|
||||
* 修改一对多
|
||||
*
|
||||
*/
|
||||
public void updateMain(JeecgOrderMain jeecgOrderMain,List<JeecgOrderCustomer> jeecgOrderCustomerList,List<JeecgOrderTicket> jeecgOrderTicketList);
|
||||
|
||||
/**
|
||||
* 删除一对多
|
||||
* @param jformOrderMain
|
||||
*/
|
||||
public void delMain (String id);
|
||||
|
||||
/**
|
||||
* 批量删除一对多
|
||||
* @param jformOrderMain
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IJeecgOrderTicketService extends IService<JeecgOrderTicket> {
|
||||
|
||||
public List<JeecgOrderTicket> selectTicketsByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @author: jeecg-boot
|
||||
* @date: 2018-12-29
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgDemoServiceImpl extends ServiceImpl<JeecgDemoMapper, JeecgDemo> implements IJeecgDemoService {
|
||||
@Autowired
|
||||
JeecgDemoMapper jeecgDemoMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 事务控制在service层面
|
||||
* 加上注解:@Transactional,声明的方法就是一个独立的事务(有异常DB操作全部回滚)
|
||||
*/
|
||||
@Transactional
|
||||
public void testTran() {
|
||||
JeecgDemo pp = new JeecgDemo();
|
||||
pp.setAge(1111);
|
||||
pp.setName("测试事务 小白兔 1");
|
||||
jeecgDemoMapper.insert(pp);
|
||||
|
||||
JeecgDemo pp2 = new JeecgDemo();
|
||||
pp2.setAge(2222);
|
||||
pp2.setName("测试事务 小白兔 2");
|
||||
jeecgDemoMapper.insert(pp2);
|
||||
|
||||
Integer.parseInt("hello");//自定义异常
|
||||
|
||||
JeecgDemo pp3 = new JeecgDemo();
|
||||
pp3.setAge(3333);
|
||||
pp3.setName("测试事务 小白兔 3");
|
||||
jeecgDemoMapper.insert(pp3);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 缓存注解测试: redis
|
||||
*/
|
||||
@Cacheable(cacheNames="jeecgDemo", key="#id")
|
||||
public JeecgDemo getByIdCacheable(String id) {
|
||||
JeecgDemo t = jeecgDemoMapper.selectById(id);
|
||||
System.err.println(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderCustomerMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderCustomerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgOrderCustomerServiceImpl extends ServiceImpl<JeecgOrderCustomerMapper, JeecgOrderCustomer> implements IJeecgOrderCustomerService {
|
||||
|
||||
@Autowired
|
||||
private JeecgOrderCustomerMapper jeecgOrderCustomerMapper;
|
||||
|
||||
@Override
|
||||
public List<JeecgOrderCustomer> selectCustomersByMainId(String mainId) {
|
||||
return jeecgOrderCustomerMapper.selectCustomersByMainId(mainId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderCustomerMapper;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderMainMapper;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderTicketMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgOrderMainServiceImpl extends ServiceImpl<JeecgOrderMainMapper, JeecgOrderMain> implements IJeecgOrderMainService {
|
||||
|
||||
@Autowired
|
||||
private JeecgOrderMainMapper jeecgOrderMainMapper;
|
||||
@Autowired
|
||||
private JeecgOrderCustomerMapper jeecgOrderCustomerMapper;
|
||||
@Autowired
|
||||
private JeecgOrderTicketMapper jeecgOrderTicketMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveMain(JeecgOrderMain jeecgOrderMain, List<JeecgOrderCustomer> jeecgOrderCustomerList, List<JeecgOrderTicket> jeecgOrderTicketList) {
|
||||
jeecgOrderMainMapper.insert(jeecgOrderMain);
|
||||
for(JeecgOrderCustomer entity:jeecgOrderCustomerList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderCustomerMapper.insert(entity);
|
||||
}
|
||||
for(JeecgOrderTicket entity:jeecgOrderTicketList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderTicketMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateMain(JeecgOrderMain jeecgOrderMain, List<JeecgOrderCustomer> jeecgOrderCustomerList, List<JeecgOrderTicket> jeecgOrderTicketList) {
|
||||
jeecgOrderMainMapper.updateById(jeecgOrderMain);
|
||||
|
||||
//1.先删除子表数据
|
||||
jeecgOrderTicketMapper.deleteTicketsByMainId(jeecgOrderMain.getId());
|
||||
jeecgOrderCustomerMapper.deleteCustomersByMainId(jeecgOrderMain.getId());
|
||||
|
||||
//2.子表数据重新插入
|
||||
for(JeecgOrderCustomer entity:jeecgOrderCustomerList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderCustomerMapper.insert(entity);
|
||||
}
|
||||
for(JeecgOrderTicket entity:jeecgOrderTicketList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderTicketMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delMain(String id) {
|
||||
jeecgOrderMainMapper.deleteById(id);
|
||||
jeecgOrderTicketMapper.deleteTicketsByMainId(id);
|
||||
jeecgOrderCustomerMapper.deleteCustomersByMainId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for(Serializable id:idList) {
|
||||
jeecgOrderMainMapper.deleteById(id);
|
||||
jeecgOrderTicketMapper.deleteTicketsByMainId(id.toString());
|
||||
jeecgOrderCustomerMapper.deleteCustomersByMainId(id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderTicketMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderTicketService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-02-15
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgOrderTicketServiceImpl extends ServiceImpl<JeecgOrderTicketMapper, JeecgOrderTicket> implements IJeecgOrderTicketService {
|
||||
@Autowired
|
||||
private JeecgOrderTicketMapper jeecgOrderTicketMapper;
|
||||
|
||||
@Override
|
||||
public List<JeecgOrderTicket> selectTicketsByMainId(String mainId) {
|
||||
return jeecgOrderTicketMapper.selectTicketsByMainId(mainId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.demo.test.vo;
|
||||
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JeecgOrderMainPage {
|
||||
|
||||
private JeecgOrderMain jeecgOrderMain;
|
||||
private List<JeecgOrderCustomer> jeecgOrderCustomerList;
|
||||
private List<JeecgOrderTicket> jeecgOrderTicketList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,297 @@
|
||||
package org.jeecg.modules.quartz.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobBuilder;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.TriggerBuilder;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 定时任务在线管理
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-01-02
|
||||
* @version:V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/quartzJob")
|
||||
@Slf4j
|
||||
public class QuartzJobController {
|
||||
@Autowired
|
||||
private IQuartzJobService quartzJobService;
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param quartzJob
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<QuartzJob>> queryPageList(QuartzJob quartzJob, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<QuartzJob>> result = new Result<IPage<QuartzJob>>();
|
||||
QueryWrapper<QuartzJob> queryWrapper = new QueryWrapper<QuartzJob>(quartzJob);
|
||||
Page<QuartzJob> page = new Page<QuartzJob>(pageNo, pageSize);
|
||||
// 排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if ("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
} else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
IPage<QuartzJob> pageList = quartzJobService.page(page, queryWrapper);
|
||||
// log.info("查询当前页:" + pageList.getCurrent());
|
||||
// log.info("查询当前页数量:" + pageList.getSize());
|
||||
// log.info("查询结果数量:" + pageList.getRecords().size());
|
||||
// log.info("数据总数:" + pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加定时任务
|
||||
*
|
||||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<?> add(@RequestBody QuartzJob quartzJob) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
|
||||
List<QuartzJob> list = quartzJobService.findByJobClassName(quartzJob.getJobClassName());
|
||||
if (list != null && list.size() > 0) {
|
||||
return Result.error("该定时任务类名已存在");
|
||||
}
|
||||
try {
|
||||
schedulerAdd(quartzJob.getJobClassName().trim(), quartzJob.getCronExpression().trim(), quartzJob.getParameter());
|
||||
//
|
||||
quartzJob.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
quartzJob.setStatus(CommonConstant.STATUS_NORMAL);
|
||||
quartzJobService.save(quartzJob);
|
||||
result.success("创建定时任务成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("创建定时任务失败,"+e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新定时任务
|
||||
*
|
||||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<QuartzJob> eidt(@RequestBody QuartzJob quartzJob) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
QuartzJob quartzJobEntity = quartzJobService.getById(quartzJob.getId());
|
||||
if (quartzJobEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
schedulerDelete(quartzJob.getJobClassName().trim());
|
||||
if(CommonConstant.STATUS_NORMAL == quartzJob.getStatus()) {
|
||||
schedulerAdd(quartzJob.getJobClassName().trim(), quartzJob.getCronExpression().trim(), quartzJob.getParameter());
|
||||
}
|
||||
boolean ok = quartzJobService.updateById(quartzJob);
|
||||
if (ok) {
|
||||
result.success("更新定时任务成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<QuartzJob> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
if (quartzJob == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
schedulerDelete(job.getJobClassName().trim());
|
||||
boolean ok = quartzJobService.removeById(id);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<QuartzJob> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
for (String id : Arrays.asList(ids.split(","))) {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
schedulerDelete(job.getJobClassName().trim());
|
||||
quartzJobService.removeById(id);
|
||||
}
|
||||
result.success("删除定时任务成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停定时任务
|
||||
* @param job
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/pause", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "暂停定时任务")
|
||||
public Result<Object> pauseJob(@RequestBody QuartzJob job) {
|
||||
|
||||
try {
|
||||
scheduler.pauseJob(JobKey.jobKey(job.getJobClassName().trim()));
|
||||
} catch (SchedulerException e) {
|
||||
throw new JeecgBootException("暂停定时任务失败");
|
||||
}
|
||||
job.setStatus(CommonConstant.STATUS_DISABLE);
|
||||
quartzJobService.updateById(job);
|
||||
return Result.ok("暂停定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动定时任务
|
||||
* @param job
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/resume", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "恢复定时任务")
|
||||
public Result<Object> resumeJob(@RequestBody QuartzJob job) {
|
||||
|
||||
try {
|
||||
scheduler.resumeJob(JobKey.jobKey(job.getJobClassName().trim()));
|
||||
} catch (SchedulerException e) {
|
||||
throw new JeecgBootException("恢复定时任务失败");
|
||||
}
|
||||
job.setStatus(CommonConstant.STATUS_NORMAL);
|
||||
quartzJobService.updateById(job);
|
||||
return Result.ok("恢复定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<QuartzJob> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
if (quartzJob == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(quartzJob);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加定时任务
|
||||
*
|
||||
* @param jobClassName
|
||||
* @param cronExpression
|
||||
* @param parameter
|
||||
*/
|
||||
private void schedulerAdd(String jobClassName, String cronExpression, String parameter) {
|
||||
|
||||
try {
|
||||
// 启动调度器
|
||||
scheduler.start();
|
||||
|
||||
// 构建job信息
|
||||
JobDetail jobDetail = JobBuilder.newJob(getClass(jobClassName).getClass()).withIdentity(jobClassName).usingJobData("parameter", parameter).build();
|
||||
|
||||
// 表达式调度构建器(即任务执行的时间)
|
||||
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);
|
||||
|
||||
// 按新的cronExpression表达式构建一个新的trigger
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(jobClassName).withSchedule(scheduleBuilder).build();
|
||||
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
} catch (SchedulerException e) {
|
||||
log.error(e.toString());
|
||||
throw new JeecgBootException("创建定时任务失败");
|
||||
} catch (Exception e) {
|
||||
throw new JeecgBootException("后台找不到该类名任务");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务
|
||||
*
|
||||
* @param jobClassName
|
||||
*/
|
||||
private void schedulerDelete(String jobClassName) {
|
||||
|
||||
try {
|
||||
scheduler.pauseTrigger(TriggerKey.triggerKey(jobClassName));
|
||||
scheduler.unscheduleJob(TriggerKey.triggerKey(jobClassName));
|
||||
scheduler.deleteJob(JobKey.jobKey(jobClassName));
|
||||
} catch (Exception e) {
|
||||
throw new JeecgBootException("删除定时任务失败");
|
||||
}
|
||||
}
|
||||
|
||||
private static Job getClass(String classname) throws Exception {
|
||||
Class<?> class1 = Class.forName(classname);
|
||||
return (Job) class1.newInstance();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package org.jeecg.modules.quartz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-01-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_quartz_job")
|
||||
public class QuartzJob implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**删除状态*/
|
||||
private java.lang.Integer delFlag;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
/**任务类名*/
|
||||
private java.lang.String jobClassName;
|
||||
/**cron表达式*/
|
||||
private java.lang.String cronExpression;
|
||||
/**参数*/
|
||||
private java.lang.String parameter;
|
||||
/**描述*/
|
||||
private java.lang.String description;
|
||||
/**状态 0正常 -1停止*/
|
||||
private java.lang.Integer status;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 示例不带参定时任务
|
||||
*
|
||||
* @author Scott
|
||||
*/
|
||||
@Slf4j
|
||||
public class SampleJob implements Job {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
log.info(String.format(" Jeecg-Boot 普通定时任务 SampleJob ! 时间:" + DateUtils.getTimestamp()));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 示例带参定时任务
|
||||
*
|
||||
* @author Scott
|
||||
*/
|
||||
@Slf4j
|
||||
public class SampleParamJob implements Job {
|
||||
|
||||
/**
|
||||
* 若参数变量名修改 QuartzJobController中也需对应修改
|
||||
*/
|
||||
private String parameter;
|
||||
|
||||
public void setParameter(String parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
log.info(String.format("welcome %s! Jeecg-Boot 带参数定时任务 SampleParamJob ! 时间:" + DateUtils.now(), this.parameter));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package org.jeecg.modules.quartz.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-01-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface QuartzJobMapper extends BaseMapper<QuartzJob> {
|
||||
|
||||
public List<QuartzJob> findByJobClassName(@Param("jobClassName") String jobClassName);
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.quartz.mapper.QuartzJobMapper">
|
||||
|
||||
<!-- 根据jobClassName查询 -->
|
||||
<select id="findByJobClassName" resultType="org.jeecg.modules.quartz.entity.QuartzJob">
|
||||
select * from sys_quartz_job where job_class_name = #{jobClassName}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.quartz.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-01-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IQuartzJobService extends IService<QuartzJob> {
|
||||
|
||||
List<QuartzJob> findByJobClassName(String jobClassName);
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.quartz.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
import org.jeecg.modules.quartz.mapper.QuartzJobMapper;
|
||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-01-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob> implements IQuartzJobService {
|
||||
@Autowired
|
||||
private QuartzJobMapper quartzJobMapper;
|
||||
|
||||
@Override
|
||||
public List<QuartzJob> findByJobClassName(String jobClassName) {
|
||||
return quartzJobMapper.findByJobClassName(jobClassName);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package org.jeecg.modules.shiro.authc;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
|
||||
/**
|
||||
* @author Scott
|
||||
* @create 2018-07-12 15:19
|
||||
* @desc
|
||||
**/
|
||||
public class JwtToken implements AuthenticationToken {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String token;
|
||||
|
||||
public JwtToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,185 @@
|
||||
package org.jeecg.modules.shiro.authc;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.SimpleAuthenticationInfo;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
||||
import org.apache.shiro.realm.AuthorizingRealm;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.shiro.authc.util.JwtUtil;
|
||||
import org.jeecg.modules.system.entity.SysPermission;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.service.ISysPermissionService;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author Scott
|
||||
* @create 2018-07-12 15:23
|
||||
* @desc
|
||||
**/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MyRealm extends AuthorizingRealm {
|
||||
|
||||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
* 必须重写此方法,不然Shiro会报错
|
||||
*/
|
||||
@Override
|
||||
public boolean supports(AuthenticationToken token) {
|
||||
return token instanceof JwtToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取授权信息 Shiro中,只有当需要检测用户权限的时候才会调用此方法,例如checkRole,checkPermission之类的
|
||||
*/
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
||||
log.info("————权限认证 [ roles、permissions]————");
|
||||
SysUser sysUser = null;
|
||||
String username = null;
|
||||
if(principals!=null) {
|
||||
sysUser = (SysUser) principals.getPrimaryPrincipal();
|
||||
username = sysUser.getUsername();
|
||||
}
|
||||
|
||||
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
||||
// 设置该用户拥有角色
|
||||
List<String> roles = null;
|
||||
//从redis缓存中查询权限角色
|
||||
String rolesStr = stringRedisTemplate.opsForValue().get(CommonConstant.PREFIX_USER_ROLE + username);
|
||||
if (rolesStr != null) {
|
||||
roles = JSON.parseArray(rolesStr.toString(), String.class);
|
||||
} else {
|
||||
//从数据库查询权限放到redis中
|
||||
roles = sysUserService.getRole(username);
|
||||
stringRedisTemplate.opsForValue().set(CommonConstant.PREFIX_USER_ROLE + username, JSON.toJSONString(roles));
|
||||
}
|
||||
//设置超时时间
|
||||
stringRedisTemplate.expire(CommonConstant.PREFIX_USER_ROLE + username, CommonConstant.TOKEN_EXPIRE_TIME, TimeUnit.SECONDS);
|
||||
|
||||
/**
|
||||
* 设置该用户拥有的角色,比如“admin,test”
|
||||
*/
|
||||
info.setRoles(new HashSet<>(roles));
|
||||
|
||||
// TODO 测试数据
|
||||
String permissions = "sys:role:update2,sys:role:add,/sys/user/add";
|
||||
Set<String> permission = new HashSet<>(Arrays.asList(permissions.split(",")));
|
||||
|
||||
// 从数据库获取所有的权限
|
||||
Set<String> permissionSet = new HashSet<>();
|
||||
List<SysPermission> permissionList = sysPermissionService.queryByUser(username);
|
||||
for (SysPermission po : permissionList) {
|
||||
if (oConvertUtils.isNotEmpty(po.getUrl()) || oConvertUtils.isNotEmpty(po.getPerms())) {
|
||||
if (oConvertUtils.isNotEmpty(po.getUrl())) {
|
||||
//TODO URL是怎么控制的?
|
||||
permissionSet.add(po.getUrl());
|
||||
} else if (oConvertUtils.isNotEmpty(po.getPerms())) {
|
||||
permissionSet.add(po.getPerms());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
info.addStringPermissions(permissionSet);
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取身份验证信息 Shiro中,默认使用此方法进行用户名正确与否验证,错误抛出异常即可。
|
||||
*
|
||||
* @param authenticationToken 用户身份信息 token
|
||||
* @return 返回封装了用户信息的 AuthenticationInfo 实例
|
||||
*/
|
||||
@Override
|
||||
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
|
||||
log.debug("————身份认证方法————");
|
||||
String token = (String) auth.getCredentials();
|
||||
if (token == null) {
|
||||
throw new AuthenticationException("token为空!");
|
||||
}
|
||||
// 解密获得username,用于和数据库进行对比
|
||||
String username = JwtUtil.getUsername(token);
|
||||
if (username == null) {
|
||||
throw new AuthenticationException("token非法无效!");
|
||||
}
|
||||
|
||||
// 查询用户信息
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
if (sysUser == null) {
|
||||
throw new AuthenticationException("用户不存在!");
|
||||
}
|
||||
|
||||
//校验token是否超时失效 & 或者账号密码是否错误
|
||||
if (!jwtTokenRefresh(token, username, sysUser.getPassword())) {
|
||||
throw new AuthenticationException("用户名或密码错误!");
|
||||
}
|
||||
|
||||
// 判断用户状态
|
||||
if (sysUser.getStatus() != 1) {
|
||||
throw new AuthenticationException("账号已被锁定,请联系管理员!");
|
||||
}
|
||||
|
||||
return new SimpleAuthenticationInfo(sysUser, token, getName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* JWTToken刷新生命周期 1、登录成功后将用户的JWT生成的Token作为k、v存储到cache缓存里面(这时候k、v值一样)
|
||||
* 2、当该用户再次请求时,通过JWTFilter层层校验之后会进入到doGetAuthenticationInfo进行身份验证
|
||||
* 3、当该用户这次请求JWTToken值还在生命周期内,则会通过重新PUT的方式k、v都为Token值,缓存中的token值生命周期时间重新计算(这时候k、v值一样)
|
||||
* 4、当该用户这次请求jwt生成的token值已经超时,但该token对应cache中的k还是存在,则表示该用户一直在操作只是JWT的token失效了,程序会给token对应的k映射的v值重新生成JWTToken并覆盖v值,该缓存生命周期重新计算
|
||||
* 5、当该用户这次请求jwt在生成的token值已经超时,并在cache中不存在对应的k,则表示该用户账户空闲超时,返回用户信息已失效,请重新登录。
|
||||
* 6、每次当返回为true情况下,都会给Response的Header中设置Authorization,该Authorization映射的v为cache对应的v值。
|
||||
* 7、注:当前端接收到Response的Header中的Authorization值会存储起来,作为以后请求token使用
|
||||
*
|
||||
* @param userName
|
||||
* @param passWord
|
||||
* @return
|
||||
*/
|
||||
public boolean jwtTokenRefresh(String token, String userName, String passWord) {
|
||||
String cacheToken = String.valueOf(redisUtil.get(CommonConstant.PREFIX_USER_TOKEN + token));
|
||||
if (oConvertUtils.isNotEmpty(cacheToken)) {
|
||||
//校验token有效性
|
||||
if (!JwtUtil.verify(token, userName, passWord)) {
|
||||
String newAuthorization = JwtUtil.sign(userName, passWord);
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, newAuthorization);
|
||||
//设置超时时间
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME/1000);
|
||||
} else {
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, cacheToken);
|
||||
//设置超时时间
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME/1000);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package org.jeecg.modules.shiro.authc.aop;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
|
||||
import org.jeecg.modules.shiro.authc.JwtToken;
|
||||
import org.jeecg.modules.shiro.vo.DefContants;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author Scott
|
||||
* @create 2018-07-12 15:56
|
||||
* @desc 鉴权登录拦截器
|
||||
**/
|
||||
@Slf4j
|
||||
public class JwtFilter extends BasicHttpAuthenticationFilter {
|
||||
|
||||
/**
|
||||
* 执行登录认证
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param mappedValue
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
|
||||
try {
|
||||
executeLogin(request, response);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
throw new AuthenticationException("Token失效,请重新登录", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
String token = httpServletRequest.getHeader(DefContants.X_ACCESS_TOKEN);
|
||||
|
||||
JwtToken jwtToken = new JwtToken(token);
|
||||
// 提交给realm进行登入,如果错误他会抛出异常并被捕获
|
||||
getSubject(request, response).login(jwtToken);
|
||||
// 如果没有抛出异常则代表登入成功,返回true
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对跨域提供支持
|
||||
*/
|
||||
@Override
|
||||
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
|
||||
httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin"));
|
||||
httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE");
|
||||
httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers"));
|
||||
// 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态
|
||||
if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {
|
||||
httpServletResponse.setStatus(HttpStatus.OK.value());
|
||||
return false;
|
||||
}
|
||||
return super.preHandle(request, response);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package org.jeecg.modules.shiro.authc.aop;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author Scott
|
||||
* @create 2019-02-01 15:56
|
||||
* @desc 鉴权请求URL访问权限拦截器
|
||||
*/
|
||||
@Slf4j
|
||||
public class ResourceCheckFilter extends AccessControlFilter {
|
||||
|
||||
private String errorUrl;
|
||||
|
||||
public String getErrorUrl() {
|
||||
return errorUrl;
|
||||
}
|
||||
|
||||
public void setErrorUrl(String errorUrl) {
|
||||
this.errorUrl = errorUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 表示是否允许访问 ,如果允许访问返回true,否则false;
|
||||
* @param servletRequest
|
||||
* @param servletResponse
|
||||
* @param o 表示写在拦截器中括号里面的字符串 mappedValue 就是 [urls] 配置中拦截器参数部分
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object o) throws Exception {
|
||||
Subject subject = getSubject(servletRequest,servletResponse);
|
||||
String url = getPathWithinApplication(servletRequest);
|
||||
log.info("当前用户正在访问的 url => " + url);
|
||||
return subject.isPermitted(url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* onAccessDenied:表示当访问拒绝时是否已经处理了;
|
||||
* 如果返回 true 表示需要继续处理;
|
||||
* 如果返回 false 表示该拦截器实例已经处理了,将直接返回即可。
|
||||
|
||||
* @param servletRequest
|
||||
* @param servletResponse
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
protected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
log.info("当 isAccessAllowed 返回 false 的时候,才会执行 method onAccessDenied ");
|
||||
|
||||
HttpServletRequest request =(HttpServletRequest) servletRequest;
|
||||
HttpServletResponse response =(HttpServletResponse) servletResponse;
|
||||
response.sendRedirect(request.getContextPath() + this.errorUrl);
|
||||
|
||||
|
||||
// 返回 false 表示已经处理,例如页面跳转啥的,表示不在走以下的拦截器了(如果还有配置的话)
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package org.jeecg.modules.shiro.authc.util;
|
||||
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.JWTDecodeException;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import java.util.Date;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
* @author Scott
|
||||
* @create 2018-07-12 14:23
|
||||
* @desc JWT工具类
|
||||
**/
|
||||
public class JwtUtil {
|
||||
|
||||
// 过期时间30分钟
|
||||
public static final long EXPIRE_TIME = 1 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* 校验token是否正确
|
||||
*
|
||||
* @param token 密钥
|
||||
* @param secret 用户的密码
|
||||
* @return 是否正确
|
||||
*/
|
||||
public static boolean verify(String token, String username, String secret) {
|
||||
try {
|
||||
// 根据密码生成JWT效验器
|
||||
Algorithm algorithm = Algorithm.HMAC256(secret);
|
||||
JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
|
||||
// 效验TOKEN
|
||||
DecodedJWT jwt = verifier.verify(token);
|
||||
return true;
|
||||
} catch (Exception exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得token中的信息无需secret解密也能获得
|
||||
*
|
||||
* @return token中包含的用户名
|
||||
*/
|
||||
public static String getUsername(String token) {
|
||||
try {
|
||||
DecodedJWT jwt = JWT.decode(token);
|
||||
return jwt.getClaim("username").asString();
|
||||
} catch (JWTDecodeException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名,5min后过期
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param secret 用户的密码
|
||||
* @return 加密的token
|
||||
*/
|
||||
public static String sign(String username, String secret) {
|
||||
Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
|
||||
Algorithm algorithm = Algorithm.HMAC256(secret);
|
||||
// 附带username信息
|
||||
return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据request中的token获取用户账号
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @throws JeecgBootException
|
||||
*/
|
||||
public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
|
||||
String accessToken = request.getHeader("X-Access-Token");
|
||||
String username = getUsername(accessToken);
|
||||
if (oConvertUtils.isEmpty(username)) {
|
||||
throw new JeecgBootException("未获取到用户");
|
||||
}
|
||||
return username;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package org.jeecg.modules.shiro.vo;
|
||||
|
||||
public class DefContants {
|
||||
|
||||
public static String X_ACCESS_TOKEN = "X-Access-Token";
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package org.jeecg.modules.shiro.vo;
|
||||
public class ResponseBean {
|
||||
|
||||
// http 状态码
|
||||
private int code;
|
||||
|
||||
// 返回信息
|
||||
private String msg;
|
||||
|
||||
// 返回的数据
|
||||
private Object data;
|
||||
|
||||
public ResponseBean(int code, String msg, Object data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package org.jeecg.modules.shiro.vo;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserBean {
|
||||
private String username;
|
||||
private String password;
|
||||
private Set<String> roles = new HashSet<>(); //用户所有角色值,用于shiro做角色权限的判断
|
||||
private Set<String> perms = new HashSet<>(); //用户所有权限值,用于shiro做资源权限的判断
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package org.jeecg.modules.shiro.web;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
import org.jeecg.modules.shiro.authc.util.JwtUtil;
|
||||
import org.jeecg.modules.shiro.vo.ResponseBean;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
public class TestWebController {
|
||||
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
public void setService(ISysUserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
@ApiOperation(value="用户登录", notes="用户登录")
|
||||
public ResponseBean login(@RequestParam("username") String username,
|
||||
@RequestParam("password") String password) {
|
||||
SysUser user = userService.getUserByName(username);
|
||||
if(user==null) {
|
||||
return new ResponseBean(200, "用户不存在!", JwtUtil.sign(username, user.getPassword()));
|
||||
}
|
||||
String passwordEncode = PasswordUtil.encrypt(username, password, user.getSalt());
|
||||
if (passwordEncode.equals(user.getPassword())) {
|
||||
return new ResponseBean(200, "Login success", JwtUtil.sign(username, user.getPassword()));
|
||||
} else {
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/article")
|
||||
public ResponseBean article() {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
if (subject.isAuthenticated()) {
|
||||
return new ResponseBean(200, "You are already logged in", null);
|
||||
} else {
|
||||
return new ResponseBean(200, "You are guest", null);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/require_auth")
|
||||
@RequiresAuthentication
|
||||
public ResponseBean requireAuth() {
|
||||
return new ResponseBean(200, "You are authenticated", null);
|
||||
}
|
||||
|
||||
@GetMapping("/require_role")
|
||||
@RequiresRoles("admin")
|
||||
public ResponseBean requireRole() {
|
||||
return new ResponseBean(200, "You are visiting require_role", null);
|
||||
}
|
||||
|
||||
@GetMapping("/require_permission")
|
||||
@RequiresPermissions(logical = Logical.AND, value = {"view", "edit"})
|
||||
public ResponseBean requirePermission() {
|
||||
return new ResponseBean(200, "You are visiting permission require edit,view", null);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/401")
|
||||
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
||||
public ResponseBean unauthorized() {
|
||||
return new ResponseBean(401, "Unauthorized", null);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <P>
|
||||
* 对应部门的表,处理并查找树级数据
|
||||
* <P>
|
||||
*
|
||||
* @author Steve
|
||||
* @Since 2019-01-22
|
||||
*/
|
||||
public class FindsDepartsChildrenUtil {
|
||||
|
||||
|
||||
private static List<DepartIdModel> idList = new ArrayList<>(4);
|
||||
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法 ====1=====
|
||||
* 该方法是s将SysDepart类型的list集合转换成SysDepartTreeModel类型的集合
|
||||
*/
|
||||
public static List<SysDepartTreeModel> wrapTreeDataToTreeList(List<SysDepart> recordList) {
|
||||
// 在该方法每请求一次,都要对全局list集合进行一次清理
|
||||
idList.clear();
|
||||
List<SysDepartTreeModel> records = new ArrayList<>();
|
||||
for (int i = 0; i < recordList.size(); i++) {
|
||||
SysDepart depart = recordList.get(i);
|
||||
records.add(new SysDepartTreeModel(recordList.get(i)));
|
||||
}
|
||||
List<SysDepartTreeModel> tree = findChildren(records, idList);
|
||||
setEmptyChildrenAsNull(tree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
public static List<DepartIdModel> wrapDepartIdModel() {
|
||||
return idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法 ====2=====
|
||||
* 该方法是找到并封装顶级父类的节点到TreeList集合
|
||||
*/
|
||||
private static List<SysDepartTreeModel> findChildren(List<SysDepartTreeModel> recordList,
|
||||
List<DepartIdModel> idList) {
|
||||
|
||||
List<SysDepartTreeModel> treeList = new ArrayList<>();
|
||||
for (int i = 0; i < recordList.size(); i++) {
|
||||
SysDepartTreeModel branch = recordList.get(i);
|
||||
if (branch.getParentId().equals("")) {
|
||||
treeList.add(branch);
|
||||
DepartIdModel departIdModel = new DepartIdModel().convert(branch);
|
||||
idList.add(departIdModel);
|
||||
}
|
||||
}
|
||||
getGrandChildren(treeList,recordList,idList);
|
||||
return treeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法====3====
|
||||
*该方法是找到顶级父类下的所有子节点集合并封装到TreeList集合
|
||||
*/
|
||||
private static void getGrandChildren(List<SysDepartTreeModel> treeList,List<SysDepartTreeModel> recordList,List<DepartIdModel> idList) {
|
||||
|
||||
for (int i = 0; i < treeList.size(); i++) {
|
||||
SysDepartTreeModel model = treeList.get(i);
|
||||
DepartIdModel idModel = idList.get(i);
|
||||
for (int i1 = 0; i1 < recordList.size(); i1++) {
|
||||
SysDepartTreeModel m = recordList.get(i1);
|
||||
if (m.getParentId().equals(model.getId())) {
|
||||
model.getChildren().add(m);
|
||||
DepartIdModel dim = new DepartIdModel().convert(m);
|
||||
idModel.getChildren().add(dim);
|
||||
}
|
||||
}
|
||||
getGrandChildren(treeList.get(i).getChildren(), recordList, idList.get(i).getChildren());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* queryTreeList的子方法 ====4====
|
||||
* 该方法是将子节点为空的List集合设置为Null值
|
||||
*/
|
||||
private static void setEmptyChildrenAsNull(List<SysDepartTreeModel> treeList) {
|
||||
|
||||
for (int i = 0; i < treeList.size(); i++) {
|
||||
SysDepartTreeModel model = treeList.get(i);
|
||||
if (model.getChildren().size() == 0) {
|
||||
model.setChildren(null);
|
||||
}else{
|
||||
setEmptyChildrenAsNull(model.getChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.shiro.authc.util.JwtUtil;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.model.SysLoginModel;
|
||||
import org.jeecg.modules.system.service.ISysLogService;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* @author scott
|
||||
* @since 2018-12-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys")
|
||||
@Api("用户登录")
|
||||
public class LoginController {
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
private ISysLogService logService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
@ApiOperation("登录接口")
|
||||
public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel) {
|
||||
Result<JSONObject> result = new Result<JSONObject>();
|
||||
String username = sysLoginModel.getUsername();
|
||||
String password = sysLoginModel.getPassword();
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
if(sysUser==null) {
|
||||
result.error500("该用户不存在");
|
||||
sysBaseAPI.addLog("登录失败,用户名:"+username+"不存在!", CommonConstant.LOG_TYPE_1, null);
|
||||
return result;
|
||||
}else {
|
||||
//密码验证
|
||||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
String syspassword = sysUser.getPassword();
|
||||
if(!syspassword.equals(userpassword)) {
|
||||
result.error500("用户名或密码错误");
|
||||
return result;
|
||||
}
|
||||
//生成token
|
||||
String token = JwtUtil.sign(username, syspassword);
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
//设置超时时间
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME/1000);
|
||||
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("token", token);
|
||||
obj.put("userInfo", sysUser);
|
||||
result.setResult(obj);
|
||||
result.success("登录成功");
|
||||
sysBaseAPI.addLog("用户名: "+username+",登录成功!", CommonConstant.LOG_TYPE_1, null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取访问量
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("loginfo")
|
||||
public Result<JSONObject> loginfo() {
|
||||
Result<JSONObject> result = new Result<JSONObject>();
|
||||
JSONObject obj = new JSONObject();
|
||||
// 获取系统访问记录
|
||||
Long totalVisitCount = logService.findTotalVisitCount();
|
||||
obj.put("totalVisitCount", totalVisitCount);
|
||||
Long todayVisitCount = logService.findTodayVisitCount();
|
||||
obj.put("todayVisitCount", todayVisitCount);
|
||||
Long todayIp = logService.findTodayIp();
|
||||
obj.put("todayIp", todayIp);
|
||||
result.setResult(obj);
|
||||
result.success("登录成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,230 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.CommonSendStatus;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.shiro.authc.util.JwtUtil;
|
||||
import org.jeecg.modules.system.entity.SysAnnouncement;
|
||||
import org.jeecg.modules.system.entity.SysDict;
|
||||
import org.jeecg.modules.system.service.ISysAnnouncementService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 系统通告表
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-01-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/annountCement")
|
||||
@Slf4j
|
||||
public class SysAnnouncementController {
|
||||
@Autowired
|
||||
private ISysAnnouncementService sysAnnouncementService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param sysAnnouncement
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysAnnouncement>> queryPageList(SysAnnouncement sysAnnouncement,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysAnnouncement>> result = new Result<IPage<SysAnnouncement>>();
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
QueryWrapper<SysAnnouncement> queryWrapper = new QueryWrapper<SysAnnouncement>(sysAnnouncement);
|
||||
Page<SysAnnouncement> page = new Page<SysAnnouncement>(pageNo,pageSize);
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
IPage<SysAnnouncement> pageList = sysAnnouncementService.page(page, queryWrapper);
|
||||
log.info("查询当前页:"+pageList.getCurrent());
|
||||
log.info("查询当前页数量:"+pageList.getSize());
|
||||
log.info("查询结果数量:"+pageList.getRecords().size());
|
||||
log.info("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param sysAnnouncement
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysAnnouncement> add(@RequestBody SysAnnouncement sysAnnouncement) {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
try {
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.UNPUBLISHED_STATUS_0);//未发布
|
||||
sysAnnouncementService.save(sysAnnouncement);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param sysAnnouncement
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<SysAnnouncement> eidt(@RequestBody SysAnnouncement sysAnnouncement) {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
SysAnnouncement sysAnnouncementEntity = sysAnnouncementService.getById(sysAnnouncement.getId());
|
||||
if(sysAnnouncementEntity==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysAnnouncementService.updateById(sysAnnouncement);
|
||||
//TODO 返回false说明什么?
|
||||
if(ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<SysAnnouncement> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_1.toString());
|
||||
boolean ok = sysAnnouncementService.updateById(sysAnnouncement);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysAnnouncement> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
String[] id = ids.split(",");
|
||||
for(int i=0;i<id.length;i++) {
|
||||
SysAnnouncement announcement = sysAnnouncementService.getById(id[i]);
|
||||
announcement.setDelFlag(CommonConstant.DEL_FLAG_1.toString());
|
||||
sysAnnouncementService.updateById(announcement);
|
||||
}
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<SysAnnouncement> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
result.setResult(sysAnnouncement);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新发布操作
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/doReleaseData", method = RequestMethod.GET)
|
||||
public Result<SysAnnouncement> doReleaseData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.PUBLISHED_STATUS_1);//发布中
|
||||
sysAnnouncement.setSendTime(new Date());
|
||||
String currentUserName = JwtUtil.getUserNameByToken(request);
|
||||
sysAnnouncement.setSender(currentUserName);
|
||||
boolean ok = sysAnnouncementService.updateById(sysAnnouncement);
|
||||
if(ok) {
|
||||
result.success("该系统通知发布成功");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新撤销操作
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/doReovkeData", method = RequestMethod.GET)
|
||||
public Result<SysAnnouncement> doReovkeData(@RequestParam(name="id",required=true) String id, HttpServletRequest request) {
|
||||
Result<SysAnnouncement> result = new Result<SysAnnouncement>();
|
||||
SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id);
|
||||
if(sysAnnouncement==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
sysAnnouncement.setSendStatus(CommonSendStatus.REVOKE_STATUS_2);//撤销发布
|
||||
sysAnnouncement.setCancelTime(new Date());
|
||||
boolean ok = sysAnnouncementService.updateById(sysAnnouncement);
|
||||
if(ok) {
|
||||
result.success("该系统通知撤销成功");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,190 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.shiro.authc.util.JwtUtil;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
||||
import org.jeecg.modules.system.service.ISysDepartService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 前端控制器
|
||||
* <p>
|
||||
*
|
||||
* @author: Steve @Since: 2019-01-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysdepart/sysDepart")
|
||||
@Slf4j
|
||||
public class SysDepartController {
|
||||
|
||||
@Autowired
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
/**
|
||||
* 查询数据 查出所有部门,并以树结构数据格式响应给前端
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
|
||||
public Result<List<SysDepartTreeModel>> queryTreeList() {
|
||||
Result<List<SysDepartTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SysDepartTreeModel> list = sysDepartService.queryTreeList();
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加新数据 添加用户新建的部门对象数据,并保存到数据库
|
||||
*
|
||||
* @param sysDepart
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
Result<SysDepart> result = new Result<SysDepart>();
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
try {
|
||||
sysDepart.setCreateBy(username);
|
||||
sysDepartService.saveDepartData(sysDepart, username);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据 编辑部门的部分数据,并保存到数据库
|
||||
*
|
||||
* @param sysDepart
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysDepart> eidt(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
sysDepart.setUpdateBy(username);
|
||||
Result<SysDepart> result = new Result<SysDepart>();
|
||||
SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
|
||||
if (sysDepartEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
|
||||
// TODO 返回false说明什么?
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {
|
||||
|
||||
Result<SysDepart> result = new Result<SysDepart>();
|
||||
SysDepart sysDepart = sysDepartService.getById(id);
|
||||
if(sysDepart==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDepartService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
|
||||
Result<SysDepart> result = new Result<SysDepart>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.sysDepartService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据 添加或编辑页面对该方法发起请求,以树结构形式加载所有部门的名称,方便用户的操作
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@RequestMapping(value = "/queryIdTree", method = RequestMethod.GET)
|
||||
public Result<List<DepartIdModel>> queryIdTree() {
|
||||
Result<List<DepartIdModel>> result = new Result<List<DepartIdModel>>();
|
||||
try {
|
||||
List<DepartIdModel> idList = FindsDepartsChildrenUtil.wrapDepartIdModel();
|
||||
result.setResult(idList); result.setSuccess(true);
|
||||
return result;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace(); result.setSuccess(false);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门搜索功能方法,根据关键字模糊搜索相关部门
|
||||
* </p>
|
||||
*
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/searchBy", method = RequestMethod.GET)
|
||||
public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord) {
|
||||
Result<List<SysDepartTreeModel>> result = new Result<List<SysDepartTreeModel>>();
|
||||
try {
|
||||
List<SysDepartTreeModel> treeList = this.sysDepartService.searhBy(keyWord);
|
||||
if (treeList.size() == 0 || treeList == null) {
|
||||
throw new Exception();
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(treeList);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(false);
|
||||
result.setMessage("查询失败或没有您想要的任何数据!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,234 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDict;
|
||||
import org.jeecg.modules.system.model.SysDictTree;
|
||||
import org.jeecg.modules.system.service.ISysDictService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhangweijian
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/dict")
|
||||
@Slf4j
|
||||
public class SysDictController {
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysDict>> queryPageList(SysDict sysDict,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysDict>> result = new Result<IPage<SysDict>>();
|
||||
QueryWrapper<SysDict> queryWrapper = new QueryWrapper<SysDict>(sysDict);
|
||||
Page<SysDict> page = new Page<SysDict>(pageNo,pageSize);
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
//创建时间/创建人的赋值
|
||||
IPage<SysDict> pageList = sysDictService.page(page, queryWrapper);
|
||||
log.info("查询当前页:"+pageList.getCurrent());
|
||||
log.info("查询当前页数量:"+pageList.getSize());
|
||||
log.info("查询结果数量:"+pageList.getRecords().size());
|
||||
log.info("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:获取树形字典数据
|
||||
* @param sysDict
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
|
||||
public Result<List<SysDictTree>> treeList(SysDict sysDict,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<List<SysDictTree>> result = new Result<>();
|
||||
LambdaQueryWrapper<SysDict> query = new LambdaQueryWrapper<>();
|
||||
// 构造查询条件
|
||||
String dictName = sysDict.getDictName();
|
||||
if(oConvertUtils.isNotEmpty(dictName)) {
|
||||
query.like(true, SysDict::getDictName, dictName);
|
||||
}
|
||||
query.eq(true, SysDict::getDelFlag, "1");
|
||||
query.orderByDesc(true, SysDict::getCreateTime);
|
||||
List<SysDict> list = sysDictService.list(query);
|
||||
List<SysDictTree> treeList = new ArrayList<>();
|
||||
for (SysDict node : list) {
|
||||
treeList.add(new SysDictTree(node));
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(treeList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据
|
||||
* @param dictCode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET)
|
||||
public Result<List<Map<String, String>>> getDictItems(@PathVariable String dictCode) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<List<Map<String,String>>> result = new Result<List<Map<String,String>>>();
|
||||
List<Map<String,String>> ls = null;
|
||||
try {
|
||||
ls = sysDictService.queryDictItemsByCode(dictCode);
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据
|
||||
* @param dictCode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getDictText/{dictCode}/{key}", method = RequestMethod.GET)
|
||||
public Result<String> getDictItems(@PathVariable("dictCode") String dictCode, @PathVariable("key") String key) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<String> result = new Result<String>();
|
||||
String text = null;
|
||||
try {
|
||||
text = sysDictService.queryDictTextByKey(dictCode, key);
|
||||
result.setSuccess(true);
|
||||
result.setResult(text);
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:新增
|
||||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysDict> add(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
try {
|
||||
sysDict.setCreateTime(new Date());
|
||||
sysDictService.save(sysDict);
|
||||
result.success("保存成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:编辑
|
||||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<SysDict> edit(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
SysDict sysdict = sysDictService.getById(sysDict.getId());
|
||||
if(sysdict==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
sysDict.setUpdateTime(new Date());
|
||||
boolean ok = sysDictService.updateById(sysDict);
|
||||
//TODO 返回false说明什么?
|
||||
if(ok) {
|
||||
result.success("编辑成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<SysDict> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
SysDict sysDict = sysDictService.getById(id);
|
||||
if(sysDict==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
sysDict.setDelFlag(2);
|
||||
boolean ok = sysDictService.updateById(sysDict);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysDict> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
String[] id=ids.split(",");
|
||||
for(int i=0;i<id.length;i++) {
|
||||
SysDict sysDict = sysDictService.getById(id[i]);
|
||||
sysDict.setDelFlag(2);
|
||||
sysDictService.updateById(sysDict);
|
||||
}
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,161 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDictItem;
|
||||
import org.jeecg.modules.system.service.ISysDictItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhangweijian
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/dictItem")
|
||||
@Slf4j
|
||||
public class SysDictItemController {
|
||||
|
||||
@Autowired
|
||||
private ISysDictItemService sysDictItemService;
|
||||
|
||||
/**
|
||||
* @功能:查询字典数据
|
||||
* @param sysDictItem
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysDictItem>> queryPageList(SysDictItem sysDictItem,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysDictItem>> result = new Result<IPage<SysDictItem>>();
|
||||
QueryWrapper<SysDictItem> queryWrapper = new QueryWrapper<SysDictItem>(sysDictItem);
|
||||
Page<SysDictItem> page = new Page<SysDictItem>(pageNo,pageSize);
|
||||
//update-begin--Author:zhangweijian Date:20190103 for:新增排序处理
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
//update-end--Author:zhangweijian Date:20190103 for:根据业务配置id查询
|
||||
//TODO 过滤逻辑处理
|
||||
//TODO begin、end逻辑处理
|
||||
//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
|
||||
//创建时间/创建人的赋值
|
||||
IPage<SysDictItem> pageList = sysDictItemService.page(page, queryWrapper);
|
||||
log.info("查询当前页:"+pageList.getCurrent());
|
||||
log.info("查询当前页数量:"+pageList.getSize());
|
||||
log.info("查询结果数量:"+pageList.getRecords().size());
|
||||
log.info("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:新增
|
||||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysDictItem> add(@RequestBody SysDictItem sysDictItem) {
|
||||
Result<SysDictItem> result = new Result<SysDictItem>();
|
||||
try {
|
||||
sysDictItem.setCreateTime(new Date());
|
||||
sysDictItemService.save(sysDictItem);
|
||||
result.success("保存成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:编辑
|
||||
* @param sysDictItem
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) {
|
||||
Result<SysDictItem> result = new Result<SysDictItem>();
|
||||
SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId());
|
||||
if(sysdict==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
sysDictItem.setUpdateTime(new Date());
|
||||
boolean ok = sysDictItemService.updateById(sysDictItem);
|
||||
//TODO 返回false说明什么?
|
||||
if(ok) {
|
||||
result.success("编辑成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:删除字典数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<SysDictItem> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysDictItem> result = new Result<SysDictItem>();
|
||||
SysDictItem joinSystem = sysDictItemService.getById(id);
|
||||
if(joinSystem==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysDictItemService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:批量删除字典数据
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysDictItem> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysDictItem> result = new Result<SysDictItem>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.sysDictItemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,133 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysLog;
|
||||
import org.jeecg.modules.system.entity.SysRole;
|
||||
import org.jeecg.modules.system.service.ISysLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统日志表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhangweijian
|
||||
* @since 2018-12-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/log")
|
||||
@Slf4j
|
||||
public class SysLogController {
|
||||
|
||||
@Autowired
|
||||
private ISysLogService sysLogService;
|
||||
|
||||
/**
|
||||
* @功能:查询日志记录
|
||||
* @param syslog
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysLog>> queryPageList(SysLog syslog,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysLog>> result = new Result<IPage<SysLog>>();
|
||||
QueryWrapper<SysLog> queryWrapper = new QueryWrapper<SysLog>(syslog);
|
||||
Page<SysLog> page = new Page<SysLog>(pageNo,pageSize);
|
||||
//开始结束时间
|
||||
String beginTime = req.getParameter("createTime_begin");
|
||||
String endTime = req.getParameter("createTime_end");
|
||||
if(oConvertUtils.isNotEmpty(beginTime) && oConvertUtils.isNotEmpty(endTime)) {
|
||||
queryWrapper.ge(oConvertUtils.camelToUnderline("createTime"), beginTime);
|
||||
queryWrapper.le(oConvertUtils.camelToUnderline("createTime"), endTime);
|
||||
}
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
//日志关键词
|
||||
String keyWord = req.getParameter("keyWord");
|
||||
if(oConvertUtils.isNotEmpty(keyWord)) {
|
||||
queryWrapper.like("log_content",keyWord);
|
||||
}
|
||||
//TODO 过滤逻辑处理
|
||||
//TODO begin、end逻辑处理
|
||||
//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
|
||||
//创建时间/创建人的赋值
|
||||
IPage<SysLog> pageList = sysLogService.page(page, queryWrapper);
|
||||
log.info("查询当前页:"+pageList.getCurrent());
|
||||
log.info("查询当前页数量:"+pageList.getSize());
|
||||
log.info("查询结果数量:"+pageList.getRecords().size());
|
||||
log.info("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:删除单个日志记录
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<SysLog> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysLog> result = new Result<SysLog>();
|
||||
SysLog sysLog = sysLogService.getById(id);
|
||||
if(sysLog==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysLogService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:批量,全部清空日志记录
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysRole> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
if("allclear".equals(ids)) {
|
||||
this.sysLogService.removeAll();
|
||||
result.success("清除成功!");
|
||||
}
|
||||
this.sysLogService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,408 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.MD5Util;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysPermission;
|
||||
import org.jeecg.modules.system.entity.SysRolePermission;
|
||||
import org.jeecg.modules.system.model.SysPermissionTree;
|
||||
import org.jeecg.modules.system.model.TreeModel;
|
||||
import org.jeecg.modules.system.service.ISysPermissionService;
|
||||
import org.jeecg.modules.system.service.ISysRolePermissionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单权限表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author scott
|
||||
* @since 2018-12-21
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/permission")
|
||||
public class SysPermissionController {
|
||||
|
||||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysRolePermissionService sysRolePermissionService;
|
||||
|
||||
|
||||
/**
|
||||
* 加载数据节点
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<List<SysPermissionTree>> list() {
|
||||
//@RequestParam(name="pid",required=false) String parentId
|
||||
Result<List<SysPermissionTree>> result = new Result<>();
|
||||
try {
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>();
|
||||
query.eq(SysPermission::getDelFlag, 0);
|
||||
query.orderByAsc(SysPermission::getSortNo);
|
||||
List<SysPermission> list = sysPermissionService.list(query);
|
||||
List<SysPermissionTree> treeList = new ArrayList<>();
|
||||
getTreeList(treeList, list, null);
|
||||
result.setResult(treeList);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户的权限
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryByUser", method = RequestMethod.GET)
|
||||
public Result<JSONArray> queryByUser(HttpServletRequest req) {
|
||||
Result<JSONArray> result = new Result<>();
|
||||
try {
|
||||
String username = req.getParameter("username");
|
||||
List<SysPermission> metaList = sysPermissionService.queryByUser(username);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
this.getPermissionJsonArray(jsonArray, metaList, null);
|
||||
result.setResult(jsonArray);
|
||||
result.success("查询成功");
|
||||
} catch (Exception e) {
|
||||
result.error500("查询失败:"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysPermission> add(@RequestBody SysPermission permission) {
|
||||
Result<SysPermission> result = new Result<SysPermission>();
|
||||
try {
|
||||
sysPermissionService.addPermission(permission);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysPermission> eidt(@RequestBody SysPermission permission) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
try {
|
||||
sysPermissionService.editPermission(permission);
|
||||
result.success("修改成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysPermission> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
try {
|
||||
sysPermissionService.deletePermission(id);
|
||||
result.success("删除成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.error500(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysPermission> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
try {
|
||||
String arr[] = ids.split(",");
|
||||
for (String id : arr) {
|
||||
if(oConvertUtils.isNotEmpty(id)) {
|
||||
sysPermissionService.deletePermission(id);
|
||||
}
|
||||
}
|
||||
result.success("删除成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.error500("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部的权限树
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
|
||||
public Result<Map<String,Object>> queryTreeList() {
|
||||
Result<Map<String,Object>> result = new Result<>();
|
||||
//全部权限ids
|
||||
List<String> ids = new ArrayList<>();
|
||||
try {
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>();
|
||||
query.eq(SysPermission::getDelFlag, 0);
|
||||
query.orderByAsc(SysPermission::getSortNo);
|
||||
List<SysPermission> list = sysPermissionService.list(query);
|
||||
for(SysPermission sysPer : list) {
|
||||
ids.add(sysPer.getId());
|
||||
}
|
||||
|
||||
System.out.println(list.size());
|
||||
List<TreeModel> treeList = new ArrayList<>();
|
||||
getTreeModelList(treeList, list, null);
|
||||
|
||||
Map<String,Object> resMap = new HashMap<String,Object>();
|
||||
resMap.put("treeList", treeList); //全部树节点数据
|
||||
resMap.put("ids", ids);//全部树ids
|
||||
result.setResult(resMap);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 异步加载数据节点
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryListAsync", method = RequestMethod.GET)
|
||||
public Result<List<TreeModel>> queryAsync(@RequestParam(name="pid",required=false) String parentId) {
|
||||
Result<List<TreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<TreeModel> list = sysPermissionService.queryListByParentId(parentId);
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到角色信息");
|
||||
}else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询角色授权
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryRolePermission", method = RequestMethod.GET)
|
||||
public Result<List<String>> queryRolePermission(@RequestParam(name="roleId",required=true) String roleId) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
try {
|
||||
List<SysRolePermission> list = sysRolePermissionService.list(new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId));
|
||||
result.setResult(list.stream().map(SysRolePermission -> String.valueOf(SysRolePermission.getPermissionId())).collect(Collectors.toList()));
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色授权
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/saveRolePermission", method = RequestMethod.POST)
|
||||
public Result<String> saveRolePermission(@RequestBody JSONObject json) {
|
||||
Result<String> result = new Result<>();
|
||||
try {
|
||||
String roleId = json.getString("roleId");
|
||||
String permissionIds = json.getString("permissionIds");
|
||||
this.sysRolePermissionService.saveRolePermission(roleId, permissionIds);
|
||||
result.success("保存成功!");
|
||||
} catch (Exception e) {
|
||||
result.error500("授权失败!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void getTreeList(List<SysPermissionTree> treeList,List<SysPermission> metaList,SysPermissionTree temp) {
|
||||
for (SysPermission permission : metaList) {
|
||||
String tempPid = permission.getParentId();
|
||||
SysPermissionTree tree = new SysPermissionTree(permission);
|
||||
if(temp==null && oConvertUtils.isEmpty(tempPid)) {
|
||||
treeList.add(tree);
|
||||
if(tree.getIsLeaf()==0) {
|
||||
getTreeList(treeList, metaList, tree);
|
||||
}
|
||||
}else if(temp!=null && tempPid!=null && tempPid.equals(temp.getId())){
|
||||
temp.getChildren().add(tree);
|
||||
if(tree.getIsLeaf()==0) {
|
||||
getTreeList(treeList, metaList, tree);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void getTreeModelList(List<TreeModel> treeList,List<SysPermission> metaList,TreeModel temp) {
|
||||
for (SysPermission permission : metaList) {
|
||||
String tempPid = permission.getParentId();
|
||||
TreeModel tree = new TreeModel(permission);
|
||||
if(temp==null && oConvertUtils.isEmpty(tempPid)) {
|
||||
treeList.add(tree);
|
||||
if(permission.getIsLeaf()==0) {
|
||||
getTreeModelList(treeList, metaList, tree);
|
||||
}
|
||||
}else if(temp!=null && tempPid!=null && tempPid.equals(temp.getKey())){
|
||||
temp.getChildren().add(tree);
|
||||
if(permission.getIsLeaf()==0) {
|
||||
getTreeModelList(treeList, metaList, tree);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取菜单JSON数组
|
||||
* @param jsonArray
|
||||
* @param metaList
|
||||
* @param parentJson
|
||||
*/
|
||||
private void getPermissionJsonArray(JSONArray jsonArray,List<SysPermission> metaList,JSONObject parentJson) {
|
||||
for (SysPermission permission : metaList) {
|
||||
if(permission.getMenuType()==null) {
|
||||
continue;
|
||||
}
|
||||
String tempPid = permission.getParentId();
|
||||
JSONObject json = getPermissionJsonObject(permission);
|
||||
if(parentJson==null && oConvertUtils.isEmpty(tempPid)) {
|
||||
jsonArray.add(json);
|
||||
if(permission.getIsLeaf()==0) {
|
||||
getPermissionJsonArray(jsonArray, metaList, json);
|
||||
}
|
||||
}else if(parentJson!=null && oConvertUtils.isNotEmpty(tempPid) && tempPid.equals(parentJson.getString("id"))){
|
||||
if(permission.getMenuType()==0) {
|
||||
JSONObject metaJson = parentJson.getJSONObject("meta");
|
||||
if(metaJson.containsKey("permissionList")) {
|
||||
metaJson.getJSONArray("permissionList").add(json);
|
||||
}else {
|
||||
JSONArray permissionList = new JSONArray();
|
||||
permissionList.add(json);
|
||||
metaJson.put("permissionList", permissionList);
|
||||
}
|
||||
|
||||
}else if(permission.getMenuType()==1) {
|
||||
if(parentJson.containsKey("children")) {
|
||||
parentJson.getJSONArray("children").add(json);
|
||||
}else {
|
||||
JSONArray children = new JSONArray();
|
||||
children.add(json);
|
||||
parentJson.put("children", children);
|
||||
}
|
||||
|
||||
if(permission.getIsLeaf()==0) {
|
||||
getPermissionJsonArray(jsonArray, metaList, json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private JSONObject getPermissionJsonObject(SysPermission permission) {
|
||||
JSONObject json = new JSONObject();
|
||||
//类型(0:一级菜单 1:子菜单 2:按钮)
|
||||
if(permission.getMenuType()==2) {
|
||||
json.put("action", permission.getPerms());
|
||||
json.put("describe", permission.getName());
|
||||
}else if(permission.getMenuType()==0||permission.getMenuType()==1) {
|
||||
json.put("id", permission.getId());
|
||||
if(permission.getUrl()!=null&&(permission.getUrl().startsWith("http://")||permission.getUrl().startsWith("https://"))) {
|
||||
json.put("path", MD5Util.MD5Encode(permission.getUrl(), "utf-8"));
|
||||
}else {
|
||||
json.put("path", permission.getUrl());
|
||||
}
|
||||
|
||||
//重要规则:路由name (通过URL生成路由name,路由name供前端开发,页面跳转使用)
|
||||
json.put("name", urlToRouteName(permission.getUrl()));
|
||||
|
||||
//是否隐藏路由,默认都是显示的
|
||||
if(permission.isHidden()) {
|
||||
json.put("hidden",true);
|
||||
}
|
||||
//聚合路由
|
||||
if(permission.isAlwaysShow()) {
|
||||
json.put("alwaysShow",true);
|
||||
}
|
||||
json.put("component", permission.getComponent());
|
||||
JSONObject meta = new JSONObject();
|
||||
meta.put("title", permission.getName());
|
||||
if(oConvertUtils.isEmpty(permission.getParentId())) {
|
||||
//一级菜单跳转地址
|
||||
json.put("redirect",permission.getRedirect());
|
||||
meta.put("icon", oConvertUtils.getString(permission.getIcon(), ""));
|
||||
}else {
|
||||
meta.put("icon", oConvertUtils.getString(permission.getIcon(), ""));
|
||||
}
|
||||
if(permission.getUrl()!=null&&(permission.getUrl().startsWith("http://")||permission.getUrl().startsWith("https://"))) {
|
||||
meta.put("url", permission.getUrl());
|
||||
}
|
||||
json.put("meta", meta);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过URL生成路由name(去掉URL前缀斜杠,替换内容中的斜杠‘/’为-)
|
||||
* 举例: URL = /isystem/role
|
||||
* RouteName = isystem-role
|
||||
* @return
|
||||
*/
|
||||
private String urlToRouteName(String url) {
|
||||
if(oConvertUtils.isNotEmpty(url)) {
|
||||
if(url.startsWith("/")) {
|
||||
url = url.substring(1);
|
||||
}
|
||||
url = url.replace("/", "-");
|
||||
return url;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,233 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysRole;
|
||||
import org.jeecg.modules.system.service.ISysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author scott
|
||||
* @since 2018-12-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/role")
|
||||
@Slf4j
|
||||
public class SysRoleController {
|
||||
@Autowired
|
||||
private ISysRoleService sysRoleService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param role
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysRole>> queryPageList(SysRole role,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
|
||||
QueryWrapper<SysRole> queryWrapper = new QueryWrapper<SysRole>(role);
|
||||
Page<SysRole> page = new Page<SysRole>(pageNo,pageSize);
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
//TODO 过滤逻辑处理
|
||||
//TODO begin、end逻辑处理
|
||||
//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
|
||||
//创建时间/创建人的赋值
|
||||
IPage<SysRole> pageList = sysRoleService.page(page, queryWrapper);
|
||||
log.info("查询当前页:"+pageList.getCurrent());
|
||||
log.info("查询当前页数量:"+pageList.getSize());
|
||||
log.info("查询结果数量:"+pageList.getRecords().size());
|
||||
log.info("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysRole> add(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
try {
|
||||
role.setCreateTime(new Date());
|
||||
sysRoleService.save(role);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysRole> eidt(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
SysRole sysrole = sysRoleService.getById(role.getId());
|
||||
if(sysrole==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
role.setUpdateTime(new Date());
|
||||
boolean ok = sysRoleService.updateById(role);
|
||||
//TODO 返回false说明什么?
|
||||
if(ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysRole> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
SysRole sysrole = sysRoleService.getById(id);
|
||||
if(sysrole==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysRoleService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysRole> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.sysRoleService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<SysRole> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
SysRole sysrole = sysRoleService.getById(id);
|
||||
if(sysrole==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
result.setResult(sysrole);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/queryall", method = RequestMethod.GET)
|
||||
public Result<List<SysRole>> queryall() {
|
||||
Result<List<SysRole>> result = new Result<>();
|
||||
List<SysRole> list = sysRoleService.list();
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到角色信息");
|
||||
}else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色编码唯一
|
||||
*/
|
||||
@RequestMapping(value = "/checkRoleCode", method = RequestMethod.GET)
|
||||
public Result<Boolean> checkUsername(String id,String roleCode) {
|
||||
Result<Boolean> result = new Result<>();
|
||||
result.setResult(true);//如果此参数为false则程序发生异常
|
||||
log.info("--验证角色编码是否唯一---id:"+id+"--roleCode:"+roleCode);
|
||||
try {
|
||||
SysRole role = null;
|
||||
if(oConvertUtils.isNotEmpty(id)) {
|
||||
role = sysRoleService.getById(id);
|
||||
}
|
||||
SysRole newRole = sysRoleService.getOne(new QueryWrapper<SysRole>().lambda().eq(SysRole::getRoleCode, roleCode));
|
||||
if(newRole!=null) {
|
||||
//如果根据传入的roleCode查询到信息了,那么就需要做校验了。
|
||||
if(role==null) {
|
||||
//role为空=>新增模式=>只要roleCode存在则返回false
|
||||
result.setSuccess(false);
|
||||
result.setMessage("角色编码已存在");
|
||||
return result;
|
||||
}else if(!id.equals(newRole.getId())) {
|
||||
//否则=>编辑模式=>判断两者ID是否一致-
|
||||
result.setSuccess(false);
|
||||
result.setMessage("角色编码已存在");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setResult(false);
|
||||
result.setMessage(e.getMessage());
|
||||
return result;
|
||||
}
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,283 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.entity.SysUserRole;
|
||||
import org.jeecg.modules.system.service.ISysUserRoleService;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author scott
|
||||
* @since 2018-12-20
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/user")
|
||||
public class SysUserController {
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserRoleService sysUserRoleService;
|
||||
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysUser>> queryPageList(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
|
||||
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<SysUser>(user);
|
||||
Page<SysUser> page = new Page<SysUser>(pageNo,pageSize);
|
||||
//排序逻辑 处理
|
||||
String column = req.getParameter("column");
|
||||
String order = req.getParameter("order");
|
||||
if(oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
if("asc".equals(order)) {
|
||||
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
}else {
|
||||
queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
}
|
||||
}
|
||||
//TODO 多字段排序
|
||||
//TODO 过滤逻辑处理
|
||||
//TODO begin、end逻辑处理
|
||||
//TODO 一个强大的功能,前端传一个字段字符串,后台只返回这些字符串对应的字段
|
||||
//创建时间/创建人的赋值
|
||||
IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysUser> add(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
String selectedRoles = jsonObject.getString("selectedroles");
|
||||
try {
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
user.setCreateTime(new Date());//设置创建时间
|
||||
String salt = oConvertUtils.randomGen(8);
|
||||
user.setSalt(salt);
|
||||
String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), salt);
|
||||
user.setPassword(passwordEncode);
|
||||
user.setStatus(1);
|
||||
user.setDelFlag("0");
|
||||
sysUserService.addUserWithRole(user, selectedRoles);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysUser> eidt(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
try {
|
||||
SysUser sysUser = sysUserService.getById(jsonObject.getString("id"));
|
||||
if(sysUser==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
user.setUpdateTime(new Date());
|
||||
//String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
|
||||
user.setPassword(sysUser.getPassword());
|
||||
String roles = jsonObject.getString("selectedroles");
|
||||
sysUserService.editUserWithRole(user, roles);
|
||||
result.success("修改成功!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysUser> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
SysUser sysUser = sysUserService.getById(id);
|
||||
if(sysUser==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysUserService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysUser> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.sysUserService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/frozenBatch", method = {RequestMethod.POST,RequestMethod.GET})
|
||||
public Result<SysUser> frozenBatch(@RequestParam(name="ids",required=true) String ids,@RequestParam(name="status",required=true) String status) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
try {
|
||||
String[] arr = ids.split(",");
|
||||
for (String id : arr) {
|
||||
if(oConvertUtils.isNotEmpty(id)) {
|
||||
this.sysUserService.update(new SysUser().setStatus(Integer.parseInt(status)),
|
||||
new UpdateWrapper<SysUser>().lambda().eq(SysUser::getId,id));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.error500("操作失败"+e.getMessage());
|
||||
}
|
||||
result.success("操作成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<SysUser> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
SysUser sysUser = sysUserService.getById(id);
|
||||
if(sysUser==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
result.setResult(sysUser);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/queryUserRole", method = RequestMethod.GET)
|
||||
public Result<List<String>> queryUserRole(@RequestParam(name="userid",required=true) String userid) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<SysUserRole> userRole = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getUserId,userid));
|
||||
if(userRole==null || userRole.size()<=0) {
|
||||
result.error500("未找到用户相关角色信息");
|
||||
}else {
|
||||
for (SysUserRole sysUserRole : userRole) {
|
||||
list.add(sysUserRole.getRoleId());
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(list);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户账号是否唯一<br>
|
||||
* 可以校验其他 需要检验什么就传什么。。。
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/checkOnlyUser", method = RequestMethod.GET)
|
||||
public Result<Boolean> checkUsername(SysUser sysUser) {
|
||||
Result<Boolean> result = new Result<>();
|
||||
result.setResult(true);//如果此参数为false则程序发生异常
|
||||
String id = sysUser.getId();
|
||||
log.info("--验证用户信息是否唯一---id:"+id);
|
||||
try {
|
||||
SysUser oldUser = null;
|
||||
if(oConvertUtils.isNotEmpty(id)) {
|
||||
oldUser = sysUserService.getById(id);
|
||||
}else {
|
||||
sysUser.setId(null);
|
||||
}
|
||||
//通过传入信息查询新的用户信息
|
||||
SysUser newUser = sysUserService.getOne(new QueryWrapper<SysUser>(sysUser));
|
||||
if(newUser!=null) {
|
||||
//如果根据传入信息查询到用户了,那么就需要做校验了。
|
||||
if(oldUser==null) {
|
||||
//oldUser为空=>新增模式=>只要用户信息存在则返回false
|
||||
result.setSuccess(false);
|
||||
result.setMessage("用户账号已存在");
|
||||
return result;
|
||||
}else if(!id.equals(newUser.getId())) {
|
||||
//否则=>编辑模式=>判断两者ID是否一致-
|
||||
result.setSuccess(false);
|
||||
result.setMessage("用户账号已存在");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setResult(false);
|
||||
result.setMessage(e.getMessage());
|
||||
return result;
|
||||
}
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
@RequestMapping(value = "/changPassword", method = RequestMethod.PUT)
|
||||
@RequiresRoles({"admin"})
|
||||
public Result<SysUser> changPassword(@RequestBody SysUser sysUser) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
String password = sysUser.getPassword();
|
||||
sysUser = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, sysUser.getUsername()));
|
||||
if(sysUser==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
String salt = oConvertUtils.randomGen(8);
|
||||
sysUser.setSalt(salt);
|
||||
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(),password, salt);
|
||||
sysUser.setPassword(passwordEncode);
|
||||
this.sysUserService.updateById(sysUser);
|
||||
result.setResult(sysUser);
|
||||
result.success("密码修改完成!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 系统通告表
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-01-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_announcement")
|
||||
public class SysAnnouncement implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**标题*/
|
||||
private java.lang.String titile;
|
||||
/**内容*/
|
||||
private java.lang.Object msgContent;
|
||||
/**开始时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date startTime;
|
||||
/**结束时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date endTime;
|
||||
/**发布人*/
|
||||
private java.lang.String sender;
|
||||
/**优先级(L低,M中,H高)*/
|
||||
private java.lang.String priority;
|
||||
/**通告对象类型(USER:指定用户,ALL:全体用户)*/
|
||||
private java.lang.String msgType;
|
||||
/**发布状态(0未发布,1已发布,2已撤销)*/
|
||||
private java.lang.String sendStatus;
|
||||
/**发布时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date sendTime;
|
||||
/**撤销时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date cancelTime;
|
||||
/**删除状态(0,正常,1已删除)*/
|
||||
private java.lang.String delFlag;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
private java.lang.String updateBy;
|
||||
/**更新时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
/**指定用户**/
|
||||
private java.lang.String userIds;
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表
|
||||
* <p>
|
||||
*
|
||||
* @author Steve
|
||||
* @Since 2019-01-22
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_depart")
|
||||
public class SysDepart implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
/**父机构ID*/
|
||||
private String parentId;
|
||||
/**机构/部门名称*/
|
||||
private String departName;
|
||||
/**英文名*/
|
||||
private String departNameEn;
|
||||
/**缩写*/
|
||||
private String departNameAbbr;
|
||||
/**排序*/
|
||||
private Integer departOrder;
|
||||
/**描述*/
|
||||
private Object description;
|
||||
/**机构类型*/
|
||||
private String orgType;
|
||||
/**机构编码*/
|
||||
private String orgCode;
|
||||
/**手机号*/
|
||||
private String mobile;
|
||||
/**传真*/
|
||||
private String fax;
|
||||
/**地址*/
|
||||
private String address;
|
||||
/**备注*/
|
||||
private String memo;
|
||||
/**状态(1启用,0不启用)*/
|
||||
private String status;
|
||||
/**删除状态(0,正常,1已删除)*/
|
||||
private String delFlag;
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 重写equals方法
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
SysDepart depart = (SysDepart) o;
|
||||
return Objects.equals(id, depart.id) &&
|
||||
Objects.equals(parentId, depart.parentId) &&
|
||||
Objects.equals(departName, depart.departName) &&
|
||||
Objects.equals(departNameEn, depart.departNameEn) &&
|
||||
Objects.equals(departNameAbbr, depart.departNameAbbr) &&
|
||||
Objects.equals(departOrder, depart.departOrder) &&
|
||||
Objects.equals(description, depart.description) &&
|
||||
Objects.equals(orgType, depart.orgType) &&
|
||||
Objects.equals(orgCode, depart.orgCode) &&
|
||||
Objects.equals(mobile, depart.mobile) &&
|
||||
Objects.equals(fax, depart.fax) &&
|
||||
Objects.equals(address, depart.address) &&
|
||||
Objects.equals(memo, depart.memo) &&
|
||||
Objects.equals(status, depart.status) &&
|
||||
Objects.equals(delFlag, depart.delFlag) &&
|
||||
Objects.equals(createBy, depart.createBy) &&
|
||||
Objects.equals(createTime, depart.createTime) &&
|
||||
Objects.equals(updateBy, depart.updateBy) &&
|
||||
Objects.equals(updateTime, depart.updateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写hashCode方法
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
return Objects.hash(super.hashCode(), id, parentId, departName,
|
||||
departNameEn, departNameAbbr, departOrder, description,
|
||||
orgType, orgCode, mobile, fax, address, memo, status,
|
||||
delFlag, createBy, createTime, updateBy, updateTime);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表
|
||||
* </p>
|
||||
*
|
||||
* @author zhangweijian
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class SysDict implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String dictName;
|
||||
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
private String dictCode;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 删除状态
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zhangweijian
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class SysDictItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典id
|
||||
*/
|
||||
private String dictId;
|
||||
|
||||
/**
|
||||
* 字典项文本
|
||||
*/
|
||||
private String itemText;
|
||||
|
||||
/**
|
||||
* 字典项值
|
||||
*/
|
||||
private String itemValue;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private BigDecimal sortOrder;
|
||||
|
||||
/**
|
||||
* 状态(1启用 0不启用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统日志表
|
||||
* </p>
|
||||
*
|
||||
* @author zhangweijian
|
||||
* @since 2018-12-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class SysLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 耗时
|
||||
*/
|
||||
private Long costTime;
|
||||
|
||||
/**
|
||||
* IP
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String requestParam;
|
||||
|
||||
/**
|
||||
* 请求类型
|
||||
*/
|
||||
private String requestType;
|
||||
|
||||
/**
|
||||
* 请求路径
|
||||
*/
|
||||
private String requestUrl;
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 操作人用户名称
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 操作人用户账户
|
||||
*/
|
||||
private String userid;
|
||||
/**
|
||||
* 操作详细日志
|
||||
*/
|
||||
private String logContent;
|
||||
|
||||
/**
|
||||
* 日志类型(1登录日志,2操作日志)
|
||||
*/
|
||||
private Integer logType;
|
||||
|
||||
/**
|
||||
* 操作类型()
|
||||
*/
|
||||
private Integer operateType;
|
||||
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单权限表
|
||||
* </p>
|
||||
*
|
||||
* @author scott
|
||||
* @since 2018-12-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class SysPermission implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单权限编码,例如:“sys:schedule:list,sys:schedule:info”,多个逗号隔开
|
||||
*/
|
||||
private String perms;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 组件
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 一级菜单跳转地址
|
||||
*/
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 菜单排序
|
||||
*/
|
||||
private Integer sortNo;
|
||||
|
||||
/**
|
||||
* 类型(0:一级菜单;1:子菜单 ;2:按钮权限)
|
||||
*/
|
||||
private Integer menuType;
|
||||
|
||||
/**
|
||||
* 是否叶子节点: 1:是 0:不是
|
||||
*/
|
||||
private Integer isLeaf;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 删除状态 0正常 1已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 是否隐藏路由菜单: 0否,1是(默认值0)
|
||||
*/
|
||||
private boolean hidden;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**alwaysShow*/
|
||||
private boolean alwaysShow;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user